Hide real count on api level
This commit is contained in:
parent
9818f6a0e1
commit
a4de9fcfdb
2 changed files with 17 additions and 4 deletions
|
@ -132,6 +132,7 @@ Metrics/ClassLength:
|
||||||
- 'app/models/user.rb'
|
- 'app/models/user.rb'
|
||||||
- 'app/serializers/activitypub/actor_serializer.rb'
|
- 'app/serializers/activitypub/actor_serializer.rb'
|
||||||
- 'app/serializers/activitypub/note_serializer.rb'
|
- 'app/serializers/activitypub/note_serializer.rb'
|
||||||
|
- 'app/serializers/rest/account_serializer.rb'
|
||||||
- 'app/serializers/rest/status_serializer.rb'
|
- 'app/serializers/rest/status_serializer.rb'
|
||||||
- 'app/services/account_search_service.rb'
|
- 'app/services/account_search_service.rb'
|
||||||
- 'app/services/activitypub/process_account_service.rb'
|
- 'app/services/activitypub/process_account_service.rb'
|
||||||
|
|
|
@ -123,10 +123,6 @@ class REST::AccountSerializer < ActiveModel::Serializer
|
||||||
object.suspended? ? [] : object.fields
|
object.suspended? ? [] : object.fields
|
||||||
end
|
end
|
||||||
|
|
||||||
def other_settings
|
|
||||||
object.suspended? || object.settings.nil? ? {} : object.settings
|
|
||||||
end
|
|
||||||
|
|
||||||
def suspended
|
def suspended
|
||||||
object.suspended?
|
object.suspended?
|
||||||
end
|
end
|
||||||
|
@ -160,4 +156,20 @@ class REST::AccountSerializer < ActiveModel::Serializer
|
||||||
def moved_and_not_nested?
|
def moved_and_not_nested?
|
||||||
object.moved?
|
object.moved?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def statuses_count
|
||||||
|
object.settings.present? && object.settings['hide_statuses_count'] ? 0 : object.statuses_count
|
||||||
|
end
|
||||||
|
|
||||||
|
def followers_count
|
||||||
|
object.settings.present? && object.settings['hide_followers_count'] ? 0 : object.followers_count
|
||||||
|
end
|
||||||
|
|
||||||
|
def following_count
|
||||||
|
object.settings.present? && object.settings['hide_followers_count'] ? 0 : object.following_count
|
||||||
|
end
|
||||||
|
|
||||||
|
def other_settings
|
||||||
|
object.suspended? || object.settings.nil? ? {} : object.settings
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue