2013-02-05 13:16:51 -06:00
|
|
|
class UserSerializer < BasicUserSerializer
|
2013-02-07 09:45:24 -06:00
|
|
|
|
2015-03-24 11:33:17 -05:00
|
|
|
attr_accessor :omit_stats,
|
|
|
|
:topic_post_count
|
2015-02-23 20:31:23 -06:00
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
def self.staff_attributes(*attrs)
|
|
|
|
attributes(*attrs)
|
|
|
|
attrs.each do |attr|
|
|
|
|
define_method "include_#{attr}?" do
|
|
|
|
scope.is_staff?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.private_attributes(*attrs)
|
|
|
|
attributes(*attrs)
|
|
|
|
attrs.each do |attr|
|
|
|
|
define_method "include_#{attr}?" do
|
|
|
|
can_edit
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-11-26 12:20:03 -06:00
|
|
|
# attributes that are hidden for TL0 users when seen by anonymous
|
|
|
|
def self.untrusted_attributes(*attrs)
|
|
|
|
attrs.each do |attr|
|
|
|
|
method_name = "include_#{attr}?"
|
|
|
|
define_method(method_name) do
|
2014-11-27 12:51:13 -06:00
|
|
|
return false if scope.restrict_user_fields?(object)
|
2014-11-26 12:20:03 -06:00
|
|
|
send(attr).present?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-02-07 09:45:24 -06:00
|
|
|
attributes :name,
|
|
|
|
:email,
|
|
|
|
:last_posted_at,
|
|
|
|
:last_seen_at,
|
2013-02-05 13:16:51 -06:00
|
|
|
:bio_raw,
|
2013-02-07 09:45:24 -06:00
|
|
|
:bio_cooked,
|
|
|
|
:created_at,
|
|
|
|
:website,
|
2015-08-10 03:07:53 -05:00
|
|
|
:website_name,
|
2014-02-28 14:12:51 -06:00
|
|
|
:profile_background,
|
2014-10-20 11:11:36 -05:00
|
|
|
:card_background,
|
2014-05-27 12:54:04 -05:00
|
|
|
:location,
|
2013-02-07 09:45:24 -06:00
|
|
|
:can_edit,
|
2013-08-12 13:54:52 -05:00
|
|
|
:can_edit_username,
|
2013-09-07 21:42:41 -05:00
|
|
|
:can_edit_email,
|
2014-03-13 15:26:40 -05:00
|
|
|
:can_edit_name,
|
2013-02-07 09:45:24 -06:00
|
|
|
:stats,
|
2014-11-29 20:09:34 -06:00
|
|
|
:can_send_private_messages,
|
2013-02-05 13:16:51 -06:00
|
|
|
:can_send_private_message_to_user,
|
|
|
|
:bio_excerpt,
|
2013-05-02 02:40:44 -05:00
|
|
|
:trust_level,
|
|
|
|
:moderator,
|
2013-06-25 17:39:20 -05:00
|
|
|
:admin,
|
2013-11-07 15:34:18 -06:00
|
|
|
:title,
|
|
|
|
:suspend_reason,
|
2014-03-28 03:49:30 -05:00
|
|
|
:suspended_till,
|
2014-06-01 21:59:54 -05:00
|
|
|
:uploaded_avatar_id,
|
2014-07-09 00:31:49 -05:00
|
|
|
:badge_count,
|
2014-07-27 12:12:36 -05:00
|
|
|
:has_title_badges,
|
2014-09-26 13:48:34 -05:00
|
|
|
:custom_fields,
|
2015-03-24 11:33:17 -05:00
|
|
|
:user_fields,
|
2015-04-21 13:36:46 -05:00
|
|
|
:topic_post_count,
|
2015-09-14 02:51:17 -05:00
|
|
|
:pending_count,
|
2016-09-15 15:15:08 -05:00
|
|
|
:profile_view_count,
|
2017-11-08 14:25:56 -06:00
|
|
|
:time_read,
|
2017-11-14 15:39:07 -06:00
|
|
|
:recent_time_read,
|
2016-09-15 15:15:08 -05:00
|
|
|
:primary_group_name,
|
|
|
|
:primary_group_flair_url,
|
|
|
|
:primary_group_flair_bg_color,
|
2017-11-23 15:38:11 -06:00
|
|
|
:primary_group_flair_color,
|
2017-12-21 19:18:12 -06:00
|
|
|
:staged,
|
2018-06-28 03:12:32 -05:00
|
|
|
:second_factor_enabled,
|
2018-07-04 03:45:42 -05:00
|
|
|
:second_factor_backup_enabled,
|
2018-07-23 10:51:57 -05:00
|
|
|
:second_factor_remaining_backup_codes,
|
|
|
|
:associated_accounts
|
2013-02-05 13:16:51 -06:00
|
|
|
|
2013-05-21 11:03:51 -05:00
|
|
|
has_one :invited_by, embed: :object, serializer: BasicUserSerializer
|
2015-12-17 01:06:04 -06:00
|
|
|
has_many :groups, embed: :object, serializer: BasicGroupSerializer
|
2016-11-25 01:26:49 -06:00
|
|
|
has_many :group_users, embed: :object, serializer: BasicGroupUserSerializer
|
2014-03-28 03:49:30 -05:00
|
|
|
has_many :featured_user_badges, embed: :ids, serializer: UserBadgeSerializer, root: :user_badges
|
2016-02-16 22:46:19 -06:00
|
|
|
has_one :user_option, embed: :object, serializer: UserOptionSerializer
|
|
|
|
|
|
|
|
def include_user_option?
|
|
|
|
can_edit
|
|
|
|
end
|
2013-02-05 13:16:51 -06:00
|
|
|
|
2014-12-02 11:52:56 -06:00
|
|
|
staff_attributes :post_count,
|
2014-11-14 14:23:09 -06:00
|
|
|
:can_be_deleted,
|
|
|
|
:can_delete_all_posts
|
2013-06-04 11:05:36 -05:00
|
|
|
|
2014-09-29 15:31:05 -05:00
|
|
|
private_attributes :locale,
|
2014-01-02 00:58:49 -06:00
|
|
|
:muted_category_ids,
|
2016-07-07 21:58:18 -05:00
|
|
|
:watched_tags,
|
2016-07-22 15:16:45 -05:00
|
|
|
:watching_first_post_tags,
|
2016-07-07 21:58:18 -05:00
|
|
|
:tracked_tags,
|
|
|
|
:muted_tags,
|
2014-01-05 18:57:17 -06:00
|
|
|
:tracked_category_ids,
|
2014-05-02 15:36:52 -05:00
|
|
|
:watched_category_ids,
|
2016-07-07 23:08:10 -05:00
|
|
|
:watched_first_post_category_ids,
|
2014-05-26 15:39:03 -05:00
|
|
|
:private_messages_stats,
|
2015-09-11 05:56:34 -05:00
|
|
|
:system_avatar_upload_id,
|
|
|
|
:system_avatar_template,
|
2014-05-22 02:37:02 -05:00
|
|
|
:gravatar_avatar_upload_id,
|
2015-09-11 05:56:34 -05:00
|
|
|
:gravatar_avatar_template,
|
2014-06-11 00:50:37 -05:00
|
|
|
:custom_avatar_upload_id,
|
2015-09-11 05:56:34 -05:00
|
|
|
:custom_avatar_template,
|
2014-10-20 12:15:58 -05:00
|
|
|
:has_title_badges,
|
2016-03-29 02:50:17 -05:00
|
|
|
:muted_usernames,
|
2016-08-01 00:29:28 -05:00
|
|
|
:mailing_list_posts_per_day,
|
2016-08-16 02:06:33 -05:00
|
|
|
:can_change_bio,
|
|
|
|
:user_api_keys
|
2013-05-20 15:52:37 -05:00
|
|
|
|
2014-11-26 12:20:03 -06:00
|
|
|
untrusted_attributes :bio_raw,
|
|
|
|
:bio_cooked,
|
|
|
|
:bio_excerpt,
|
|
|
|
:location,
|
|
|
|
:website,
|
2017-06-04 07:58:36 -05:00
|
|
|
:website_name,
|
2014-11-26 12:20:03 -06:00
|
|
|
:profile_background,
|
|
|
|
:card_background
|
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
###
|
|
|
|
### ATTRIBUTES
|
|
|
|
###
|
|
|
|
|
2016-03-29 02:50:17 -05:00
|
|
|
def mailing_list_posts_per_day
|
|
|
|
val = Post.estimate_posts_per_day
|
2017-07-27 20:20:09 -05:00
|
|
|
[val, SiteSetting.max_emails_per_day_per_user].min
|
2016-03-29 02:50:17 -05:00
|
|
|
end
|
|
|
|
|
2015-12-17 01:06:04 -06:00
|
|
|
def groups
|
2017-07-03 14:26:46 -05:00
|
|
|
object.groups.order(:id)
|
2017-07-27 20:20:09 -05:00
|
|
|
.visible_groups(scope.user)
|
2015-12-17 01:06:04 -06:00
|
|
|
end
|
|
|
|
|
2016-11-25 01:26:49 -06:00
|
|
|
def group_users
|
|
|
|
object.group_users.order(:group_id)
|
|
|
|
end
|
|
|
|
|
2014-09-29 15:31:05 -05:00
|
|
|
def include_email?
|
2017-11-24 15:11:34 -06:00
|
|
|
(object.id && object.id == scope.user.try(:id)) ||
|
|
|
|
(scope.is_staff? && object.staged?)
|
2014-09-29 15:31:05 -05:00
|
|
|
end
|
|
|
|
|
2018-07-23 10:51:57 -05:00
|
|
|
def include_associated_accounts?
|
|
|
|
(object.id && object.id == scope.user.try(:id))
|
|
|
|
end
|
|
|
|
|
2017-12-21 19:18:12 -06:00
|
|
|
def include_second_factor_enabled?
|
2018-02-20 00:44:51 -06:00
|
|
|
(object&.id == scope.user&.id) || scope.is_staff?
|
2017-12-21 19:18:12 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
def second_factor_enabled
|
2018-02-20 00:44:51 -06:00
|
|
|
object.totp_enabled?
|
2017-12-21 19:18:12 -06:00
|
|
|
end
|
|
|
|
|
2018-06-28 03:12:32 -05:00
|
|
|
def include_second_factor_backup_enabled?
|
|
|
|
object&.id == scope.user&.id
|
|
|
|
end
|
|
|
|
|
|
|
|
def second_factor_backup_enabled
|
|
|
|
object.backup_codes_enabled?
|
|
|
|
end
|
|
|
|
|
2018-07-04 03:45:42 -05:00
|
|
|
def include_second_factor_remaining_backup_codes?
|
|
|
|
(object&.id == scope.user&.id) && object.backup_codes_enabled?
|
|
|
|
end
|
|
|
|
|
|
|
|
def second_factor_remaining_backup_codes
|
|
|
|
object.remaining_backup_codes
|
|
|
|
end
|
|
|
|
|
2016-08-01 00:29:28 -05:00
|
|
|
def can_change_bio
|
|
|
|
!(SiteSetting.enable_sso && SiteSetting.sso_overrides_bio)
|
|
|
|
end
|
|
|
|
|
2016-08-16 02:06:33 -05:00
|
|
|
def user_api_keys
|
|
|
|
keys = object.user_api_keys.where(revoked_at: nil).map do |k|
|
|
|
|
{
|
|
|
|
id: k.id,
|
|
|
|
application_name: k.application_name,
|
2017-07-27 20:20:09 -05:00
|
|
|
scopes: k.scopes.map { |s| I18n.t("user_api_key.scopes.#{s}") },
|
2016-08-16 02:06:33 -05:00
|
|
|
created_at: k.created_at
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
keys.length > 0 ? keys : nil
|
|
|
|
end
|
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
def bio_raw
|
|
|
|
object.user_profile.bio_raw
|
2014-05-22 02:37:02 -05:00
|
|
|
end
|
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
def bio_cooked
|
|
|
|
object.user_profile.bio_processed
|
2013-02-05 13:16:51 -06:00
|
|
|
end
|
2013-02-25 10:42:20 -06:00
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
def website
|
|
|
|
object.user_profile.website
|
2013-02-14 00:32:58 -06:00
|
|
|
end
|
2013-02-05 13:16:51 -06:00
|
|
|
|
2015-08-10 03:07:53 -05:00
|
|
|
def website_name
|
2018-03-28 03:20:08 -05:00
|
|
|
uri = begin
|
|
|
|
URI(website.to_s)
|
2018-08-14 05:23:32 -05:00
|
|
|
rescue URI::Error
|
2018-03-28 03:20:08 -05:00
|
|
|
end
|
|
|
|
|
2016-04-09 06:52:55 -05:00
|
|
|
return if uri.nil? || uri.host.nil?
|
2017-07-27 20:20:09 -05:00
|
|
|
uri.host.sub(/^www\./, '') + uri.path
|
2015-08-10 03:07:53 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def include_website_name
|
|
|
|
website.present?
|
|
|
|
end
|
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
def profile_background
|
|
|
|
object.user_profile.profile_background
|
|
|
|
end
|
|
|
|
|
2014-10-20 11:11:36 -05:00
|
|
|
def card_background
|
|
|
|
object.user_profile.card_background
|
2014-10-16 14:05:36 -05:00
|
|
|
end
|
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
def location
|
|
|
|
object.user_profile.location
|
|
|
|
end
|
|
|
|
|
2013-02-05 13:16:51 -06:00
|
|
|
def can_edit
|
|
|
|
scope.can_edit?(object)
|
|
|
|
end
|
|
|
|
|
2013-08-12 13:54:52 -05:00
|
|
|
def can_edit_username
|
|
|
|
scope.can_edit_username?(object)
|
|
|
|
end
|
|
|
|
|
2013-09-07 21:42:41 -05:00
|
|
|
def can_edit_email
|
|
|
|
scope.can_edit_email?(object)
|
|
|
|
end
|
|
|
|
|
2014-03-13 15:26:40 -05:00
|
|
|
def can_edit_name
|
|
|
|
scope.can_edit_name?(object)
|
|
|
|
end
|
|
|
|
|
2015-02-23 20:31:23 -06:00
|
|
|
def include_stats?
|
|
|
|
!omit_stats == true
|
|
|
|
end
|
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
def stats
|
|
|
|
UserAction.stats(object.id, scope)
|
2014-05-27 12:54:04 -05:00
|
|
|
end
|
|
|
|
|
2014-11-29 20:09:34 -06:00
|
|
|
# Needed because 'send_private_message_to_user' will always return false
|
|
|
|
# when the current user is being serialized
|
|
|
|
def can_send_private_messages
|
|
|
|
scope.can_send_private_message?(Discourse.system_user)
|
|
|
|
end
|
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
def can_send_private_message_to_user
|
2017-06-29 03:49:24 -05:00
|
|
|
scope.can_send_private_message?(object) && scope.current_user != object
|
2014-06-06 23:54:32 -05:00
|
|
|
end
|
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
def bio_excerpt
|
2017-07-27 20:20:09 -05:00
|
|
|
object.user_profile.bio_excerpt(350 , keep_newlines: true, keep_emoji_images: true)
|
2014-06-10 00:19:08 -05:00
|
|
|
end
|
2014-06-30 15:46:47 -05:00
|
|
|
|
|
|
|
def include_suspend_reason?
|
2017-09-12 15:06:01 -05:00
|
|
|
scope.can_see_suspension_reason?(object) && object.suspended?
|
2014-06-10 00:19:08 -05:00
|
|
|
end
|
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
def include_suspended_till?
|
|
|
|
object.suspended?
|
2014-06-10 00:19:08 -05:00
|
|
|
end
|
|
|
|
|
2016-09-15 15:15:08 -05:00
|
|
|
def primary_group_name
|
|
|
|
object.primary_group.try(:name)
|
|
|
|
end
|
|
|
|
|
|
|
|
def primary_group_flair_url
|
|
|
|
object.try(:primary_group).try(:flair_url)
|
|
|
|
end
|
|
|
|
|
|
|
|
def primary_group_flair_bg_color
|
|
|
|
object.try(:primary_group).try(:flair_bg_color)
|
|
|
|
end
|
|
|
|
|
|
|
|
def primary_group_flair_color
|
|
|
|
object.try(:primary_group).try(:flair_color)
|
|
|
|
end
|
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
###
|
|
|
|
### STAFF ATTRIBUTES
|
|
|
|
###
|
|
|
|
|
2014-12-02 11:52:56 -06:00
|
|
|
def post_count
|
|
|
|
object.user_stat.try(:post_count)
|
|
|
|
end
|
|
|
|
|
2014-11-14 14:23:09 -06:00
|
|
|
def can_be_deleted
|
|
|
|
scope.can_delete_user?(object)
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_delete_all_posts
|
|
|
|
scope.can_delete_all_posts?(object)
|
|
|
|
end
|
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
###
|
|
|
|
### PRIVATE ATTRIBUTES
|
|
|
|
###
|
2016-07-07 21:58:18 -05:00
|
|
|
def muted_tags
|
|
|
|
TagUser.lookup(object, :muted).joins(:tag).pluck('tags.name')
|
|
|
|
end
|
|
|
|
|
|
|
|
def tracked_tags
|
|
|
|
TagUser.lookup(object, :tracking).joins(:tag).pluck('tags.name')
|
|
|
|
end
|
|
|
|
|
2016-07-22 15:16:45 -05:00
|
|
|
def watching_first_post_tags
|
|
|
|
TagUser.lookup(object, :watching_first_post).joins(:tag).pluck('tags.name')
|
|
|
|
end
|
|
|
|
|
2016-07-07 21:58:18 -05:00
|
|
|
def watched_tags
|
|
|
|
TagUser.lookup(object, :watching).joins(:tag).pluck('tags.name')
|
|
|
|
end
|
2014-06-30 15:46:47 -05:00
|
|
|
|
2014-01-02 00:58:49 -06:00
|
|
|
def muted_category_ids
|
|
|
|
CategoryUser.lookup(object, :muted).pluck(:category_id)
|
|
|
|
end
|
|
|
|
|
2014-01-05 18:57:17 -06:00
|
|
|
def tracked_category_ids
|
|
|
|
CategoryUser.lookup(object, :tracking).pluck(:category_id)
|
|
|
|
end
|
|
|
|
|
2014-01-02 00:58:49 -06:00
|
|
|
def watched_category_ids
|
|
|
|
CategoryUser.lookup(object, :watching).pluck(:category_id)
|
|
|
|
end
|
2014-03-28 03:49:30 -05:00
|
|
|
|
2016-07-07 23:08:10 -05:00
|
|
|
def watched_first_post_category_ids
|
|
|
|
CategoryUser.lookup(object, :watching_first_post).pluck(:category_id)
|
|
|
|
end
|
|
|
|
|
2015-03-23 19:55:22 -05:00
|
|
|
def muted_usernames
|
|
|
|
MutedUser.where(user_id: object.id).joins(:muted_user).pluck(:username)
|
|
|
|
end
|
|
|
|
|
2015-09-10 02:18:43 -05:00
|
|
|
def include_private_messages_stats?
|
2015-02-23 20:39:31 -06:00
|
|
|
can_edit && !(omit_stats == true)
|
|
|
|
end
|
|
|
|
|
2014-05-02 15:36:52 -05:00
|
|
|
def private_messages_stats
|
|
|
|
UserAction.private_messages_stats(object.id, scope)
|
|
|
|
end
|
2014-06-30 15:46:47 -05:00
|
|
|
|
2015-09-11 05:56:34 -05:00
|
|
|
def system_avatar_upload_id
|
|
|
|
# should be left blank
|
|
|
|
end
|
|
|
|
|
|
|
|
def system_avatar_template
|
|
|
|
User.system_avatar_template(object.username)
|
|
|
|
end
|
|
|
|
|
2018-05-20 22:25:01 -05:00
|
|
|
def include_gravatar_avatar_upload_id?
|
|
|
|
object.user_avatar&.gravatar_upload_id
|
|
|
|
end
|
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
def gravatar_avatar_upload_id
|
2018-05-20 22:25:01 -05:00
|
|
|
object.user_avatar.gravatar_upload_id
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_gravatar_avatar_template?
|
|
|
|
include_gravatar_avatar_upload_id?
|
2014-06-30 15:46:47 -05:00
|
|
|
end
|
|
|
|
|
2015-09-11 05:56:34 -05:00
|
|
|
def gravatar_avatar_template
|
2018-05-20 22:25:01 -05:00
|
|
|
User.avatar_template(object.username, object.user_avatar.gravatar_upload_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_custom_avatar_upload_id?
|
|
|
|
object.user_avatar&.custom_upload_id
|
2015-09-11 05:56:34 -05:00
|
|
|
end
|
|
|
|
|
2014-06-30 15:46:47 -05:00
|
|
|
def custom_avatar_upload_id
|
2018-05-20 22:25:01 -05:00
|
|
|
object.user_avatar.custom_upload_id
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_custom_avatar_template?
|
|
|
|
include_custom_avatar_upload_id?
|
2014-06-30 15:46:47 -05:00
|
|
|
end
|
|
|
|
|
2015-09-11 05:56:34 -05:00
|
|
|
def custom_avatar_template
|
2018-05-20 22:25:01 -05:00
|
|
|
User.avatar_template(object.username, object.user_avatar.custom_upload_id)
|
2015-09-11 05:56:34 -05:00
|
|
|
end
|
|
|
|
|
2014-07-09 00:31:49 -05:00
|
|
|
def has_title_badges
|
2017-08-23 17:54:51 -05:00
|
|
|
object.badges.where(allow_title: true).exists?
|
2014-07-09 00:31:49 -05:00
|
|
|
end
|
|
|
|
|
2014-09-26 13:48:34 -05:00
|
|
|
def user_fields
|
|
|
|
object.user_fields
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_user_fields?
|
|
|
|
user_fields.present?
|
|
|
|
end
|
|
|
|
|
2015-03-24 11:33:17 -05:00
|
|
|
def include_topic_post_count?
|
|
|
|
topic_post_count.present?
|
|
|
|
end
|
|
|
|
|
2014-08-19 10:05:35 -05:00
|
|
|
def custom_fields
|
2016-03-11 14:52:18 -06:00
|
|
|
fields = User.whitelisted_user_custom_fields(scope)
|
2014-08-19 10:05:35 -05:00
|
|
|
|
2015-12-05 00:50:03 -06:00
|
|
|
if scope.can_edit?(object)
|
2016-03-11 14:52:18 -06:00
|
|
|
fields += DiscoursePluginRegistry.serialized_current_user_fields.to_a
|
2014-08-19 10:05:35 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
if fields.present?
|
2017-11-14 18:55:37 -06:00
|
|
|
User.custom_fields_for_ids([object.id], fields)[object.id] || {}
|
2014-08-19 10:05:35 -05:00
|
|
|
else
|
|
|
|
{}
|
|
|
|
end
|
|
|
|
end
|
2015-04-21 13:36:46 -05:00
|
|
|
|
|
|
|
def pending_count
|
|
|
|
0
|
|
|
|
end
|
2015-09-10 19:12:40 -05:00
|
|
|
|
2015-09-14 02:51:17 -05:00
|
|
|
def profile_view_count
|
|
|
|
object.user_profile.views
|
|
|
|
end
|
|
|
|
|
2017-11-08 14:25:56 -06:00
|
|
|
def time_read
|
2017-11-14 15:39:07 -06:00
|
|
|
object.user_stat&.time_read
|
|
|
|
end
|
|
|
|
|
|
|
|
def recent_time_read
|
|
|
|
time = object.recent_time_read
|
2017-11-08 14:25:56 -06:00
|
|
|
end
|
|
|
|
|
2017-11-23 15:38:11 -06:00
|
|
|
def include_staged?
|
|
|
|
scope.is_staff?
|
|
|
|
end
|
|
|
|
|
2013-02-05 13:16:51 -06:00
|
|
|
end
|