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
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,

View File

@ -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

View File

@ -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)

View File

@ -154,14 +154,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

View File

@ -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,