Skip to content

Commit

Permalink
fix(profile): do not set biography to an empty string when updating p…
Browse files Browse the repository at this point in the history
…rofile

The requests for all profile update functions, besides the  function,
were missing the  parameter. This meant the biography would be set to the
default value, an empty string.

Fixes #161
  • Loading branch information
stanvanrooy committed May 12, 2021
1 parent e285917 commit 9d25af8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions instauto/api/actions/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def _profile_act(self, obj: Union[Update, SetBiography, SetGender]) -> Response:
if obj.external_url is None: obj.external_url = current_data['user']['external_url']
if obj.email is None: obj.email = current_data['user']['email']
if obj.username is None: obj.username = current_data['user']['trusted_username']
if not isinstance(obj, SetBiography) or obj.biography is None:
obj.biography = current_data['user']['biography_with_entities']['raw_text']

endpoint = 'accounts/edit_profile/'
obj.fill(self)
Expand Down
2 changes: 1 addition & 1 deletion instauto/api/actions/structs/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Update(cmmn.Base):
_csrftoken: str = None
_uid: str = None # user id
_uuid: str = None
raw_text: str = None
_csrftoken: str = None

def __init__(self, external_url: Optional[str], phone_number: Optional[str] = None, username: Optional[str] = None,
first_name: Optional[str] = None, email: Optional[str] = None, *args, **kwargs):
Expand Down

0 comments on commit 9d25af8

Please sign in to comment.