Skip to content

Commit a39d179

Browse files
committed
AO3-5512 Reviewdog
1 parent 886011d commit a39d179

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

app/controllers/tags_controller.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,7 @@ def update
249249

250250
# Limiting the conditions under which you can update the tag type
251251
types = logged_in_as_admin? ? Tag::TYPES : Tag::USER_DEFINED
252-
if @tag.can_change_type? && (types + %w(UnsortedTag)).include?(new_tag_type)
253-
@tag = @tag.recategorize(new_tag_type)
254-
end
252+
@tag = @tag.recategorize(new_tag_type) if @tag.can_change_type? && (types + %w[UnsortedTag]).include?(new_tag_type)
255253

256254
unless params[:tag].empty?
257255
@tag.attributes = tag_params

app/controllers/unsorted_tags_controller.rb

+2-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@ def mass_update
1919
tags = UnsortedTag.where(id: params[:tags].keys)
2020
tags.each do |tag|
2121
new_type = params[:tags][tag.id.to_s]
22-
if Tag::USER_DEFINED.include?(new_type)
23-
tag.update_attribute(:type, new_type)
24-
else
25-
raise ts("#{new_type} is not a valid tag type")
26-
end
22+
raise "#{new_type} is not a valid tag type" unless Tag::USER_DEFINED.include?(new_type)
23+
tag.update_attribute(:type, new_type)
2724
end
2825
flash[:notice] = ts("Tags were successfully sorted.")
2926
end

app/views/tags/edit.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<% types = logged_in_as_admin? ? Tag::TYPES : Tag::USER_DEFINED %>
5151
<% if @tag.can_change_type? %>
5252
<%= f.select :type,
53-
options_for_select(types + %w(UnsortedTag),
53+
options_for_select(types + %w[UnsortedTag],
5454
@tag.type.to_s) %>
5555
<% else %>
5656
<strong><%= ts("%{tag_type}", tag_type: tag_type_label_name(@tag.type.tableize)) %></strong>

0 commit comments

Comments
 (0)