Merge pull request #2669 from akshaymohite/optimization-fixes

removed useless access modifiers specified in models
This commit is contained in:
Sam 2014-08-19 21:10:40 +10:00
commit 7d068c1432
13 changed files with 61 additions and 87 deletions

View File

@ -194,12 +194,11 @@ class AdminDashboardData
I18n.t(i18n_key)
end
end
def self.report_access_password_removal
$redis.setex access_password_removal_key, 172_800, 'dashboard.access_password_removal'
end
private
def self.access_password_removal_key
'dash-data:access_password_removal'
end

View File

@ -35,7 +35,6 @@ class CategoryFeaturedTopic < ActiveRecord::Base
end
end
private
def self.fake_admin
# fake an admin
admin = User.new

View File

@ -60,8 +60,6 @@ class CategoryUser < ActiveRecord::Base
end
end
private
def self.apply_default_to_topic(topic, level, reason)
# Can not afford to slow down creation of topics when a pile of users are watching new topics, reverting to SQL for max perf here
sql = <<SQL

View File

@ -27,8 +27,6 @@ class Draft < ActiveRecord::Base
end
end
protected
def self.find_draft(user, key)
if user.is_a?(User)
find_by(user_id: user.id, draft_key: key)

View File

@ -85,8 +85,6 @@ class ErrorLog
end
end
private
def self.sanitize_backtrace(trace)
re = Regexp.new(/^#{Regexp.escape(Rails.root.to_s)}/)
trace.map { |line| Pathname.new(line.gsub(re, "[RAILS_ROOT]")).cleanpath.to_s }

View File

@ -80,8 +80,6 @@ class GlobalSetting
@data.keys
end
private
def self.parse(file)
provider = self.new(file)
provider.read

View File

@ -12,9 +12,6 @@ class LocaleSiteSetting < EnumSiteSetting
end
end
private
@lock = Mutex.new
def self.supported_locales

View File

@ -26,10 +26,6 @@ class PluginStore
PluginStoreRow.where(plugin_name: plugin_name, key: key).destroy_all
end
protected
def self.determine_type(value)
value.is_a?(Hash) || value.is_a?(Array) ? "JSON" : value.class.to_s
end

View File

@ -431,8 +431,6 @@ class PostAction < ActiveRecord::Base
PostActionType.types[post_action.post_action_type_id]
end
protected
def self.target_moderators
Group[:moderators].name
end

View File

@ -9,8 +9,6 @@ class S3RegionSiteSetting < EnumSiteSetting
@values ||= valid_values.sort.map {|x| {name: x, value: x} }
end
private
def self.valid_values
[ '',
'us-east-1',

View File

@ -28,7 +28,6 @@ class TopTopic < ActiveRecord::Base
TopTopic.refresh_older!
end
private
def self.periods
@@periods ||= [:yearly, :monthly, :weekly, :daily].freeze

View File

@ -10,8 +10,6 @@ class TrustLevelSetting < EnumSiteSetting
@values ||= valid_values.map {|x| {name: x.to_s, value: x} }
end
private
def self.valid_values
TrustLevel.levels.values.sort
end

View File

@ -271,8 +271,6 @@ SQL
self.synchronize_starred
end
protected
def self.update_like_count(user_id, action_type, delta)
if action_type == LIKE
UserStat.where(user_id: user_id).update_all("likes_given = likes_given + #{delta.to_i}")