Skip to content

Commit

Permalink
Only select social accounts from github to get the github id. (#3248) (
Browse files Browse the repository at this point in the history
…#3249)

* Only select social accounts from github to get the github id.

No-Issue

Signed-off-by: James Tanner <tanner.jc@gmail.com>

* Lint fix.

No-Issue

Signed-off-by: James Tanner <tanner.jc@gmail.com>

---------

Signed-off-by: James Tanner <tanner.jc@gmail.com>
(cherry picked from commit b63a816)
  • Loading branch information
jctanner authored Sep 19, 2023
1 parent eff3d38 commit 7ab9c10
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion galaxy/api/serializers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ def get_summary_fields(self, obj):
return d

def get_github_id(self, obj):
social_user = SocialAccount.objects.filter(user_id=obj.id).first()
social_user = SocialAccount.objects.filter(
user_id=obj.id, provider='github'
).first()
if social_user is None:
return None
return social_user.extra_data.get('id')

0 comments on commit 7ab9c10

Please # to comment.