diff --git a/app/javascript/mastodon/features/compose/containers/warning_container.jsx b/app/javascript/mastodon/features/compose/containers/warning_container.jsx index 1c27b74f8b..3348e91b1f 100644 --- a/app/javascript/mastodon/features/compose/containers/warning_container.jsx +++ b/app/javascript/mastodon/features/compose/containers/warning_container.jsx @@ -11,7 +11,7 @@ import Warning from '../components/warning'; const mapStateToProps = state => ({ needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']), - hashtagWarning: ['public', 'public_unlisted', 'login'].indexOf(state.getIn(['compose', 'privacy'])) < 0 && HASHTAG_PATTERN_REGEX.test(state.getIn(['compose', 'text'])), + 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', }); diff --git a/app/models/public_feed.rb b/app/models/public_feed.rb index f4d27e53d3..929f062562 100644 --- a/app/models/public_feed.rb +++ b/app/models/public_feed.rb @@ -70,6 +70,10 @@ class PublicFeed Status.with_public_visibility.joins(:account).merge(Account.without_suspended.without_silenced) end + def public_search_scope + Status.with_public_search_visibility.joins(:account).merge(Account.without_suspended.without_silenced) + end + def local_only_scope Status.local end diff --git a/app/models/status.rb b/app/models/status.rb index 653fa30bc2..0650e96e36 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -103,6 +103,7 @@ class Status < ApplicationRecord scope :without_replies, -> { where('statuses.reply = FALSE OR statuses.in_reply_to_account_id = statuses.account_id') } scope :without_reblogs, -> { where(statuses: { reblog_of_id: nil }) } scope :with_public_visibility, -> { where(visibility: [:public, :public_unlisted, :login]) } + scope :with_public_search_visibility, -> { merge(where(visibility: [:public, :public_unlisted, :login]).or(Status.where(searchability: :public))) } scope :with_global_timeline_visibility, -> { where(visibility: [:public, :login]) } scope :tagged_with, ->(tag_ids) { joins(:statuses_tags).where(statuses_tags: { tag_id: tag_ids }) } scope :excluding_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced_at: nil }) } diff --git a/app/models/tag_feed.rb b/app/models/tag_feed.rb index 4f9c9c6d64..fe805ed0dc 100644 --- a/app/models/tag_feed.rb +++ b/app/models/tag_feed.rb @@ -23,7 +23,7 @@ class TagFeed < PublicFeed # @param [Integer] min_id # @return [Array] def get(limit, max_id = nil, since_id = nil, min_id = nil) - scope = public_scope + scope = public_search_scope scope.merge!(tagged_with_any_scope) scope.merge!(tagged_with_all_scope) diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 951b766ff7..1b5a00f3d6 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -23,6 +23,8 @@ class FanOutOnWriteService < BaseService elsif broadcastable_unlisted? fan_out_to_public_recipients! fan_out_to_public_unlisted_streams! + elsif broadcastable_unlisted2? + fan_out_to_unlisted_streams! end end @@ -73,6 +75,10 @@ class FanOutOnWriteService < BaseService broadcast_to_public_unlisted_streams! end + def fan_out_to_unlisted_streams! + broadcast_to_hashtag_streams! + end + def deliver_to_self! FeedManager.instance.push_to_home(@account, @status, update: update?) if @account.local? end @@ -242,6 +248,10 @@ class FanOutOnWriteService < BaseService @status.public_unlisted_visibility? && !@status.reblog? && !@account.silenced? end + def broadcastable_unlisted2? + @status.unlisted_visibility? && @status.public_searchability? && !@status.reblog? && !@account.silenced? + end + class AntennaCollection def initialize(status, update, stl_home = false) # rubocop:disable Style/OptionalBooleanParameter @status = status