Fix Style/CombinableLoops cop (#27429)
This commit is contained in:
@@ -34,7 +34,7 @@ class Form::CustomEmojiBatch
|
||||
end
|
||||
|
||||
def update!
|
||||
custom_emojis.each { |custom_emoji| authorize(custom_emoji, :update?) }
|
||||
verify_authorization(:update?)
|
||||
|
||||
category = if category_id.present?
|
||||
CustomEmojiCategory.find(category_id)
|
||||
@@ -49,7 +49,7 @@ class Form::CustomEmojiBatch
|
||||
end
|
||||
|
||||
def list!
|
||||
custom_emojis.each { |custom_emoji| authorize(custom_emoji, :update?) }
|
||||
verify_authorization(:update?)
|
||||
|
||||
custom_emojis.each do |custom_emoji|
|
||||
custom_emoji.update(visible_in_picker: true)
|
||||
@@ -58,7 +58,7 @@ class Form::CustomEmojiBatch
|
||||
end
|
||||
|
||||
def unlist!
|
||||
custom_emojis.each { |custom_emoji| authorize(custom_emoji, :update?) }
|
||||
verify_authorization(:update?)
|
||||
|
||||
custom_emojis.each do |custom_emoji|
|
||||
custom_emoji.update(visible_in_picker: false)
|
||||
@@ -67,7 +67,7 @@ class Form::CustomEmojiBatch
|
||||
end
|
||||
|
||||
def enable!
|
||||
custom_emojis.each { |custom_emoji| authorize(custom_emoji, :enable?) }
|
||||
verify_authorization(:enable?)
|
||||
|
||||
custom_emojis.each do |custom_emoji|
|
||||
custom_emoji.update(disabled: false)
|
||||
@@ -76,7 +76,7 @@ class Form::CustomEmojiBatch
|
||||
end
|
||||
|
||||
def disable!
|
||||
custom_emojis.each { |custom_emoji| authorize(custom_emoji, :disable?) }
|
||||
verify_authorization(:disable?)
|
||||
|
||||
custom_emojis.each do |custom_emoji|
|
||||
custom_emoji.update(disabled: true)
|
||||
@@ -85,7 +85,7 @@ class Form::CustomEmojiBatch
|
||||
end
|
||||
|
||||
def copy!
|
||||
custom_emojis.each { |custom_emoji| authorize(custom_emoji, :copy?) }
|
||||
verify_authorization(:copy?)
|
||||
|
||||
custom_emojis.each do |custom_emoji|
|
||||
copied_custom_emoji = custom_emoji.copy!
|
||||
@@ -94,11 +94,15 @@ class Form::CustomEmojiBatch
|
||||
end
|
||||
|
||||
def delete!
|
||||
custom_emojis.each { |custom_emoji| authorize(custom_emoji, :destroy?) }
|
||||
verify_authorization(:destroy?)
|
||||
|
||||
custom_emojis.each do |custom_emoji|
|
||||
custom_emoji.destroy
|
||||
log_action :destroy, custom_emoji
|
||||
end
|
||||
end
|
||||
|
||||
def verify_authorization(permission)
|
||||
custom_emojis.each { |custom_emoji| authorize(custom_emoji, permission) }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user