From be77654f57830c652295acac3715ad5462716481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Fri, 22 Dec 2023 10:10:57 +0900 Subject: [PATCH] =?UTF-8?q?Change:=20#246=20=E5=85=AC=E9=96=8B=E7=AF=84?= =?UTF-8?q?=E5=9B=B2=E3=80=8C=E3=83=AD=E3=83=BC=E3=82=AB=E3=83=AB=E5=85=AC?= =?UTF-8?q?=E9=96=8B=E3=80=8D=E7=84=A1=E5=8A=B9=E3=81=A8=E5=90=8C=E6=99=82?= =?UTF-8?q?=E3=81=AB=E3=80=81=E6=A4=9C=E7=B4=A2=E8=A8=B1=E5=8F=AF=E3=80=8C?= =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=82=AB=E3=83=AB=E3=81=A8=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=AD=E3=83=AF=E3=83=BC=E3=80=8D=E3=82=82=E7=84=A1=E5=8A=B9?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B=20(#368)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/kmyblue_capabilities_helper.rb | 2 +- .../features/compose/components/searchability_dropdown.jsx | 5 +++++ app/javascript/mastodon/reducers/compose.js | 6 +++++- app/models/status.rb | 4 +++- app/services/post_status_service.rb | 2 +- app/views/admin/settings/discovery/show.html.haml | 2 +- config/locales/simple_form.en.yml | 2 +- config/locales/simple_form.ja.yml | 2 +- 8 files changed, 18 insertions(+), 7 deletions(-) diff --git a/app/helpers/kmyblue_capabilities_helper.rb b/app/helpers/kmyblue_capabilities_helper.rb index 7dca47025f..514b969f8e 100644 --- a/app/helpers/kmyblue_capabilities_helper.rb +++ b/app/helpers/kmyblue_capabilities_helper.rb @@ -17,7 +17,6 @@ module KmyblueCapabilitiesHelper kmyblue_bookmark_category kmyblue_quote kmyblue_searchability_limited - kmyblue_searchability_public_unlisted kmyblue_circle_history kmyblue_list_notification ) @@ -28,6 +27,7 @@ module KmyblueCapabilitiesHelper capabilities << :enable_wide_emoji_reaction end capabilities << :kmyblue_visibility_public_unlisted if Setting.enable_public_unlisted_visibility + capabilities << :kmyblue_searchability_public_unlisted if Setting.enable_public_unlisted_visibility capabilities << :timeline_no_local unless Setting.enable_local_timeline capabilities diff --git a/app/javascript/mastodon/features/compose/components/searchability_dropdown.jsx b/app/javascript/mastodon/features/compose/components/searchability_dropdown.jsx index cd9a418945..90e25aa055 100644 --- a/app/javascript/mastodon/features/compose/components/searchability_dropdown.jsx +++ b/app/javascript/mastodon/features/compose/components/searchability_dropdown.jsx @@ -15,6 +15,7 @@ import { supportsPassiveEvents } from 'detect-passive-events'; import Overlay from 'react-overlays/Overlay'; import { Icon } from 'mastodon/components/icon'; +import { enableLocalPrivacy } from 'mastodon/initial_state'; import { IconButton } from '../../../components/icon_button'; @@ -237,6 +238,10 @@ class SearchabilityDropdown extends PureComponent { { icon: 'lock', iconComponent: LockIcon, value: 'direct', text: formatMessage(messages.direct_short), meta: formatMessage(messages.direct_long) }, { icon: 'at', iconComponent: AlternateEmailIcon, value: 'limited', text: formatMessage(messages.limited_short), meta: formatMessage(messages.limited_long) }, ]; + + if (!enableLocalPrivacy) { + this.options = this.options.filter((opt) => opt.value !== 'public_unlisted'); + } } setTargetRef = c => { diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js index b4707e3321..ecfdd2c949 100644 --- a/app/javascript/mastodon/reducers/compose.js +++ b/app/javascript/mastodon/reducers/compose.js @@ -153,7 +153,11 @@ function clearAll(state) { map.set('limited_scope', null); map.set('id', null); map.set('in_reply_to', null); - map.set('searchability', state.get('default_searchability')); + if (state.get('default_searchability') === 'public_unlisted' && !enableLocalPrivacy) { + map.set('searchability', 'public'); + } else { + map.set('searchability', state.get('default_searchability')); + } map.set('sensitive', state.get('default_sensitive')); map.set('language', state.get('default_language')); map.update('media_attachments', list => list.clear()); diff --git a/app/models/status.rb b/app/models/status.rb index 389478db5d..b40c2b9f88 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -500,7 +500,9 @@ class Status < ApplicationRecord end def selectable_searchabilities - searchabilities.keys - %w(unsupported) + ss = searchabilities.keys - %w(unsupported) + ss -= %w(public_unlisted) unless Setting.enable_public_unlisted_visibility + ss end def selectable_searchabilities_for_search diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index efc7124105..d3100823c9 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -85,7 +85,7 @@ class PostStatusService < BaseService @scheduled_at = @options[:scheduled_at]&.to_datetime @scheduled_at = nil if scheduled_in_the_past? @reference_ids = (@options[:status_reference_ids] || []).map(&:to_i).filter(&:positive?) - raise ArgumentError if !Setting.enable_public_unlisted_visibility && @visibility == :public_unlisted + raise ArgumentError if !Setting.enable_public_unlisted_visibility && (@visibility == :public_unlisted || @searchability == :public_unlisted) if @in_reply_to.present? && ((@options[:visibility] == 'limited' && @options[:circle_id].nil?) || @limited_scope == :reply) @visibility = :limited diff --git a/app/views/admin/settings/discovery/show.html.haml b/app/views/admin/settings/discovery/show.html.haml index 59b3828068..08c34f190d 100644 --- a/app/views/admin/settings/discovery/show.html.haml +++ b/app/views/admin/settings/discovery/show.html.haml @@ -43,7 +43,7 @@ %h4= t('admin.settings.discovery.visibilities') .fields-group - = f.input :enable_public_unlisted_visibility, as: :boolean, wrapper: :with_label, kmyblue: true, hint: false + = f.input :enable_public_unlisted_visibility, as: :boolean, wrapper: :with_label, kmyblue: true .fields-group = f.input :enable_local_timeline, as: :boolean, wrapper: :with_label, kmyblue: true diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 34a4f5300f..f114b6fe40 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -345,7 +345,7 @@ en: custom_css: Custom CSS enable_emoji_reaction: Enable stamp function enable_local_timeline: Enable local timeline - enable_public_unlisted_visibility: Enable public-unlisted visibility + enable_public_unlisted_visibility: Enable public-unlisted visibility / public-unlisted searchability mascot: Custom mascot (legacy) media_cache_retention_period: Media cache retention period peers_api_enabled: Publish list of discovered servers in the API diff --git a/config/locales/simple_form.ja.yml b/config/locales/simple_form.ja.yml index 1d529caff5..e939f9fb0e 100644 --- a/config/locales/simple_form.ja.yml +++ b/config/locales/simple_form.ja.yml @@ -357,7 +357,7 @@ ja: custom_css: カスタムCSS enable_emoji_reaction: スタンプ機能を有効にする enable_local_timeline: ローカルタイムラインを有効にする - enable_public_unlisted_visibility: 公開範囲「ローカル公開」を有効にする + enable_public_unlisted_visibility: 公開範囲「ローカル公開」と検索許可「ローカルとフォロワー」を有効にする mascot: カスタムマスコット(レガシー) media_cache_retention_period: メディアキャッシュの保持期間 peers_api_enabled: 発見したサーバーのリストをAPIで公開する