lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

[Bug]: {"error":"user_already_exists"} when saving user settings without avatar

Open aeharding opened this issue 2 years ago • 1 comments

Requirements

  • [X] Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • [X] Did you check to see if this issue already exists?
  • [X] Is this only a single bug? Do not put multiple bugs in one issue.
  • [X] Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Summary

PUT /api/v3/user/save_user_settings requires avatar or else it fails error code 400 with {"error":"user_already_exists"}

Steps to Reproduce

  1. PUT /api/v3/user/save_user_settings with payload {"show_nsfw":false,"auth":"{insert_jwt_here"}
  2. Observe error code 400 with {"error":"user_already_exists"}

Adding avatar field causes the request to succeed.

Request should not require avatar

Technical Details

Please see above.

Version

0.18.1

Lemmy Instance URL

lemmy.world

aeharding avatar Jul 09 '23 16:07 aeharding

I think the problem is that there are two DB transactions in the SaveUserSettings call. one for person and one for local_user. For it not to fail, it seems that a value of one of the two structures needs to change (i.e. at least one of {display_name,bio,matrix_user_id,bot_account,avatar,banner} and one of the remaining fields).

gallrein avatar Jul 10 '23 13:07 gallrein

https://github.com/LemmyNet/lemmy/pull/4077

Nutomic avatar Nov 22 '23 11:11 Nutomic