divanov11 / Mumble

An open source social media platform and public forum for questions and discussions, built for developers.
https://www.mumble.dev/
Apache License 2.0
306 stars 207 forks source link

Can't update the email address ! #374

Open MidouWebDev opened 3 years ago

MidouWebDev commented 3 years ago

Preflight Checklist

#

Describe the bug

I can't update my email address in the profile settings

#

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'mumble.dev'
  2. Click on 'profile'
  3. Scroll down to 'settings'
  4. Try to update the email address
  5. See Error

#

Expected behavior

I expected to be able to update my email address like for the avatar

#

Screenshots

Leopold-V commented 3 years ago

Hi @MidouWebDev I think it is a backend issue because whatever we modify in the user setting page, a request is sent to the api/users/profile_update/ route and always answer with an undefined email field : https://i.gyazo.com/9f3172e087236a062e49a0c17cac74bc.png .

MidouWebDev commented 3 years ago

@Leopold-V thanks bro

I will check this with @PraveenMalethia

MidouWebDev commented 3 years ago

@PraveenMalethia

ishitb commented 3 years ago

Hi @MidouWebDev I think it is a backend issue because whatever we modify in the user setting page, a request is sent to the api/users/profile_update/ route and always answer with an undefined email field : https://i.gyazo.com/9f3172e087236a062e49a0c17cac74bc.png .

An addition to this. Looking at the code it seems like the issue is that the 'api/users/profile_update/' endpoint, only updates the fields that are in the UserProfile model, and since the actual email is part of the django user model, it's not being updated.

MidouWebDev commented 3 years ago

Hi @MidouWebDev I think it is a backend issue because whatever we modify in the user setting page, a request is sent to the api/users/profile_update/ route and always answer with an undefined email field : https://i.gyazo.com/9f3172e087236a062e49a0c17cac74bc.png .

An addition to this. Looking at the code it seems like the issue is that the 'api/users/profile_update/' endpoint, only updates the fields that are in the UserProfile model, and since the actual email is part of the django user model, it's not being updated.

Yeah, Thanks That's what @Leopold-V also mentionned, i am waiting for @PraveenMalethia 's opinion

PraveenMalethia commented 3 years ago

Oh, I see , will look at that !

PraveenMalethia commented 3 years ago

i have updated the view to also modify the email field, which is of the default user model provided by Django !

mani-barathi commented 3 years ago

@MidouWebDev Assign it to me, I'll start working on this tomorrow

MidouWebDev commented 3 years ago

@mani-barathi okey, thanks !

mani-barathi commented 3 years ago

@MidouWebDev There is nothing to change in the frontend regarding the email update. If the user tries to update the email, we are making a proper request to the backend with the new email as a payload. But in the response, the email field is not present. I checked the backend route I think line number 248 should be after line number 256, such that response is created after the user object being updated with the new email.

image

@PraveenMalethia what's your thought on this?

MidouWebDev commented 3 years ago

@PraveenMalethia

PraveenMalethia commented 3 years ago

check the new_email which is received in the 'email' payload and if that is None! then it will be assigned to the user profile!

mani-barathi commented 3 years ago

@PraveenMalethia Email is not received in the user or the profile object.

okumujustine commented 3 years ago

Looks like the email update API is already working on my side? @PraveenMalethia

okumujustine commented 3 years ago

However, the frontend changes reflect after refreshing the page. ezgif com-gif-maker (2)

mani-barathi commented 3 years ago

I get that. The backend is updating the email but it's not sending the updated email back in the response. Because of that we are not able to update the email with new email in front-end.

okumujustine commented 3 years ago

I get that. The backend is updating the email but it's not sending the updated email back in the response. Because of that we are not able to update the email with new email in front-end.

Okay, i get that @mani-barathi .

A temporary solution would be to monitor success (in .then) where the API call is being made from and set the email to the entered email. Or set to the previous email in case of API call failure (in .catch) if backend will delay.

mani-barathi commented 3 years ago

@MidouWebDev should I implement the temporary fix suggested by @okumujustine

okumujustine commented 3 years ago

@MidouWebDev should I implement the temporary fix suggested by @okumujustine

That will be great, @Mr-spShuvo you could assign @mani-barathi on this if it's okay.

PraveenMalethia commented 3 years ago

Backend is updated to return updated email in response. Now you can update the frontend!

okumujustine commented 3 years ago

@mani-barathi , you are working on this !?

mani-barathi commented 3 years ago

@okumujustine I did make a simple temporary change, but if you what to take this issue go ahead and do it. Here is the link to PR I made. Mr-spShuvo was requesting some changes so have a look into that.