Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/controllers/creatorships_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ def show
# Update the selected creatorships.
def update
@creatorships = @creatorships.where(id: params[:selected])

if params[:accept]
if @creatorships.blank?
flash[:caution] = t(".must_select_request")
elsif params[:accept]
accept_update
elsif params[:reject]
reject_update
Expand Down
3 changes: 3 additions & 0 deletions config/locales/controllers/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ en:
error: Sorry, that comment could not be unhidden.
permission_denied: Sorry, you don't have permission to unhide that comment.
success: Comment successfully unhidden!
creatorships:
update:
must_select_request: Please select at least one co-creator request first.
errors:
auth_error:
browser_title: Auth Error
Expand Down
8 changes: 8 additions & 0 deletions spec/controllers/creatorships_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,13 @@
expect(pending_work.pseuds.reload).not_to include(user.default_pseud)
end
end

context "without selecting any requests" do
it "displays a caution" do
fake_login_known_user(user)
put :update, params: { user_id: user.login }
it_redirects_to_with_caution(user_creatorships_path(user), "Please select at least one co-creator request first.")
end
end
end
end
Loading