Page MenuHomePhabricator

Mentor dashboard's "Change your introduction message" dialog should properly display an API error
Closed, ResolvedPublic

Description

With the structured mentor list enabled, the mentor dashboard allows users to change their introduction message. This is handled through the action=growthmanagementorlist API. When the passed introduction message is too long, or when there is a different issue, the API will return an error. It looks that the mentor dashboard is unable to properly catch that error and display a meaningful error message to the user. Let's fix that.

This caused the error in T315399 and T314691.

Acceptance criteria
  • When an user submits a message longer than 240 characters in the message change dialog (must be done by changing the maxlength attribute via inspect), the message change dialog displays an error message. The message will be awkard (mentions mentors' user name and user ID), but that's OK, because changing the maxlength attribute is required to trigger the API error.

Event Timeline

Change 825389 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] MentorMessageChangeDialog: Display API errors

https://gerrit.wikimedia.org/r/825389

Change 825389 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] MentorMessageChangeDialog: Display API errors

https://gerrit.wikimedia.org/r/825389

@Urbanecm_WMF - I checked in testwiki wmf.27. I changed "GEMentorDashboardMentorIntroMessageMaxLength":240 to 24 to see what's happening in the text field - a user just cannot type (enter) more characters. Upon saving, a message get cut (as expected) and the message to a user would be shown displaying a new saved message, e.g.

Screen Shot 2022-08-31 at 6.00.16 PM.png (694×888 px, 86 KB)

Should there be an additional error message dialog? The description mentions: "the message change dialog displays an error message".

Thanks for checking @Etonkovidova!

Should there be an additional error message dialog? The description mentions: "the message change dialog displays an error message".

The error message only shows when the user somewhat bypasses the client-side validation and the server receives a message that's too long. When writing the patch, I tested this by changing the maxlength HTML attribute (which seems to work, see F35505510). I didn't realize it's also possible to directly change the GEMentorDashboardMentorIntroMessageMaxLength JS variable. The error message is probably not that important, because to trigger it, the user needs to try hard to overcome the maxlength validation.

Personally, I think maxlength is sufficient, but I can remove that and leave the error message only if that'd be more understandable?

Thanks for checking @Etonkovidova!

Should there be an additional error message dialog? The description mentions: "the message change dialog displays an error message".

The error message only shows when the user somewhat bypasses the client-side validation and the server receives a message that's too long. When writing the patch, I tested this by changing the maxlength HTML attribute (which seems to work, see F35505510). I didn't realize it's also possible to directly change the GEMentorDashboardMentorIntroMessageMaxLength JS variable. The error message is probably not that important, because to trigger it, the user needs to try hard to overcome the maxlength validation.

Personally, I think maxlength is sufficient, but I can remove that and leave the error message only if that'd be more understandable?

Thanks, @Urbanecm_WMF! I re-checked in testwiki wmf.2 and I also think that maxlength for the intro message works sufficiently. If something else, in terms of communicating additional info to users, would be needed, it could added or changed based on users' feedback.