Skip to content
Open
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
6 changes: 4 additions & 2 deletions app/controllers/tag_wranglers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def report_csv

def create
authorize :wrangling if logged_in_as_admin?

saved_any_assignment = false
unless params[:tag_fandom_string].blank?
names = params[:tag_fandom_string].gsub(/$/, ',').split(',').map(&:strip)
fandoms = Fandom.where('name IN (?)', names)
Expand All @@ -77,6 +77,7 @@ def create
end
assignment = current_user.wrangling_assignments.build(fandom_id: fandom.id)
assignment.save!
saved_any_assignment = true
end
flash[:error] = t(".noncanonical_fandoms_tried_assignment", count: noncanonical_fandoms.length, fandom_list: helpers.to_sentence(noncanonical_fandoms.map(&:name))) unless noncanonical_fandoms.empty?
end
Expand All @@ -90,12 +91,13 @@ def create
unless user.nil? || user.fandoms.include?(fandom)
assignment = user.wrangling_assignments.build(fandom_id: fandom.id)
assignment.save!
saved_any_assignment = true
end
end
end
end
flash[:notice] = "Wranglers were successfully assigned!"
end
flash[:notice] = "Wranglers were successfully assigned!" if saved_any_assignment
redirect_to tag_wranglers_path(media_id: params[:media_id], fandom_string: params[:fandom_string], wrangler_id: params[:wrangler_id])
end

Expand Down
10 changes: 10 additions & 0 deletions features/tags_and_wrangling/tag_wrangling_more.feature
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ Feature: Tag wrangling: assigning wranglers, using the filters on the Wranglers
And "Testing" should not be assigned to the wrangler "tangler"
When I edit the tag "Testing"
Then I should see "Sign Up"

Scenario: Wrangler can't self-assign a non-canonical fandom
Given I am logged in as a tag wrangler
And a canonical fandom "Canon"
And a non-canonical fandom "Uncanon"
When I am on the wranglers page
And I fill in "Enter as many fandoms as you like." with "Uncanon"
And I press "Assign"
Then I should see "Could not assign fandom Uncanon. Non-canonical fandoms cannot be assigned."
And I should not see "Wranglers were successfully assigned!"

Scenario: Updating multiple tags works.
Given a canonical fandom "Cowboy Bebop"
Expand Down
Loading