about summary refs log tree commit diff
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-02-21 07:30:29 -0600
committermultiple creatures <dev@multiple-creature.party>2020-02-21 07:30:29 -0600
commit4cb1d42ba2ffbd31c5e865e55c408363ca35f47a (patch)
treed9df63f1c569f371c48388871af31828fd520cac
parent67b3bb604598640539461264966d9cc2c7c46cc9 (diff)
fix invisible mode being unfederatable, mask actor props & outbox instead of actor itself
-rw-r--r--app/controllers/concerns/account_controller_concern.rb2
-rw-r--r--app/serializers/activitypub/actor_serializer.rb20
-rw-r--r--config/locales/simple_form.en.yml3
3 files changed, 13 insertions, 12 deletions
diff --git a/app/controllers/concerns/account_controller_concern.rb b/app/controllers/concerns/account_controller_concern.rb
index 4fd9af688..a195c27de 100644
--- a/app/controllers/concerns/account_controller_concern.rb
+++ b/app/controllers/concerns/account_controller_concern.rb
@@ -10,7 +10,7 @@ module AccountControllerConcern
   included do
     layout 'public'
 
-    before_action :check_account_hidden
+    before_action :check_account_hidden, if: -> { request.format.nil? || request.format == :html }
     before_action :set_instance_presenter
     before_action :set_link_headers, if: -> { request.format.nil? || request.format == :html }
   end
diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb
index 81a41b917..2a61d8026 100644
--- a/app/serializers/activitypub/actor_serializer.rb
+++ b/app/serializers/activitypub/actor_serializer.rb
@@ -94,19 +94,19 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
   end
 
   def name
-    object.display_name
+    object.hidden? ? '' : object.display_name
   end
 
   def summary
-    Formatter.instance.simplified_format(object)
+    object.hidden? ? '' : Formatter.instance.simplified_format(object)
   end
 
   def icon
-    object.avatar
+    object.hidden? ? nil : object.avatar
   end
 
   def image
-    object.header
+    object.hidden? ? nil : object.header
   end
 
   def public_key
@@ -118,11 +118,11 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
   end
 
   def avatar_exists?
-    object.avatar?
+    object.hidden? ? false : object.avatar?
   end
 
   def header_exists?
-    object.header?
+    object.hidden? ? false : object.header?
   end
 
   def manually_approves_followers
@@ -134,15 +134,15 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
   end
 
   def virtual_tags
-    object.emojis + object.tags
+    object.hidden? ? nil : (object.emojis + object.tags)
   end
 
   def virtual_attachments
-    object.fields
+    object.hidden? ? nil : object.fields
   end
 
   def moved_to
-    ActivityPub::TagManager.instance.uri_for(object.moved_to_account)
+    object.hidden? ? nil : ActivityPub::TagManager.instance.uri_for(object.moved_to_account)
   end
 
   def also_known_as?
@@ -182,7 +182,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
     end
 
     def value
-      Formatter.instance.format_field(object.account, object.value)
+      object.account.hidden? ? '' : Formatter.instance.format_field(object.account, object.value)
     end
   end
 end
diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml
index 962a823c3..6e2d956d6 100644
--- a/config/locales/simple_form.en.yml
+++ b/config/locales/simple_form.en.yml
@@ -53,6 +53,7 @@ en:
         setting_roar_lifespan_old: "<strong>This is a destructive operation!</strong><br>Back up your account before saving changes!<br>Will deselect after save"
         setting_roar_defederate_old: "<strong>This is an irreversible operation!</strong><br>Will deselect after save"
         allow_unknown_follows: If disabled, packmate requests from accounts you've never interacted with before will be automatically rejected
+        hidden: Hides your profile and masks the fields of your ActivityPub actor.  Limits federation.
         whole_word: When the keyword or phrase is alphanumeric only, it will only be applied if it matches the whole word
       domain_allow:
         domain: This domain will be able to fetch data from this server and incoming data from it will be processed and stored
@@ -88,7 +89,7 @@ en:
         warning_preset_id: Use a warning preset
       defaults:
         defanged: Defanged mode
-        hidden: Invisible mode (affects outgoing federation and discovery!)
+        hidden: Invisible mode
         adult_content: Contains adult content
         gently: Gently the kobolds
         kobold: I am a kobold