diff --git a/app/javascript/mastodon/features/compose/containers/warning_container.jsx b/app/javascript/mastodon/features/compose/containers/warning_container.jsx index 3348e91b1f..6e107091cd 100644 --- a/app/javascript/mastodon/features/compose/containers/warning_container.jsx +++ b/app/javascript/mastodon/features/compose/containers/warning_container.jsx @@ -14,9 +14,10 @@ const mapStateToProps = state => ({ hashtagWarning: ['public', 'public_unlisted', 'login'].indexOf(state.getIn(['compose', 'privacy'])) < 0 && state.getIn(['compose', 'searchability']) !== 'public' && HASHTAG_PATTERN_REGEX.test(state.getIn(['compose', 'text'])), directMessageWarning: state.getIn(['compose', 'privacy']) === 'direct', searchabilityWarning: state.getIn(['compose', 'searchability']) === 'limited', + limitedPostWarning: state.getIn(['compose', 'privacy']) === 'mutual', }); -const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning, searchabilityWarning }) => { +const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning, searchabilityWarning, limitedPostWarning }) => { if (needsLockWarning) { return }} />} />; } @@ -39,6 +40,10 @@ const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning return } />; } + if (limitedPostWarning) { + return } />; + } + return null; }; @@ -47,6 +52,7 @@ WarningWrapper.propTypes = { hashtagWarning: PropTypes.bool, directMessageWarning: PropTypes.bool, searchabilityWarning: PropTypes.bool, + limitedPostWarning: PropTypes.bool, }; export default connect(mapStateToProps)(WarningWrapper); diff --git a/app/javascript/mastodon/locales/ja.json b/app/javascript/mastodon/locales/ja.json index 09bfe4c9f5..7cf5db7e67 100644 --- a/app/javascript/mastodon/locales/ja.json +++ b/app/javascript/mastodon/locales/ja.json @@ -146,6 +146,7 @@ "compose_form.direct_message_warning_learn_more": "もっと詳しく", "compose_form.encryption_warning": "Mastodonの投稿はエンドツーエンド暗号化に対応していません。安全に送受信されるべき情報をMastodonで共有しないでください。", "compose_form.hashtag_warning": "この投稿は公開設定ではないのでハッシュタグの一覧に表示されません。公開投稿だけがハッシュタグで検索できます。", + "compose_form.limited_post_warning": "限定投稿は現状、ごく一部のMastodonサーバーにしか届きませんがいずれ改善されるでしょう(2023年8月時点でFedibirdとkmyblueのみです)", "compose_form.lock_disclaimer": "あなたのアカウントは{locked}になっていません。誰でもあなたをフォローすることができ、フォロワー限定の投稿を見ることができます。", "compose_form.lock_disclaimer.lock": "承認制", "compose_form.markdown.marked": "Markdown有効", diff --git a/app/lib/activitypub/activity.rb b/app/lib/activitypub/activity.rb index 55123f68a3..45ce7252f4 100644 --- a/app/lib/activitypub/activity.rb +++ b/app/lib/activitypub/activity.rb @@ -119,10 +119,7 @@ class ActivityPub::Activity dereferencer = ActivityPub::Dereferencer.new(@object, permitted_origin: @account.uri, signature_actor: signed_fetch_actor) - return if dereferencer.object.nil? - - @object = dereferencer.object - @json = @object + @object = dereferencer.object unless dereferencer.object.nil? end def signed_fetch_actor diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index 833597d240..20496eb8c9 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -118,7 +118,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity end def process_status_params - @status_parser = ActivityPub::Parser::StatusParser.new(@json, followers_collection: @account.followers_url) + @status_parser = ActivityPub::Parser::StatusParser.new(@json['signature'].present? ? @object : @json, followers_collection: @account.followers_url) @params = { uri: @status_parser.uri, diff --git a/app/services/search_service.rb b/app/services/search_service.rb index 590a4e1106..0458ddbea6 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -3,7 +3,6 @@ class SearchService < BaseService def call(query, account, limit, options = {}) @query = query&.strip - pull_query_commands @account = account @options = options @@ -28,9 +27,6 @@ class SearchService < BaseService private - MIN_SCORE = 0.7 - MIN_SCORE_RE = /MINSCORE=(((\d+\.\d+)|(\d+)){1,6})/ - def perform_accounts_search! AccountSearchService.new.call( @query, @@ -45,22 +41,22 @@ class SearchService < BaseService end def perform_statuses_search! - privacy_definition = parsed_query.apply(StatusesIndex.filter(terms: { searchability: %w(public private direct) }).filter(term: { searchable_by: @account.id }).track_scores(true).min_score(@min_score)) + privacy_definition = parsed_query.apply(StatusesIndex.filter(terms: { searchability: %w(public private direct) }).filter(term: { searchable_by: @account.id })) # 'direct' searchability posts are NOT in here because it's already added at previous line. case @searchability when 'public' - privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'public' }).track_scores(true).min_score(@min_score)) - privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'private' }).filter(terms: { account_id: following_account_ids }).track_scores(true).min_score(@min_score)) unless following_account_ids.empty? - privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'limited' }).filter(term: { account_id: @account.id }).track_scores(true).min_score(@min_score)) + privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'public' })) + privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'private' }).filter(terms: { account_id: following_account_ids })) unless following_account_ids.empty? + privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'limited' }).filter(term: { account_id: @account.id })) when 'private', 'direct' - privacy_definition = privacy_definition.or(StatusesIndex.filter(terms: { searchability: %w(public private) }).filter(terms: { account_id: following_account_ids }).track_scores(true).min_score(@min_score)) unless following_account_ids.empty? - privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'limited' }).filter(term: { account_id: @account.id }).track_scores(true).min_score(@min_score)) + privacy_definition = privacy_definition.or(StatusesIndex.filter(terms: { searchability: %w(public private) }).filter(terms: { account_id: following_account_ids })) unless following_account_ids.empty? + privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'limited' }).filter(term: { account_id: @account.id })) when 'limited' - privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'limited' }).filter(term: { account_id: @account.id }).track_scores(true).min_score(@min_score)) + privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'limited' }).filter(term: { account_id: @account.id })) end - definition = parsed_query.apply(StatusesIndex.min_score(@min_score).track_scores(true)).order(id: :desc) + definition = parsed_query.apply(StatusesIndex).order(id: :desc) definition = definition.filter(term: { account_id: @options[:account_id] }) if @options[:account_id].present? definition = definition.and(privacy_definition) @@ -137,16 +133,6 @@ class SearchService < BaseService @options[:type].blank? || @options[:type] == 'statuses' end - def pull_query_commands - @min_score = MIN_SCORE - - min_score_result = @query.scan(MIN_SCORE_RE).first - return unless min_score_result - - @min_score = min_score_result[1].to_f - @query = @query.gsub(MIN_SCORE_RE, '').strip - end - def parsed_query SearchQueryTransformer.new.apply(SearchQueryParser.new.parse(@query)) end