Merge pull request #2674 from akshaymohite/optimization-fixes

renamed unused variables properly
This commit is contained in:
Sam 2014-09-02 08:22:43 +10:00
commit 22fbae8556
5 changed files with 22 additions and 22 deletions

View File

@ -64,7 +64,7 @@ class AdminDashboardData
AdminDashboardData.new.problems AdminDashboardData.new.problems
end end
def as_json(options = nil) def as_json(_options = nil)
@json ||= { @json ||= {
reports: REPORTS.map { |type| Report.find(type).as_json }, reports: REPORTS.map { |type| Report.find(type).as_json },
admins: User.admins.count, admins: User.admins.count,

View File

@ -10,7 +10,7 @@ class ErrorLog
"#{Rails.root}/log/#{Rails.env}_errors.log" "#{Rails.root}/log/#{Rails.env}_errors.log"
end end
def self.clear!(guid) def self.clear!(_guid)
raise NotImplementedError raise NotImplementedError
end end

View File

@ -8,7 +8,7 @@ class IncomingLinksReport
@data = nil @data = nil
end end
def as_json(options = nil) def as_json(_options = nil)
{ {
type: self.type, type: self.type,
title: I18n.t("reports.#{self.type}.title"), title: I18n.t("reports.#{self.type}.title"),
@ -18,7 +18,7 @@ class IncomingLinksReport
} }
end end
def self.find(type, opts={}) def self.find(type, _opts = {})
report_method = :"report_#{type}" report_method = :"report_#{type}"
return nil unless respond_to?(report_method) return nil unless respond_to?(report_method)

View File

@ -154,14 +154,14 @@ class Post < ActiveRecord::Base
# Default is to cook posts # Default is to cook posts
cooked = if !self.user || SiteSetting.leader_links_no_follow || !self.user.has_trust_level?(:leader) cooked = if !self.user || SiteSetting.leader_links_no_follow || !self.user.has_trust_level?(:leader)
post_analyzer.cook(*args) post_analyzer.cook(*args)
else else
# At trust level 3, we don't apply nofollow to links # At trust level 3, we don't apply nofollow to links
cloned = args.dup cloned = args.dup
cloned[1] ||= {} cloned[1] ||= {}
cloned[1][:omit_nofollow] = true cloned[1][:omit_nofollow] = true
post_analyzer.cook(*cloned) post_analyzer.cook(*cloned)
end end
Plugin::Filter.apply( :after_post_cook, self, cooked ) Plugin::Filter.apply( :after_post_cook, self, cooked )
end end

View File

@ -188,25 +188,25 @@ class PostAction < ActiveRecord::Base
else else
opts[:subtype] = TopicSubtype.notify_user opts[:subtype] = TopicSubtype.notify_user
opts[:target_usernames] = if post_action_type == :notify_user opts[:target_usernames] = if post_action_type == :notify_user
post.user.username post.user.username
elsif post_action_type != :notify_moderators elsif post_action_type != :notify_moderators
# this is a hack to allow a PM with no reciepients, we should think through # 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 # a cleaner technique, a PM with myself is valid for flagging
'x' 'x'
end end
end end
PostCreator.new(user, opts).create.id PostCreator.new(user, opts).create.id
end 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) related_post_id = create_message_for_post_action(user, post, post_action_type_id, opts)
staff_took_action = opts[:take_action] || false staff_took_action = opts[:take_action] || false
targets_topic = if opts[:flag_topic] && post.topic targets_topic = if opts[:flag_topic] && post.topic
post.topic.reload post.topic.reload
post.topic.posts_count != 1 post.topic.posts_count != 1
end end
where_attrs = { where_attrs = {
post_id: post.id, post_id: post.id,