Unlisted/searchability=public posts hashtag search
This commit is contained in:
parent
ca66c47649
commit
222a31c37c
5 changed files with 17 additions and 2 deletions
|
@ -11,7 +11,7 @@ import Warning from '../components/warning';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']),
|
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',
|
directMessageWarning: state.getIn(['compose', 'privacy']) === 'direct',
|
||||||
searchabilityWarning: state.getIn(['compose', 'searchability']) === 'limited',
|
searchabilityWarning: state.getIn(['compose', 'searchability']) === 'limited',
|
||||||
});
|
});
|
||||||
|
|
|
@ -70,6 +70,10 @@ class PublicFeed
|
||||||
Status.with_public_visibility.joins(:account).merge(Account.without_suspended.without_silenced)
|
Status.with_public_visibility.joins(:account).merge(Account.without_suspended.without_silenced)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def public_search_scope
|
||||||
|
Status.with_public_search_visibility.joins(:account).merge(Account.without_suspended.without_silenced)
|
||||||
|
end
|
||||||
|
|
||||||
def local_only_scope
|
def local_only_scope
|
||||||
Status.local
|
Status.local
|
||||||
end
|
end
|
||||||
|
|
|
@ -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_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 :without_reblogs, -> { where(statuses: { reblog_of_id: nil }) }
|
||||||
scope :with_public_visibility, -> { where(visibility: [:public, :public_unlisted, :login]) }
|
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 :with_global_timeline_visibility, -> { where(visibility: [:public, :login]) }
|
||||||
scope :tagged_with, ->(tag_ids) { joins(:statuses_tags).where(statuses_tags: { tag_id: tag_ids }) }
|
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 }) }
|
scope :excluding_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced_at: nil }) }
|
||||||
|
|
|
@ -23,7 +23,7 @@ class TagFeed < PublicFeed
|
||||||
# @param [Integer] min_id
|
# @param [Integer] min_id
|
||||||
# @return [Array<Status>]
|
# @return [Array<Status>]
|
||||||
def get(limit, max_id = nil, since_id = nil, min_id = nil)
|
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_any_scope)
|
||||||
scope.merge!(tagged_with_all_scope)
|
scope.merge!(tagged_with_all_scope)
|
||||||
|
|
|
@ -23,6 +23,8 @@ class FanOutOnWriteService < BaseService
|
||||||
elsif broadcastable_unlisted?
|
elsif broadcastable_unlisted?
|
||||||
fan_out_to_public_recipients!
|
fan_out_to_public_recipients!
|
||||||
fan_out_to_public_unlisted_streams!
|
fan_out_to_public_unlisted_streams!
|
||||||
|
elsif broadcastable_unlisted2?
|
||||||
|
fan_out_to_unlisted_streams!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -73,6 +75,10 @@ class FanOutOnWriteService < BaseService
|
||||||
broadcast_to_public_unlisted_streams!
|
broadcast_to_public_unlisted_streams!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def fan_out_to_unlisted_streams!
|
||||||
|
broadcast_to_hashtag_streams!
|
||||||
|
end
|
||||||
|
|
||||||
def deliver_to_self!
|
def deliver_to_self!
|
||||||
FeedManager.instance.push_to_home(@account, @status, update: update?) if @account.local?
|
FeedManager.instance.push_to_home(@account, @status, update: update?) if @account.local?
|
||||||
end
|
end
|
||||||
|
@ -242,6 +248,10 @@ class FanOutOnWriteService < BaseService
|
||||||
@status.public_unlisted_visibility? && !@status.reblog? && !@account.silenced?
|
@status.public_unlisted_visibility? && !@status.reblog? && !@account.silenced?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def broadcastable_unlisted2?
|
||||||
|
@status.unlisted_visibility? && @status.public_searchability? && !@status.reblog? && !@account.silenced?
|
||||||
|
end
|
||||||
|
|
||||||
class AntennaCollection
|
class AntennaCollection
|
||||||
def initialize(status, update, stl_home = false) # rubocop:disable Style/OptionalBooleanParameter
|
def initialize(status, update, stl_home = false) # rubocop:disable Style/OptionalBooleanParameter
|
||||||
@status = status
|
@status = status
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue