diff options
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/rest/account_serializer.rb | 6 | ||||
-rw-r--r-- | app/serializers/rest/status_serializer.rb | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index 54308af1b..a8b905b16 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -87,4 +87,10 @@ class REST::AccountSerializer < ActiveModel::Serializer return if name.blank? object.user.vars["_they:are:#{name}"] end + + private + + def monsterfork_api + instance_options[:monsterfork_api] || !current_user.nil? && current_user.monsterfork_api.to_sym + end end diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index 88581471b..8e322b5ec 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -72,7 +72,7 @@ class REST::StatusSerializer < ActiveModel::Serializer def visibility if object.limited_visibility? 'private' - elsif current_user? && current_user.monsterfork_api != 'full' && object.local_visibility? + elsif monsterfork_api == :full && object.local_visibility? 'unlisted' else object.visibility @@ -191,4 +191,10 @@ class REST::StatusSerializer < ActiveModel::Serializer tag_url(object) end end + + private + + def monsterfork_api + instance_options[:monsterfork_api] || current_user? && current_user.monsterfork_api.to_sym + end end |