Add option to hide public replies from profile

staging
multiple creatures 2019-04-25 12:37:40 -05:00
parent fb449f273a
commit 9d4f42fb89
9 changed files with 16 additions and 5 deletions

View File

@ -66,7 +66,7 @@ class AccountsController < ApplicationController
default_statuses.tap do |statuses| default_statuses.tap do |statuses|
statuses.merge!(hashtag_scope) if tag_requested? statuses.merge!(hashtag_scope) if tag_requested?
statuses.merge!(only_media_scope) if media_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
end end

View File

@ -25,7 +25,7 @@ class Settings::ProfilesController < Settings::BaseController
private private
def account_params 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 end
def set_account def set_account

View File

@ -48,6 +48,7 @@
# hidden :boolean # hidden :boolean
# hidden :boolean default(FALSE), not null # hidden :boolean default(FALSE), not null
# vars :jsonb not null # vars :jsonb not null
# replies :boolean default(TRUE), not null
# #
class Account < ApplicationRecord class Account < ApplicationRecord

View File

@ -432,7 +432,8 @@ class Status < ApplicationRecord
visibility = [:public, :unlisted] visibility = [:public, :unlisted]
if account.nil? 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 elsif target_account.blocking?(account) # get rid of blocked peeps
none none
elsif account.id == target_account.id # author can see own stuff elsif account.id == target_account.id # author can see own stuff

View File

@ -30,7 +30,8 @@
.account__section-headline .account__section-headline
= active_link_to t('accounts.posts_tab_heading'), short_account_url(@account) = 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) = active_link_to t('accounts.media'), short_account_media_url(@account)
- if user_signed_in? && @account.blocking?(current_account) - if user_signed_in? && @account.blocking?(current_account)

View File

@ -23,6 +23,7 @@
.fields-group .fields-group
= f.input :locked, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.locked') = 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 :hidden, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.hidden')
= f.input :replies, as: :boolean, wrapper: :with_label
.fields-group .fields-group
= f.input :bot, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.bot') = f.input :bot, as: :boolean, wrapper: :with_label, hint: t('simple_form.hints.defaults.bot')

View File

@ -69,7 +69,8 @@ en:
suspend: Suspend and irreversibly delete account data suspend: Suspend and irreversibly delete account data
warning_preset_id: Use a warning preset warning_preset_id: Use a warning preset
defaults: defaults:
hidden: Hide public profile hidden: Hide your public profile
replies: Show your public replies
autofollow: Invite to join your pack autofollow: Invite to join your pack
avatar: Avatar avatar: Avatar
bot: This is a bot account bot: This is a bot account

View File

@ -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

View File

@ -151,6 +151,7 @@ ActiveRecord::Schema.define(version: 2019_05_19_130537) do
t.boolean "hidden" t.boolean "hidden"
t.boolean "hidden", default: false, null: false t.boolean "hidden", default: false, null: false
t.jsonb "vars", default: {}, 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 "(((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 "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" t.index ["moved_to_account_id"], name: "index_accounts_on_moved_to_account_id"