Skip to content

Commit

Permalink
Renamed user t social_user
Browse files Browse the repository at this point in the history
  • Loading branch information
Shritesh99 committed Dec 6, 2023
1 parent 1bbd8ad commit 095b7c8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 19 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/release_steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,5 @@ jobs:
git remote set-url origin https://${{ github.actor }}:${{ secrets.BOT_TOKEN }}@github.com/${{ github.repository }}
autopub prepare
poetry build
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git rm --cached RELEASE.md
git commit -m "Release ${{ github.repository_basename }} ${{ github.event.release.name }}"
git push origin master --force
autopub commit
poetry publish --username=__token__
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Tests](https://img.shields.io/github/actions/workflow/status/shritesh99/strawberry-django-social-auth/tests.yml?label=Tests&style=for-the-badge)](https://github.com/shritesh99/strawberry-django-social-auth/actions/workflows/tests.yml)
[![Tests](https://img.shields.io/github/actions/workflow/status/shritesh99/strawberry-django-social-auth/release.yaml?label=Tests&style=for-the-badge)](https://github.com/shritesh99/strawberry-django-social-auth/actions/workflows/tests.yml)

[![Codecov](https://img.shields.io/codecov/c/github/shritesh99/strawberry-django-social-auth?style=for-the-badge)](https://app.codecov.io/gh/shritesh99/strawberry-django-social-auth)

Expand Down
3 changes: 3 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Release type: patch

Renamed user to social_user
6 changes: 3 additions & 3 deletions gql_social_auth/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def social_auth(f):
"""
@psa
@wraps(f)
def wrapper(cls, info, _input, user, errors, **kwargs):
def wrapper(cls, info, _input, social_user, errors, **kwargs):
def on_resolve(payload):
payload.user = user
payload.social_user = social_user
payload.errors = errors
return payload

result = f(cls, info, _input, user, errors, **kwargs)
result = f(cls, info, _input, social_user, errors, **kwargs)

if is_thenable(result):
return Promise.resolve(result).then(on_resolve)
Expand Down
4 changes: 2 additions & 2 deletions gql_social_auth/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SocialAuthMixin(BaseMixin):

@classmethod
@social_auth
def resolve_mutation(cls, info: Info, input_: SocialAuthInput, user, errors) -> SocialType:
def resolve_mutation(cls, info: Info, input_: SocialAuthInput, social_user, errors) -> SocialType:
if errors is not None:
return SocialType(success=False, errors=errors)
return SocialType.from_social_user(user)
return SocialType.from_social_user(social_user)
14 changes: 7 additions & 7 deletions gql_social_auth/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ class SocialType(ObtainJSONWebTokenType):
resolver=resolve_extra_data)

@classmethod
def from_social_user(cls, user) -> "SocialType":
def from_social_user(cls, social_user) -> "SocialType":
"""
Creates a new token and possibly a new refresh token based on the user.
"""
ret = SocialType(
success=True,
user=cast(UserType, user),
token=TokenType.from_user(user),
uid=user.social_user.uid,
provider=user.social_user.provider,
user=cast(UserType, social_user),
token=TokenType.from_user(social_user),
uid=social_user.social_user.uid,
provider=social_user.social_user.provider,
)
if hasattr(settings, 'SOCIAL_AUTH_PIPELINE') and 'gql_social_auth.pipeline.get_avatar' in settings.SOCIAL_AUTH_PIPELINE:
ret.avatar = user.avatar
ret.avatar = social_user.avatar
if app_settings.JWT_LONG_RUNNING_REFRESH_TOKEN:
ret.refresh_token = cast(RefreshTokenType, RefreshToken.from_user(user))
ret.refresh_token = cast(RefreshTokenType, RefreshToken.from_user(social_user))
return ret

0 comments on commit 095b7c8

Please sign in to comment.