2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

large refactor, ship a few columns from the user table into user_stats

This commit is contained in:
Sam 2013-10-04 13:28:49 +10:00
parent 4613006ae3
commit 5bf26ec34e
29 changed files with 354 additions and 251 deletions

View file

@ -5,7 +5,6 @@ class AdminUserSerializer < BasicUserSerializer
:admin,
:moderator,
:last_seen_age,
:days_visited,
:last_emailed_age,
:created_at_age,
:username_lower,
@ -14,9 +13,6 @@ class AdminUserSerializer < BasicUserSerializer
:username,
:title,
:avatar_template,
:topics_entered,
:posts_read_count,
:time_read,
:can_approve,
:approved,
:banned_at,
@ -26,7 +22,15 @@ class AdminUserSerializer < BasicUserSerializer
:can_send_activation_email,
:can_activate,
:can_deactivate,
:blocked
:blocked,
:time_read
[:days_visited,:posts_read_count,:topics_entered].each do |sym|
attributes sym
define_method sym do
object.user_stat.send(sym)
end
end
def is_banned
object.is_banned?
@ -47,8 +51,8 @@ class AdminUserSerializer < BasicUserSerializer
end
def time_read
return nil if object.time_read.blank?
AgeWords.age_words(object.time_read)
return nil if object.user_stat.time_read.blank?
AgeWords.age_words(object.user_stat.time_read)
end
def created_at_age