Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify password length limits in error (fixes #3284) #4007

Merged
merged 2 commits into from
Oct 5, 2023

Conversation

Nutomic
Copy link
Member

@Nutomic Nutomic commented Oct 2, 2023

No description provided.

@@ -106,6 +106,7 @@ pub enum LemmyErrorType {
PersonIsBlocked,
DownvotesAreDisabled,
InstanceIsPrivate,
#[serde(rename = "Password must be between 10 and 60 characters")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't feel like serde rename is the right thing to do here and this seems to make the code worse to me. The error enum should be something you can match by in the client exactly e.g. if e.error === "InvalidPassword" { show(e.message) } and not something that will change over time or be printable directly.

So it seems to me like maybe this should rather be InvalidPassword(String) or InvalidPassword(&'static str) or there should be a separate (client-side) mapping from LemmyErrorType to a printable (and translatable) string.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I converted this to a comment instead. Also moving the issue to lemmy-ui.

@dessalines dessalines merged commit 0115613 into main Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants