Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change: ユーザー設定の複数の項目を反転 #639

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/filters_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def set_filter
end

def resource_params
params.require(:custom_filter).permit(:title, :expires_in, :filter_action, :exclude_follows, :exclude_localusers, :with_quote, context: [], keywords_attributes: [:id, :keyword, :whole_word, :_destroy])
params.require(:custom_filter).permit(:title, :expires_in, :filter_action, :exclude_follows, :exclude_localusers, :exclude_quote, context: [], keywords_attributes: [:id, :keyword, :whole_word, :_destroy])
end

def set_body_classes
Expand Down
8 changes: 8 additions & 0 deletions app/models/custom_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ def irreversible?
hide_action?
end

def exclude_quote=(value)
self.with_quote = !ActiveModel::Type::Boolean.new.cast(value)
end

def exclude_quote
!with_quote
end

def self.cached_filters_for(account_id)
active_filters = Rails.cache.fetch("filters:v3:#{account_id}") do
filters_hash = {}
Expand Down
8 changes: 8 additions & 0 deletions app/models/user_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class KeyError < Error; end
setting :reject_send_limited_to_suspects, default: false

setting_inverse_alias :indexable, :noindex
setting_inverse_alias :show_statuses_count, :hide_statuses_count
setting_inverse_alias :show_following_count, :hide_following_count
setting_inverse_alias :show_followers_count, :hide_followers_count

namespace :web do
setting :advanced_layout, default: false
Expand Down Expand Up @@ -73,6 +76,11 @@ class KeyError < Error; end
setting :hide_emoji_reaction_unavailable_server, default: false
setting :hide_favourite_menu, default: false
setting :hide_emoji_reaction_count, default: false

setting_inverse_alias :'web.show_blocking_quote', :'web.hide_blocking_quote'
setting_inverse_alias :'web.show_emoji_reaction_count', :'web.hide_emoji_reaction_count'
setting_inverse_alias :'web.show_favourite_menu', :'web.hide_favourite_menu'
setting_inverse_alias :'web.show_recent_emojis', :'web.hide_recent_emojis'
end

namespace :notification_emails do
Expand Down
4 changes: 4 additions & 0 deletions app/models/user_settings/namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ def setting(key, options = {})
@definitions[s.key] = s
end
end

def setting_inverse_alias(key, original_key)
@definitions[key] = @definitions[original_key].inverse_of(key)
end
end
2 changes: 1 addition & 1 deletion app/views/filters/_filter_fields.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
= f.input :exclude_localusers, wrapper: :with_label, kmyblue: true, label: t('simple_form.labels.filters.options.exclude_localusers')

.fields-group
= f.input :with_quote, wrapper: :with_label, kmyblue: true, label: t('simple_form.labels.filters.options.with_quote')
= f.input :exclude_quote, wrapper: :with_label, as: :boolean, kmyblue: true, label: t('simple_form.labels.filters.options.exclude_quote')

%hr.spacer/

Expand Down
8 changes: 4 additions & 4 deletions app/views/settings/preferences/appearance/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,25 @@
%h4= t 'appearance.custom_emoji_and_emoji_reactions'

.fields-group
= ff.input :'web.hide_recent_emojis', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_recent_emojis'), hint: false
= ff.input :'web.hide_recent_emojis', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_recent_emojis'), hint: false
- if Setting.enable_emoji_reaction
= ff.input :'web.enable_emoji_reaction', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_enable_emoji_reaction'), hint: I18n.t('simple_form.hints.defaults.setting_enable_emoji_reaction')
= ff.input :'web.show_emoji_reaction_on_timeline', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_emoji_reaction_on_timeline')
= ff.input :'web.hide_emoji_reaction_unavailable_server', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_emoji_reaction_unavailable_server')
= ff.input :'web.hide_emoji_reaction_count', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_emoji_reaction_count')
= ff.input :'web.show_emoji_reaction_count', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_emoji_reaction_count')

%h4= t 'appearance.saved_posts'

.fields-group
= ff.input :'web.bookmark_category_needed', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_bookmark_category_needed'), hint: I18n.t('simple_form.hints.defaults.setting_bookmark_category_needed')
= ff.input :'web.hide_favourite_menu', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_favourite_menu')
= ff.input :'web.show_favourite_menu', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_favourite_menu')

%h4= t 'appearance.quotes'

.fields-group
= ff.input :'web.show_quote_in_home', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_quote_in_home'), hint: false
= ff.input :'web.show_quote_in_public', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_quote_in_public'), hint: false
= ff.input :'web.hide_blocking_quote', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_blocking_quote'), hint: false
= ff.input :'web.show_blocking_quote', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_blocking_quote'), hint: false

%h4= t 'appearance.timelines'

Expand Down
6 changes: 3 additions & 3 deletions app/views/settings/privacy/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@

= f.simple_fields_for :settings, current_user.settings do |ff|
.fields-group
= ff.input :hide_statuses_count, as: :boolean, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_statuses_count'), hint: false
= ff.input :hide_following_count, as: :boolean, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_following_count'), hint: false
= ff.input :hide_followers_count, as: :boolean, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_followers_count'), hint: false
= ff.input :show_statuses_count, as: :boolean, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_statuses_count'), hint: false
= ff.input :show_following_count, as: :boolean, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_following_count'), hint: false
= ff.input :show_followers_count, as: :boolean, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_followers_count'), hint: false

