about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-04-25 12:37:40 -0500
committermultiple creatures <dev@multiple-creature.party>2019-05-21 03:16:22 -0500
commit9d4f42fb893c2129aa9f7aa9d012112af3646cae (patch)
treee64554e653d02195b5a220974ff3f635c7892cb4 /app
parentfb449f273a04545043a792b9fa63fdcc5b6b60b1 (diff)
Add option to hide public replies from profile
Diffstat (limited to 'app')
-rw-r--r--app/controllers/accounts_controller.rb2
-rw-r--r--app/controllers/settings/profiles_controller.rb2
-rw-r--r--app/models/account.rb1
-rw-r--r--app/models/status.rb3
-rw-r--r--app/views/accounts/show.html.haml3
-rw-r--r--app/views/settings/profiles/show.html.haml1
6 files changed, 8 insertions, 4 deletions
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index fcdebb47f..58e176364 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -66,7 +66,7 @@ class AccountsController < ApplicationController
     default_statuses.tap do |statuses|
       statuses.merge!(hashtag_scope)    if tag_requested?
       statuses.merge!(only_media_scope) if media_requested?
-      statuses.merge!(no_replies_scope) unless replies_requested?
+      statuses.merge!(no_replies_scope) unless @account.replies && replies_requested?
     end
   end
 
diff --git a/app/controllers/settings/profiles_controller.rb b/app/controllers/settings/profiles_controller.rb
index 423d0f13e..0ad5e6c3d 100644
--- a/app/controllers/settings/profiles_controller.rb
+++ b/app/controllers/settings/profiles_controller.rb
@@ -25,7 +25,7 @@ class Settings::ProfilesController < Settings::BaseController
   private
 
   def account_params
-    params.require(:account).permit(:display_name, :note, :avatar, :header, :locked, :hidden, :bot, :discoverable, fields_attributes: [:name, :value])
+    params.require(:account).permit(:display_name, :note, :avatar, :header, :replies, :locked, :hidden, :bot, :discoverable, fields_attributes: [:name, :value])
   end
 
   def set_account
diff --git a/app/models/account.rb b/app/models/account.rb
index deeea2f58..c07da2a14 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -48,6 +48,7 @@
 #  hidden                  :boolean
 #  hidden                  :boolean          default(FALSE), not null
 #  vars                    :jsonb            not null
+#  replies                 :boolean          default(TRUE), not null
 #
 
 class Account < ApplicationRecord
diff --git a/app/models/status.rb b/app/models/status.rb
index eff81cb4e..0baa5c98b 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -432,7 +432,8 @@ class Status < ApplicationRecord
       visibility = [:public, :unlisted]
 
       if account.nil?
-        where(visibility: visibility).not_local_only
+        query = where(visibility: visibility).not_local_only
+        target_account.replies ? query : query.without_replies
       elsif target_account.blocking?(account) # get rid of blocked peeps
         none
       elsif account.id == target_account.id # author can see own stuff
diff --git a/app/views/accounts/show.html.haml b/app/views/accounts/show.html.haml
index e4223119c..fc9eb04e6 100644
--- a/app/views/accounts/show.html.haml
+++ b/app/views/accounts/show.html.haml
@@ -30,7 +30,8 @@
 
       .account__section-headline
         = active_link_to t('accounts.posts_tab_heading'), short_account_url(@account)
-        = active_link_to t('accounts.posts_with_replies'), short_account_with_replies_url(@account)
+        - if @account.replies
+          = active_link_to t('accounts.posts_with_replies'), short_account_with_replies_url(@account)
         = active_link_to t('accounts.media'), short_account_media_url(@account)
 
       - if user_signed_in? && @account.blocking?(current_account)
diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml
index 2be623d09..6e5145078 100644
--- a/app/views/settings/profiles/show.html.haml
+++ b/app/views/settings/profiles/show.html.haml
@@ -23,6 +23,7 @@
   .fields-group
     = f.input :locked, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.locked')
     = f.input :hidden, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.hidden')
+    = f.input :replies, as: :boolean, wrapper: :with_label
 
   .fields-group
     = f.input :bot, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.bot')