1
0
Fork 0
forked from fedi/mastodon

Change “privacy and reach” settings so that unchecking boxes always increase privacy and checking them always increase reach (#26508)

This commit is contained in:
Claire 2023-08-17 09:13:26 +02:00 committed by GitHub
parent 0446394465
commit cc4560d95b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 7 deletions

View file

@ -18,7 +18,7 @@ class Settings::PrivacyController < Settings::BaseController
private private
def account_params def account_params
params.require(:account).permit(:discoverable, :locked, :hide_collections, settings: UserSettings.keys) params.require(:account).permit(:discoverable, :unlocked, :show_collections, settings: UserSettings.keys)
end end
def set_account def set_account

View file

@ -442,8 +442,21 @@ class Account < ApplicationRecord
EntityCache.instance.mention(username, domain) EntityCache.instance.mention(username, domain)
end end
end end
def inverse_alias(key, original_key)
define_method("#{key}=") do |value|
public_send("#{original_key}=", !ActiveModel::Type::Boolean.new.cast(value))
end
define_method(key) do
!public_send(original_key)
end
end
end end
inverse_alias :show_collections, :hide_collections
inverse_alias :unlocked, :locked
def emojis def emojis
@emojis ||= CustomEmoji.from_text(emojifiable_text, domain) @emojis ||= CustomEmoji.from_text(emojifiable_text, domain)
end end

View file

@ -18,7 +18,7 @@
= f.input :discoverable, as: :boolean, wrapper: :with_label, recommended: true = f.input :discoverable, as: :boolean, wrapper: :with_label, recommended: true
.fields-group .fields-group
= f.input :locked, as: :boolean, wrapper: :with_label = f.input :unlocked, as: :boolean, wrapper: :with_label
%h4= t('privacy.search') %h4= t('privacy.search')
@ -33,7 +33,7 @@
%p.lead= t('privacy.privacy_hint_html') %p.lead= t('privacy.privacy_hint_html')
.fields-group .fields-group
= f.input :hide_collections, as: :boolean, wrapper: :with_label = f.input :show_collections, as: :boolean, wrapper: :with_label
= f.simple_fields_for :settings, current_user.settings do |ff| = f.simple_fields_for :settings, current_user.settings do |ff|
.fields-group .fields-group

View file

@ -6,9 +6,9 @@ en:
discoverable: Your public posts and profile may be featured or recommended in various areas of Mastodon and your profile may be suggested to other users. discoverable: Your public posts and profile may be featured or recommended in various areas of Mastodon and your profile may be suggested to other users.
display_name: Your full name or your fun name. display_name: Your full name or your fun name.
fields: Your homepage, pronouns, age, anything you want. fields: Your homepage, pronouns, age, anything you want.
hide_collections: People will not be able to browse through your follows and followers. People that you follow will see that you follow them regardless.
locked: People will request to follow you and you will be able to either accept or reject new followers.
note: 'You can @mention other people or #hashtags.' note: 'You can @mention other people or #hashtags.'
show_collections: People will be able to browse through your follows and followers. People that you follow will see that you follow them regardless.
unlocked: People will be able to follow you without requesting approval. Uncheck if you want to review follow requests and chose whether to accept or reject new followers.
account_alias: account_alias:
acct: Specify the username@domain of the account you want to move from acct: Specify the username@domain of the account you want to move from
account_migration: account_migration:
@ -143,8 +143,8 @@ en:
fields: fields:
name: Label name: Label
value: Content value: Content
hide_collections: Hide follows and followers from profile show_collections: Show follows and followers on profile
locked: Manually review new followers unlocked: Automatically accept new followers
account_alias: account_alias:
acct: Handle of the old account acct: Handle of the old account
account_migration: account_migration: