Fix rubocop offenses.
This commit is contained in:
parent
e64efd6ea1
commit
ea121d3ba2
|
@ -42,7 +42,7 @@ after_initialize do
|
|||
|
||||
def self.remove_note(user, note_id)
|
||||
notes = notes_for(user.id)
|
||||
notes.reject! {|n| n[:id] == note_id}
|
||||
notes.reject! { |n| n[:id] == note_id }
|
||||
|
||||
if notes.size > 0
|
||||
::PluginStore.set("staff_notes", key_for(user.id), notes)
|
||||
|
@ -124,10 +124,10 @@ after_initialize do
|
|||
# Avoid n+1
|
||||
if obj.is_a?(Array)
|
||||
by_ids = {}
|
||||
User.where(id: obj.map {|o| o[:created_by] }).each do |u|
|
||||
User.where(id: obj.map { |o| o[:created_by] }).each do |u|
|
||||
by_ids[u.id] = u
|
||||
end
|
||||
obj.each {|o| o[:created_by] = by_ids[o[:created_by].to_i] }
|
||||
obj.each { |o| o[:created_by] = by_ids[o[:created_by].to_i] }
|
||||
else
|
||||
obj[:created_by] = User.where(id: obj[:created_by]).first
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ describe UserHistory do
|
|||
end
|
||||
|
||||
it "should create staff note for suspension" do
|
||||
UserHistory.create!({action: UserHistory.actions[:suspend_user], target_user_id: user.id, acting_user_id: admin.id})
|
||||
UserHistory.create!(action: UserHistory.actions[:suspend_user], target_user_id: user.id, acting_user_id: admin.id)
|
||||
|
||||
expect(PluginStore.get('staff_notes', "notes:#{user.id}")).to be_present
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ describe UserWarning do
|
|||
end
|
||||
|
||||
it "should create staff note for warning" do
|
||||
UserWarning.create({topic_id: topic.id, user_id: user.id, created_by_id: admin.id})
|
||||
UserWarning.create(topic_id: topic.id, user_id: user.id, created_by_id: admin.id)
|
||||
|
||||
expect(PluginStore.get('staff_notes', "notes:#{user.id}")).to be_present
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue