about summary refs log tree commit diff
diff options
context:
space:
mode:
-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
-rw-r--r--config/locales/simple_form.en.yml3
-rw-r--r--db/migrate/20190425165151_add_replies_to_accounts.rb5
-rw-r--r--db/schema.rb1
9 files changed, 16 insertions, 5 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')
diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml
index 7fd8bf269..9e8bb6a2b 100644
--- a/config/locales/simple_form.en.yml
+++ b/config/locales/simple_form.en.yml
@@ -69,7 +69,8 @@ en:
           suspend: Suspend and irreversibly delete account data
         warning_preset_id: Use a warning preset
       defaults:
-        hidden: Hide public profile
+        hidden: Hide your public profile
+        replies: Show your public replies
         autofollow: Invite to join your pack
         avatar: Avatar
         bot: This is a bot account
diff --git a/db/migrate/20190425165151_add_replies_to_accounts.rb b/db/migrate/20190425165151_add_replies_to_accounts.rb
new file mode 100644
index 000000000..ce7543d89
--- /dev/null
+++ b/db/migrate/20190425165151_add_replies_to_accounts.rb
@@ -0,0 +1,5 @@
+class AddRepliesToAccounts < ActiveRecord::Migration[5.2]
+  def change
+    safety_assured { add_column :accounts, :replies, :boolean, default: true, null: false }
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e90f90307..cd028b0b8 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -151,6 +151,7 @@ ActiveRecord::Schema.define(version: 2019_05_19_130537) do
     t.boolean "hidden"
     t.boolean "hidden", default: false, null: false
     t.jsonb "vars", default: {}, null: false
+    t.boolean "replies", default: true, null: false
     t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin
     t.index "lower((username)::text), lower((domain)::text)", name: "index_accounts_on_username_and_domain_lower", unique: true
     t.index ["moved_to_account_id"], name: "index_accounts_on_moved_to_account_id"