Skip to content

DEV-1587: fix collection edit modal bugs #112

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

Merged
merged 4 commits into from
Mar 31, 2025
Merged

DEV-1587: fix collection edit modal bugs #112

merged 4 commits into from
Mar 31, 2025

Conversation

carylwyatt
Copy link
Member

'new collection' modal trigger user always anonymous

current behavior

From mb landing page, when a user clicks "New Collection" (from the collection toolbar under "Featured collections" and above the listing of collections), the New Collection (also sometimes says Edit Collection, depending on the situation) modal appears. Regardless of login status, this modal tells the user their new collection will be temporary unless they log in (even if the user is already logged in).

the fix

The modal already had a userIsAnonymous variable but it wasn't getting set in this context (via the results toolbar in mb) so the change in UI never happened. (To be fair, this variable is getting set when you create a collection via ls collection toolbar). Instead of relying on passing down the variable from the ls or mb XML, I'm using the HT global variable that holds info about login status: HT.login_status.logged_in.

to test

On dev-3, click the "New Collection" button before logging in and see the usual "This collection will be temporary" message. Log in, then click the button again. The message should not appear and you should have the ability to make the collection public.

modal allows form submit without collection name (which leads to Application Error)

current behavior

If you create a new collection but don't give it a name in the form, you can still submit the form (via "Save Changes" button). After the form is submitted, the application can't redirect you to your collection or list of collections because you didn't supply any information, so you'll get an "Application Error" page instead.

the fix

I added form validation to the "Collection name" field in the New Collection form.

to test

On dev-3, click the "New Collection" button and without filling out any fields, click "Save Changes" to submit the form. You should now get two error messages: one under the Collection Name field and another in the footer of the modal letting you know that you need to fix something and try again.

@carylwyatt carylwyatt requested a review from moseshll March 27, 2025 19:22
Copy link

@moseshll moseshll left a comment

Choose a reason for hiding this comment

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

Both the logged-in behavior and modal validation fix worked for me.

I do not like the wording of the error message, however: "The form did not submit. Please add a collection name and resubmit the form." On the logic that "form" is a technical term, and that there is no button named "Submit", maybe something like "The collection could not be saved [or, created]. Please add a collection name [and try again]."

@carylwyatt
Copy link
Member Author

Thanks for your suggestion, @moseshll! I updated the error message with your text.

@carylwyatt carylwyatt requested a review from moseshll March 28, 2025 17:42
Copy link

@moseshll moseshll left a comment

Choose a reason for hiding this comment

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

All looks now to be in excellent shape. APPROVE

@carylwyatt carylwyatt merged commit 2d2ed35 into main Mar 31, 2025
6 checks passed
@carylwyatt carylwyatt deleted the DEV-1587 branch March 31, 2025 13:32
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.

2 participants