From ea121d3ba2b71d8714e49f3a4d91ac2781c06661 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 2 Aug 2017 15:13:45 +0900 Subject: [PATCH] Fix rubocop offenses. --- plugin.rb | 6 +++--- spec/user_history_spec.rb | 2 +- spec/user_warning_spec.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin.rb b/plugin.rb index a013382..f633caa 100644 --- a/plugin.rb +++ b/plugin.rb @@ -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 diff --git a/spec/user_history_spec.rb b/spec/user_history_spec.rb index 76e134b..0d0fcab 100644 --- a/spec/user_history_spec.rb +++ b/spec/user_history_spec.rb @@ -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 diff --git a/spec/user_warning_spec.rb b/spec/user_warning_spec.rb index a3149a8..5e51045 100644 --- a/spec/user_warning_spec.rb +++ b/spec/user_warning_spec.rb @@ -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