You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.
Summary
Start by having no intersection in community allowed languages and user languages or two or more non-undetermined languages as intersection. The test community must not have Undetermined as allowed language.
When updating the post however, Lemmy-UI explicitly includes the Undefined as language id. Since this was returned by the server, it should be safe to assume that a post could be saved with the same value again, but Lemmy now raises a LanguageNotAllowed error.
The logic to update a post is quite similar to the creation, although the fallback to determine a default language is not present. Instead, this only checks if the provided language id, if one is provided, is allowed in the community.
Unlike during post creation, Lemmy-UI will now send the language id previously provided by the server, and the Undetermined language will now fail the test. This time the check will fail, as Undetermined is not None, and Undetermined is not an allowed language in the community.
What do you think about just updating is_allowed_community_language() to always return Ok(()) when for_language_id is UNDETERMINED_ID?
This looks like a problem in lemmy-ui. When creating a new post with no language selected, it doesnt send any language_id value. But when editing a post, also with no language selected, it sends language_id: 0 which fails a backend check. So it should be consistent and leave out language_id in both cases.
A counterargument could be that the post is automatically set to language_id: 0.
Would it be unreasonable to expect that a value in an edit body, which is equal to the current DB value, is valid?
Alright I made a change in #5132, so it always assigns a default language if language id is 0 or null and checks if the language is valid after that. In my testing I couldnt reproduce your problem anymore, can you also give it a try?
Requirements
Summary
Start by having no intersection in community allowed languages and user languages or two or more non-undetermined languages as intersection. The test community must not have
Undetermined
as allowed language.When creating a new post, for example in Lemmy-UI, no language id is passed in the request body if no language is selected by the user.
Lemmy first checks if the provided language is acceptable. If no language is provided, this check simply returns success.
Next, Lemmy will determine the default post language to use. It will query the community languages and user languages and use the intersection if there is a single language that is not
Undetermined
or the non-undetermined language if the intersection isUndetermined
and one other language. If no language could be found, the language id will not be passed to the DB and the column default of0
, which maps toUndetermined
.Based on this logic, it is clear that it should always be possible to create a post with
Undetermined
language.When updating the post however, Lemmy-UI explicitly includes the
Undefined
as language id. Since this was returned by the server, it should be safe to assume that a post could be saved with the same value again, but Lemmy now raises aLanguageNotAllowed
error.The logic to update a post is quite similar to the creation, although the fallback to determine a default language is not present. Instead, this only checks if the provided language id, if one is provided, is allowed in the community.
Unlike during post creation, Lemmy-UI will now send the language id previously provided by the server, and the
Undetermined
language will now fail the test. This time the check will fail, asUndetermined
is notNone
, andUndetermined
is not an allowed language in the community.What do you think about just updating
is_allowed_community_language()
to always returnOk(())
whenfor_language_id
isUNDETERMINED_ID
?Steps to Reproduce
Afaraf
andavesta
Afrikaans
Technical Details
see above
Version
0.19.6-beta.4
Lemmy Instance URL
voyager.lemmy.ml
The text was updated successfully, but these errors were encountered: