DEV: Remove unused omit_stats variable from user serializer (#8513)

* DEV: Remove unused omit_stats variable from user serializer

This was hard-coded to true in a8b5192efd, and is no longer used anywhere

* Remove attribute declarations
This commit is contained in:
David Taylor 2019-12-12 02:27:23 +00:00 committed by Sam
parent 746ba0d8fd
commit 1e59371a4f
3 changed files with 1 additions and 26 deletions

View File

@ -60,8 +60,6 @@ class UsersController < ApplicationController
user_serializer = nil
if guardian.can_see_profile?(@user)
user_serializer = UserSerializer.new(@user, scope: guardian, root: 'user')
# TODO remove this options from serializer
user_serializer.omit_stats = true
topic_id = params[:include_post_count_for].to_i
if topic_id != 0

View File

@ -2,8 +2,7 @@
class UserSerializer < BasicUserSerializer
attr_accessor :omit_stats,
:topic_post_count
attr_accessor :topic_post_count
def self.staff_attributes(*attrs)
attributes(*attrs)
@ -48,7 +47,6 @@ class UserSerializer < BasicUserSerializer
:can_edit_username,
:can_edit_email,
:can_edit_name,
:stats,
:ignored,
:muted,
:can_ignore_user,
@ -109,7 +107,6 @@ class UserSerializer < BasicUserSerializer
:tracked_category_ids,
:watched_category_ids,
:watched_first_post_category_ids,
:private_messages_stats,
:system_avatar_upload_id,
:system_avatar_template,
:gravatar_avatar_upload_id,
@ -257,14 +254,6 @@ class UserSerializer < BasicUserSerializer
scope.can_edit_name?(object)
end
def include_stats?
!omit_stats == true
end
def stats
UserAction.stats(object.id, scope)
end
def ignored
IgnoredUser.where(user_id: scope.user&.id, ignored_user_id: object.id).exists?
end
@ -378,14 +367,6 @@ class UserSerializer < BasicUserSerializer
IgnoredUser.where(user_id: object.id).joins(:ignored_user).pluck(:username)
end
def include_private_messages_stats?
can_edit && !(omit_stats == true)
end
def private_messages_stats
UserAction.private_messages_stats(object.id, scope)
end
def system_avatar_upload_id
# should be left blank
end

View File

@ -3,10 +3,6 @@
class WebHookUserSerializer < UserSerializer
attributes :external_id
def omit_stats
true
end
# remove staff attributes
def staff_attributes(*attrs)
end