Skip to content

Commit

Permalink
checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
jctanner committed Oct 4, 2023
1 parent cb4bcc1 commit 2a0e251
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions dev/scripts.commnunity/fix_social_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
User = get_user_model()


def transform_name(github_login):
ns = github_login.lower().replace('-', '_')
if ns[0].isdigit():
ns = 'gh_' + ns
return ns


def find_related_v3_namespaces(github_login):
transformed = github_login.lower().replace('-', '_')
#if transformed[0].isdigit():
Expand All @@ -26,6 +33,7 @@ def find_related_v3_namespaces(github_login):
current_email = current_user.email
github_login = social_user.extra_data.get('login')
github_id = social_user.extra_data.get('id')
transformed_login = transform_name(github_login)

unverified_email = generate_unverified_email(github_id)

Expand Down Expand Up @@ -90,5 +98,15 @@ def find_related_v3_namespaces(github_login):
if provider_namespace:
print(f'\t\tprovider:{provider_namespace}')

if provider_namespace.name == github_login.lower() + '0':
print(f'\t\t\tFIX - set {legacy_namespace} to the "right" provider namespace')
if legacy_namespace and provider_namespace and \
legacy_namespace.name == provider_namespace.name and \
provider_namespace in owned_namespaces:
continue

if legacy_namespace and provider_namespace and \
transformed_login == provider_namespace.name and \
provider_namespace in owned_namespaces:
continue

if provider_namespace.name == transformed_login + '0':
print(f'\t\t\tFIX - set {legacy_namespace} to the "right" provider namespace')

0 comments on commit 2a0e251

Please sign in to comment.