-
Couldn't load subscription status.
- Fork 629
AO3-7159 Fix/Show caution when accepting/rejecting co-creator requests with no selection #5418
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this, I have a few suggestions!
| selected_ids = Array.wrap(params[:selected]).reject(&:blank?) | ||
| if selected_ids.blank? | ||
| flash[:caution] = t(".must_select_request") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be simpler and less fragile to potential changes to always call @creatorships.where(id: params[:selected]) and decide whether to show the message based on the return value of that, instead of this extra Array check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestions! They are helpful.
| end | ||
|
|
||
| context "without selecting any requests" do | ||
| it "displays an caution" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| it "displays an caution" do | |
| it "displays a caution" do |
| it "displays an caution" do | ||
| fake_login_known_user(user) | ||
| put :update, params: { user_id: user.login } | ||
| expect(flash[:caution]).to eq("Please select at least one co-creator request first.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use it_redirects_to_with_caution instead
cca743e to
5391e44
Compare
Issue
https://otwarchive.atlassian.net/browse/AO3-7159
Purpose
The purpose of this PR is to fix CreatorshipsController#update so that when users don’t select any Co-Creator Requests, a warning message is shown instead of an empty notice banner.
Credit
Yanpei Wang