User: move "new account" age into constant

This commit is contained in:
joshua stein 2014-02-17 10:09:08 -06:00
parent 1d5b004a36
commit 9d16898477

View file

@ -45,6 +45,9 @@ class User < ActiveRecord::Base
BANNED_USERNAMES = [ "admin", "administrator", "hostmaster", "mailer-daemon",
"postmaster", "root", "security", "support", "webmaster", ]
# days old accounts are considered new for
NEW_USER_DAYS = 7
def self.recalculate_all_karmas!
User.all.each do |u|
u.karma = u.stories.map(&:score).sum + u.comments.map(&:score).sum
@ -161,7 +164,7 @@ class User < ActiveRecord::Base
end
def is_new?
Time.now - self.created_at <= 7.days
Time.now - self.created_at <= NEW_USER_DAYS.days
end
def linkified_about