about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-05-18 02:26:51 +0200
committerGitHub <noreply@github.com>2018-05-18 02:26:51 +0200
commit1e02dc871533de78174b48a6a527f11b0f2bc7ec (patch)
tree85342796b125279d75c6591ef8b9090a11b8b404 /app/models
parent919eef309820a421d6f5886b8ae811d3924cea97 (diff)
Add preference to hide following/followers lists (#7532)
* Add preference to hide following/followers lists

- Public pages
- ActivityPub collections (does not return pages but does give total)
- REST API (unless it's your own) (does not federate)

Fix #6901

* Add preference

* Add delegation

* Fix issue

* Fix issue
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account.rb1
-rw-r--r--app/models/user.rb6
2 files changed, 6 insertions, 1 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 2b3ef5cdc..72e850aa7 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -136,6 +136,7 @@ class Account < ApplicationRecord
            :moderator?,
            :staff?,
            :locale,
+           :hides_network?,
            to: :user,
            prefix: true,
            allow_nil: true
diff --git a/app/models/user.rb b/app/models/user.rb
index 21c217e77..cfbae58ed 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -86,7 +86,7 @@ class User < ApplicationRecord
   has_many :session_activations, dependent: :destroy
 
   delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :delete_modal,
-           :reduce_motion, :system_font_ui, :noindex, :theme, :display_sensitive_media,
+           :reduce_motion, :system_font_ui, :noindex, :theme, :display_sensitive_media, :hide_network,
            to: :settings, prefix: :setting, allow_nil: false
 
   attr_accessor :invite_code
@@ -219,6 +219,10 @@ class User < ApplicationRecord
     settings.notification_emails['digest']
   end
 
+  def hides_network?
+    @hides_network ||= settings.hide_network
+  end
+
   def token_for_app(a)
     return nil if a.nil? || a.owner != self
     Doorkeeper::AccessToken