Change: #246 公開範囲「ローカル公開」無効と同時に、検索許可「ローカルとフォロワー」も無効にする (#368)

This commit is contained in:
KMY(雪あすか) 2023-12-22 10:10:57 +09:00 committed by GitHub
parent 789afccf9b
commit be77654f57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 7 deletions

View file

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

View file

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

View file

@ -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());

View file

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

View file

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

View file

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

View file

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

View file

@ -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で公開する