.fields-group
= ff.input :show_application, wrapper: :with_label
Expand Down
16 changes: 8 additions & 8 deletions config/locales/simple_form.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,8 @@ en:
mutuals_only: Mutuals only
outside_only: Followings or followers only
setting_expand_spoilers: Always expand posts marked with content warnings
setting_hide_blocking_quote: Hide posts which have a quote written by the user you are blocking
setting_hide_emoji_reaction_count: Hide emoji reaction count
setting_hide_emoji_reaction_unavailable_server: Hide emoji reaction button from unavailable server
setting_hide_favourite_menu: Hide favourite menu
setting_hide_followers_count: Hide followers count
setting_hide_following_count: Hide following count
setting_hide_network: Hide your social graph
setting_hide_recent_emojis: Hide recent emojis
setting_hide_statuses_count: Hide statuses count
setting_lock_follow_from_bot: Request approval about bot follow
setting_public_post_to_unlisted: Convert public post to public unlisted if not using Web app
setting_reduce_motion: Reduce motion in animations
Expand All @@ -285,9 +278,16 @@ en:
setting_reject_unlisted_subscription: Reject sending unlisted visibility/non-public searchability posts to Misskey, Calckey
setting_reverse_search_quote: Perform word-by-word search when search keywords are not enclosed in double quotes
setting_show_application: Disclose application used to send posts
setting_show_blocking_quote: Show posts which have a quote written by the user you are blocking
setting_show_emoji_reaction_count: Show emoji reaction number
setting_show_emoji_reaction_on_timeline: Show all emoji reactions on timeline
setting_show_favourite_menu: Show favourite menu
setting_show_followers_count: Show followers count
setting_show_following_count: Show following count
setting_show_quote_in_home: Show quotes in home, list or antenna timelines
setting_show_quote_in_public: Show quotes in public timelines
setting_show_recent_emojis: Show recent emojis
setting_show_statuses_count: Show statuses count
setting_simple_timeline_menu: Reduce post menu on timeline
setting_single_ref_to_quote: Deliver single reference to other server as quote
setting_slip_local_emoji_reaction: Allow bypassing emoji reaction from local users
Expand Down Expand Up @@ -334,7 +334,7 @@ en:
options:
exclude_follows: Exclude following users
exclude_localusers: Exclude local users
with_quote: Also check quote or references
exclude_quote: Exclude quote or references
form_admin_settings:
activity_api_enabled: Publish aggregate statistics about user activity in the API
backups_retention_period: User archive retention period
Expand Down
16 changes: 8 additions & 8 deletions config/locales/simple_form.ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,18 +278,18 @@ ja:
setting_emoji_reaction_streaming_notify_impl2: Nyastodon, Catstodon, glitch-soc互換の絵文字リアクション機能を有効にする
setting_enable_emoji_reaction: 絵文字リアクション機能を使用する
setting_expand_spoilers: 閲覧注意としてマークされた投稿を常に展開する
setting_hide_blocking_quote: ブロックしたユーザーの投稿を引用した投稿を隠す
setting_hide_emoji_reaction_count: 投稿につけられた各絵文字の数を隠す
setting_hide_emoji_reaction_unavailable_server: 絵文字リアクションに対応していないと思われるサーバーの投稿から絵文字リアクション機能を隠す
setting_hide_favourite_menu: 右サイドメニューから「お気に入り」を隠す
setting_hide_followers_count: フォロワー数を隠す
setting_hide_following_count: フォロー数を隠す
setting_hide_network: 繋がりを隠す
setting_hide_recent_emojis: 絵文字ピッカーで最近使用した絵文字を隠す(絵文字デッキのみを表示する)
setting_hide_statuses_count: 投稿数を隠す
setting_lock_follow_from_bot: botからのフォローを承認制にする
setting_show_blocking_quote: ブロックしたユーザーの投稿を引用した投稿を表示する
setting_show_emoji_reaction_count: 投稿につけられた各絵文字の数を表示する
setting_show_favourite_menu: 右サイドメニューに「お気に入り」を表示する
setting_show_followers_count: フォロワー数を公開する
setting_show_following_count: フォロー数を公開する
setting_show_quote_in_home: ホーム・リスト・アンテナなどで引用を表示する
setting_show_quote_in_public: 公開タイムライン(ローカル・連合)で引用を表示する
setting_show_recent_emojis: 絵文字ピッカーで絵文字デッキと一緒に、絵文字の使用履歴も表示する
setting_show_statuses_count: 投稿数を公開する
setting_stay_privacy: 投稿時に公開範囲を保存する
setting_public_post_to_unlisted: サードパーティから公開範囲「公開」で投稿した場合、「ローカル公開」に変更する
setting_reduce_motion: アニメーションの動きを減らす
Expand Down Expand Up @@ -345,7 +345,7 @@ ja:
options:
exclude_follows: フォロー中のユーザーをフィルターの対象にしない
exclude_localusers: ローカルユーザーをフィルターの対象にしない
with_quote: 引用・参照の内容をフィルターの対象に含める
exclude_quote: 引用・参照の内容をフィルターの対象にしない
form_admin_settings:
activity_api_enabled: APIでユーザーアクティビティに関する集計統計を公開する
backups_retention_period: ユーザーアーカイブの保持期間
Expand Down
Loading