From 0862a65d4ae4cef9eb6de1e629f8254775543ef7 Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 20 Aug 2014 23:44:19 +0530 Subject: [PATCH] renamed unused variables properly --- app/models/admin_dashboard_data.rb | 2 +- app/models/error_log.rb | 2 +- app/models/incoming_links_report.rb | 4 ++-- app/models/post.rb | 16 ++++++++-------- app/models/post_action.rb | 20 ++++++++++---------- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app/models/admin_dashboard_data.rb b/app/models/admin_dashboard_data.rb index e4434657457..c74fbe0d6e0 100644 --- a/app/models/admin_dashboard_data.rb +++ b/app/models/admin_dashboard_data.rb @@ -64,7 +64,7 @@ class AdminDashboardData AdminDashboardData.new.problems end - def as_json(options = nil) + def as_json(_options = nil) @json ||= { reports: REPORTS.map { |type| Report.find(type).as_json }, admins: User.admins.count, diff --git a/app/models/error_log.rb b/app/models/error_log.rb index 8448aeb9415..b1dd90eec49 100644 --- a/app/models/error_log.rb +++ b/app/models/error_log.rb @@ -10,7 +10,7 @@ class ErrorLog "#{Rails.root}/log/#{Rails.env}_errors.log" end - def self.clear!(guid) + def self.clear!(_guid) raise NotImplementedError end diff --git a/app/models/incoming_links_report.rb b/app/models/incoming_links_report.rb index 01ca1a9ce4f..6786eb015c7 100644 --- a/app/models/incoming_links_report.rb +++ b/app/models/incoming_links_report.rb @@ -8,7 +8,7 @@ class IncomingLinksReport @data = nil end - def as_json(options = nil) + def as_json(_options = nil) { type: self.type, title: I18n.t("reports.#{self.type}.title"), @@ -18,7 +18,7 @@ class IncomingLinksReport } end - def self.find(type, opts={}) + def self.find(type, _opts = {}) report_method = :"report_#{type}" return nil unless respond_to?(report_method) diff --git a/app/models/post.rb b/app/models/post.rb index 99e4ad47f8a..6749b85b08c 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -145,14 +145,14 @@ class Post < ActiveRecord::Base # Default is to cook posts cooked = if !self.user || SiteSetting.leader_links_no_follow || !self.user.has_trust_level?(:leader) - post_analyzer.cook(*args) - else - # At trust level 3, we don't apply nofollow to links - cloned = args.dup - cloned[1] ||= {} - cloned[1][:omit_nofollow] = true - post_analyzer.cook(*cloned) - end + post_analyzer.cook(*args) + else + # At trust level 3, we don't apply nofollow to links + cloned = args.dup + cloned[1] ||= {} + cloned[1][:omit_nofollow] = true + post_analyzer.cook(*cloned) + end Plugin::Filter.apply( :after_post_cook, self, cooked ) end diff --git a/app/models/post_action.rb b/app/models/post_action.rb index 8e4e4845255..9ff0f318124 100644 --- a/app/models/post_action.rb +++ b/app/models/post_action.rb @@ -188,25 +188,25 @@ class PostAction < ActiveRecord::Base else opts[:subtype] = TopicSubtype.notify_user opts[:target_usernames] = if post_action_type == :notify_user - post.user.username - elsif post_action_type != :notify_moderators - # this is a hack to allow a PM with no reciepients, we should think through - # a cleaner technique, a PM with myself is valid for flagging - 'x' - end + post.user.username + elsif post_action_type != :notify_moderators + # this is a hack to allow a PM with no recipients, we should think through + # a cleaner technique, a PM with myself is valid for flagging + 'x' + end end PostCreator.new(user, opts).create.id end - def self.act(user, post, post_action_type_id, opts={}) + def self.act(user, post, post_action_type_id, opts = {}) related_post_id = create_message_for_post_action(user, post, post_action_type_id, opts) staff_took_action = opts[:take_action] || false targets_topic = if opts[:flag_topic] && post.topic - post.topic.reload - post.topic.posts_count != 1 - end + post.topic.reload + post.topic.posts_count != 1 + end where_attrs = { post_id: post.id,