ajones05 / seearound.me-ionic

0 stars 0 forks source link

Edit profile #85

Closed ajones05 closed 7 years ago

ajones05 commented 7 years ago

When I hit save changes, it goes back to the profile but without any changes. (I tried to edit interests, but nothing changed)

ajones05 commented 7 years ago

Later when I viewed my profile from a different user, the whole profile looks empty

abdulhafeez commented 7 years ago

I could not reproduce the issue. How did you login new user? FB or Email?

ajones05 commented 7 years ago
  1. Either one. No matter what, when I hit "save" after making changes to my profile it doesn't change.
  2. Afterward I logged out and logged in with email to another test account. When I viewed the first profile all the fields were visible but empty. I can take screenshots or a video if it would help.
ajones05 commented 7 years ago

Here's an example: I edit my profile - in this case, "interests" - then go back to view my profile and the changes I saved are not shown; instead, it shows the old interests. Video: https://www.dropbox.com/s/5fy0qw043c9vuwc/edit%20profile%20issue.mov?dl=0

abdulhafeez commented 7 years ago

@yuriyua I have noticed that we are not sending interests as parameter when updating a profile. In the docs, I can see that http://www.seearound.me/mobile/edit-profile does not include interests or activity param. Can you please tell me what should be the name of this param? and is it being updated on the server side?

yuriyua commented 7 years ago

done, I added "interest" parameter to mobile/edit-profile gateway https://github.com/ajones05/seearound.me/wiki/Mobile-Api-Reference/_compare/f48cfd0b23303da5ab58640522eeb1ce3c53cf02...a54ec6179b6190a2508d8a437acfd53d85feb5c8

abdulhafeez commented 7 years ago

@ajones05 I have uploaded a build after fixing it but without testing as my iPhone is off. I am waiting for it to wakeup. When left without charging, some times it takes a lot of time to wake up.

abdulhafeez commented 7 years ago

iPhone just woke up and so I tested it. Looks like it has been fixed. I can update my profile. I think all issues for 'Go' have been fixed. Let me know if all is well and I'll prepare the release build.

ajones05 commented 7 years ago

I am experiencing the same issue as I described before:

When I hit save changes, it goes back to the profile but without any changes. (I tried to edit interests, but nothing changed)

Any changes I make and save DO appear to save in the "edit profile" view, but NOT in the actual profile that is visible to others. (So in the regular profile view, it is not updated. But if I go back to Edit Profile then I see the changes I had made).

ajones05 commented 7 years ago

Still no change for me on this issue

yuriyua commented 7 years ago

it works from the server side

abdulhafeez commented 7 years ago

It works for me as well. So the issue is really weird. I am trying to investigate.

abdulhafeez commented 7 years ago

@yuriyua It appears to be an issue with DOB. I am getting this response: {"data":{"status":"FAILED","message":"\"birth_date\" - 'Thu Jun 02 1977 00:00:00 GMT+0500 (PKT)' is not valid"},"status":200,"config":{"method":"POST","transformRequest":[null,null],"transformResponse":[null],"url":"http://www.seearoundgo.com/mobile/edit-profile","data":{"token":"T695749B14Z4X1X4TPZ54M2823PTCYL75XCB1MM2RL5NM2SGRSMVFP4HRTD6S2DY","name":"Abdul Hafeez","email":"ahz.100@hotmail.com","birth_date":"1977-06-01T19:00:00.000Z","publicprofile":0,"gender":"Male","interest":"Foot","image":"http://www.seearoundgo.com/uploads/default.jpg"},"headers":{"Accept":"application/json, text/plain, /_","Content-Type":"application/x-www-form-urlencoded;charset=utf-8"}},"statusText":"OK"}

In what format are you expecting the date? Can we change it to timestamp? It is not a good idea to send date in some format to server. It will always cause trouble.

Interesting thing is that data is saved properly despite this failure response. Perhaps that is why I could not see this error.

abdulhafeez commented 7 years ago

Note: I have tried to send date in many formats but nothing works including [DD-MM-YYYY]

yuriyua commented 7 years ago

I old api version it was DD-MM-YYYY https://github.com/ajones05/seearound.me/wiki/Mobile-Api-Reference#-mobileedit-profile

I think it bad idea to save just date in timestamp forma...

yuriyua commented 7 years ago

I tested. It works from server side

Note: I have tried to send date in many formats but nothing works including [DD-MM-YYYY]

Can you send me requests/responses examples?

abdulhafeez commented 7 years ago

You can see request and response data in above example i pasted where "birth_date":"1977-06-01T19:00:00.000Z" Should I send just a string like "02-06-1977" ?

yuriyua commented 7 years ago

Should I send just a string like "02-06-1977" ?

yes, for example 21-12-1980

abdulhafeez commented 7 years ago

OK, there were some date formatting issues which might be responsible for this behaviour. I have fixed them and now it seems to be working fine.

ajones05 commented 7 years ago

Profile edits (like change in "date of birth" or "interests") are still not getting saved. I have tried existing and new profiles and it is not working in all cases.

abdulhafeez commented 7 years ago

I am not getting any issue with it now: {"data":{"status":"SUCCESS","message":"User profile has been updated successfully","result":{"user_id":"426","karma":0,"Name":"Test User","Email_id":"test000@test.com","address":"Unnamed Road, Lahore, Punjab, PK","latitude":"31.57411226288475","longitude":"74.4117033103263","Profile_image":"http://www.seearoundgo.com/uploads/default.jpg","Gender":"Male","Activities":"Test","Birth_date":"10-06-1987"}},"status":200,"config":{"method":"POST","transformRequest":[null,null],"transformResponse":[null],"url":"http://www.seearoundgo.com/mobile/edit-profile","data":{"name":"Test User","email":"test000@test.com","birth_date":"10-06-1987","publicprofile":false,"gender":"Male","interest":"Test","image":"http://www.seearoundgo.com/uploads/default.jpg","token":"RN8A2N7V57HIYGM8Q1V9ZR8Y4RCAS6BLTIYX95RDBBZ9TLHKMDTM64LAXZKP5YC1"},"headers":{"Accept":"application/json, text/plain, /_","Content-Type":"application/x-www-form-urlencoded;charset=utf-8"}},"statusText":"OK"}

Wonder what is happening. Are you sure you installed latest build?

ajones05 commented 7 years ago

The latest build is 0.2.3 right? That's the version I have installed. But it still works the same for me as this comment from before. Not sure if the video helps, but there's no change since then.

Here's an example: I edit my profile - in this case, "interests" - then go back to view my profile and the changes I saved are not shown; instead, it shows the old interests. Video: https://www.dropbox.com/s/5fy0qw043c9vuwc/edit%20profile%20issue.mov?dl=0

It's like it successfully saves the changes within the Edit Profile view, but then as soon as I hit the back arrow it reloads the profile from a previous version.

abdulhafeez commented 7 years ago

Quite weird. I am trying to diagnose the problem.

abdulhafeez commented 7 years ago

Have you tried to kill the app after saving changes and then open back to see if changes have been really saved?

abdulhafeez commented 7 years ago

In my case, it does show the saved changes on doing the above and also right after coming back from the edit view.

abdulhafeez commented 7 years ago

I think I have found the culprit. Just to confirm, one last question: When you press save button on edit profile, does it go back to profile page itself or you have to tap on back button?

ajones05 commented 7 years ago

Have you tried to kill the app after saving changes and then open back to see if changes have been really saved?

I just tried and found the same result: nothing was actually saved.

I think I have found the culprit. Just to confirm, one last question: When you press save button on edit profile, does it go back to profile page itself or you have to tap on back button?

It does not go back to the profile page itself. Here is what happens for me:

  1. I hit save at the bottom.
  2. It briefly flashes "Saving changes"
  3. It stays on the Edit Profile page (until I hit the back button).
abdulhafeez commented 7 years ago

Thanks. That confirms my doubts. You must have seen some issues after attempting it ... like there are no posts if you kill the app and open again and that it was working on first attempt but subsequent attempts failed. These are all related and have a common root cause: There is no token when the updated user data is saved.

@yuriyua The user data in response of mobile/edit-profile does not have token. I was saving it as it is which caused all troubles. Would you like to include the token or I should manage it on my side and use saved token?

yuriyua commented 7 years ago

I think it doesn't make sense for update token on save user changes you need use saved token

abdulhafeez commented 7 years ago

OK, thanks

abdulhafeez commented 7 years ago

@ajones05 You must signout before testing anything in the new build (0.2.4) so that wrong data is cleared.

ajones05 commented 7 years ago

It looks like saving changes to profile isn't working again. I just tried to make changes to an account's profile but it didn't work.

abdulhafeez commented 7 years ago

It is working. I tested on android and iPhone. Working fine on both. I don't see any issue with this functionality now.

ajones05 commented 7 years ago

Still not working. Try changing name or profile image for this user, for example (doesn't work for me): user: vvhat.if@gmail.com pw: Resource17

yuriyua commented 7 years ago

it works from the server side http://www.seearound.me/admin/mobile-api/edit-profile/token/Y3TXR4KS8MFQ9NES33QB92HBECNF157Z83V26GVD5B5D1K84MZFY2ZAGBZYC56BD/name/New+test+2/email/vvhat.if@gmail.com/submit

http://www.seearound.me/profile/436

ajones05 commented 7 years ago

Here's a screen video. Maybe I'm doing something different that is causing the issue? https://www.dropbox.com/s/y7fj99ginpn4eer/Edit%20profile%20issue.mov?dl=0

*Note: a friend using an Android phone to test confirmed he can't save edits to his profile, either

abdulhafeez commented 7 years ago

Looks like it was due to a javascript error generating due to date format issues. I have fixed it. If the problem was this, then it should be OK now.

ajones05 commented 7 years ago

Still not working for me, although it might be related to the date issue. When I go to "edit profile," the date is blank, instead of having my date of birth. If I select into it, it defaults to today's date. If I save it and go back, it switches back to what it was previously. I can create another video capture if it will help, but it's the same as the last one I shared.

abdulhafeez commented 7 years ago

This is slightly different issue. I realised it after distributing android version and fixed for ios. Please test iOS version and see if it is saving changes.

ajones05 commented 7 years ago

Same as before, but I think I might have discovered the issue and it is related to date of birth.

You can try on this account. Log in and under edit profile try to change the name (but leave DOB empty as it is). You'll see it won't work. vvhat.if // Resource17

So in cases where a DOB is not displayed, nothing else can be saved unless it is also set to a date and saved.

However, that should be changed since users should not have to set a DOB if they don't want to.

Also, do we get DOB from facebook login? Testing on an account with FB login, the age is displayed but DOB is also empty, causing the same issue.

yuriyua commented 7 years ago

2016-12-06_19h02_49

abdulhafeez commented 7 years ago

Clearly, the date format in case of FB login is different. In case of normal login, I get dd-mm-yyyy while in case of FB login I get yyyy-mm-dd as obvious from the image @yuriyua posted. @yuriyua can you make the format same for both cases?

abdulhafeez commented 7 years ago

@ajones05 It is the difference of date formats coming from server side that is causing issues. I have tried with vvhatif account and I can see the exact issue you are getting. Looking into the data, the dob is like this: "Birth_date":"1983-03-25" This is wrong format. In some previous discussion, yuriyua and I agreed upon dd-mm-yyyy format so my code is expecting the format to be dd-mm-yyyy while you can see here that format in your account is yyyy-mm-dd. I wasn't getting this issue because dob format in my account was correct.

We must save same format in all cases. Whether a user logs in from FB or otherwise or updates profiles .... in all cases, the date format returned by the server must be in one single decided format.

yuriyua commented 7 years ago

there is no difference between mobile/login and mobile/fb-login date format

2016-12-06_22h05_31

you can check log:

api_response_2016-12-06.zip

date forma dd-mm-yyyy there in mobile/edit-profile response I changed it to format yyyy-mm-dd

yuriyua commented 7 years ago

@abdulhafeez Should I change date format for mobile/login and mobile/fb-login ?

abdulhafeez commented 7 years ago

That format is fine. The only thing I wanted is that it should be same everywhere. I have resolved the issue of displaying date on edit profile page by making changes according to given format. But when I try to save profile through mobile/edit-profile api, I am getting this response:

{"data":{"status":"FAILED","message":"Internal Server Error"},"status":200,"config":{"method":"POST","transformRequest":[null,null],"transformResponse":[null],"url":"http://www.seearound.me/mobile/edit-profile","data":{"name":"Andrew Jones","email":"vvhatif@gmail.com","birth_date":"25-03-1983","public_profile":0,"gender":"Male","interest":"restaurant, rally, protest, soccer, startup","image":"http://www.seearound.me/uploads/vlab8mnyns.jpg","token":"IYVCH3Z7D85DDSF2DKTV7PZBPTC73TQMRL2BN1I49NHMHZNYKISS9S51MG8PBZD5"},"headers":{"Accept":"application/json, text/plain, /","Content-Type":"application/x-www-form-urlencoded;charset=utf-8"}},"statusText":"OK"}

@yuriyua can you see why it is failing?

yuriyua commented 7 years ago

let me see

abdulhafeez commented 7 years ago

Is the format of date I am sending correct? "birth_date":"25-03-1983"

yuriyua commented 7 years ago

Fixed. Issue was from the server side in gender value

abdulhafeez commented 7 years ago

Thanks! The issue seems to be completely fixed now. I was able to update both Andrew's and my own account.