diff options
author | multiple creatures <dev@multiple-creature.party> | 2020-01-11 03:15:56 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2020-01-11 03:15:56 -0600 |
commit | 6ab6b6dd29c1f8fd9cd2d4371f664ed4432b1d19 (patch) | |
tree | a3d0f55f748f36d32acfee3ca1027e2fc950d4ff /app | |
parent | 2cf1a16ff73bb7401579ca6306e0a537ba2fe12e (diff) |
expose `local` visibility flag only when monsterfork api exposure is set to `full` (inital state serializer)
Diffstat (limited to 'app')
-rw-r--r-- | app/serializers/initial_state_serializer.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/serializers/initial_state_serializer.rb b/app/serializers/initial_state_serializer.rb index cb5b0017e..e22ebfd4d 100644 --- a/app/serializers/initial_state_serializer.rb +++ b/app/serializers/initial_state_serializer.rb @@ -61,8 +61,14 @@ class InitialStateSerializer < ActiveModel::Serializer if object.current_account store[:me] = object.current_account.id.to_s - store[:default_privacy] = object.current_account.user_default_visibility store[:default_sensitive] = object.current_account.user_defaults_to_sensitive? + + default_visibility = object.current_account.user_default_visibility + if monsterfork_api != :full && default_visibility == 'local' + default_visibility = 'unlisted' + end + + store[:default_privacy] = default_visibility end store[:text] = object.text if object.text @@ -86,4 +92,10 @@ class InitialStateSerializer < ActiveModel::Serializer def instance_presenter @instance_presenter ||= InstancePresenter.new end + + private + + def monsterfork_api + instance_options[:monsterfork_api] || object.current_account && object.current_account&.user&.monsterfork_api&.to_sym + end end |