LemmyNet / jerboa

A native android app for Lemmy
GNU Affero General Public License v3.0
1.16k stars 166 forks source link

"email_required" error when trying to change Default Sort Type #1461

Closed onchov closed 6 months ago

onchov commented 6 months ago

Jerboa Version

0.0.63

Android Version + Phone

Android 11 on Samsung S9 & Android 10 on Samsung A3

Describe The Bug

"email_required" error pops up when trying to change the Default Sort Type setting. Entering email address shouldn't be needed for that action.

To Reproduce

  1. Go to Settings > [username] Settings > Default Sort Type.
  2. Choose a sort type from the drop down list.
  3. Tap the save icon.
  4. The setting is not saved but the "email_required" error pops up instead.

In the case of a crash or when relevant include the logs

No response

MV-GH commented 6 months ago

That's a Lemmy requirement, your instance now requires email. And won't let you update your settings until you do. We are just showing you why it failed

onchov commented 6 months ago

That's a Lemmy requirement, your instance now requires email. And won't let you update your settings until you do. We are just showing you why it failed

That's not true, at least for my instance. I've just changed and saved the sort type through a browser without being asked to provide an email address.

MV-GH commented 6 months ago

The same instance as the one you receive that error message in Jerboa?

We don't do any validation

The error you receive is straight from the backend.

https://github.com/dessalines/jerboa/blob/b790ecd51cb322ac808657324cb4b37eda732a44/app/src/main/java/com/jerboa/model/AccountSettingsViewModel.kt#L37-L55

If there is a discrepancy in behaviour between Jerboa and Lemmy UI I am not sure how.

dessalines commented 6 months ago

@onchov what's your instance?

onchov commented 6 months ago

The same instance as the one you receive that error message in Jerboa?

Yes.

@onchov what's your instance?

It's feddit.nl.

I now that the changes I made through the web UI are propagated to Jerboa so this issue is half-moot to me (half because I've got a workaround, but you might want to investigate why the email requirement inconsistency; feel free to close it on my behalf if you don't). Thanks for your great work on the app, btw!

MV-GH commented 6 months ago

feddit.nl does have a email requirement. See https://feddit.nl/signup

Now why Lemmy UI does allow you to update it. Is something that will need to be investigated further. Do we use different endpoints?

MV-GH commented 6 months ago

It's the same endpoint, so maybe it is different because one request includes the field and the other doesn't ? TBC

MV-GH commented 6 months ago

Ah that's it.

Jerboa

{
   "show_nsfw":false,
   "show_scores":true,
   "theme":"browser",
   "default_sort_type":"Hot",
   "default_listing_type":"All",
   "interface_language":"browser",
   "avatar":"",
   "banner":"https://lemmy.one/pictrs/image/5e51c666-18d1-4170-8f52-57d4639cca5b.jpeg",
   "display_name":"MV [Jerboa dev]",
   "email":"",
   "bio":"",
   "matrix_user_id":"@mdevatriz:matrix.org",
   "show_avatars":true,
   "send_notifications_to_email":false,
   "bot_account":false,
   "show_bot_accounts":true,
   "show_read_posts":true
}

vs Lemmy UI

{
   "show_nsfw":false,
   "blur_nsfw":true,
   "auto_expand":false,
   "theme":"browser",
   "default_sort_type":"Hot",
   "default_listing_type":"All",
   "interface_language":"browser",
   "discussion_languages":[

   ],
   "banner":"https://lemmy.one/pictrs/image/5e51c666-18d1-4170-8f52-57d4639cca5b.jpeg",
   "display_name":"MV [Jerboa dev]",
   "show_avatars":true,
   "bot_account":false,
   "show_bot_accounts":true,
   "show_scores":true,
   "show_read_posts":true,
   "send_notifications_to_email":false,
   "matrix_user_id":"@mdevatriz:matrix.org",
   "open_links_in_new_tab":false
}
dessalines commented 6 months ago

Thx, yeah an empty string in the lemmy backend for nullable fields is how we handle 'clear' / remove.