Merge branch 'kb_development' into kb_migration
This commit is contained in:
commit
9e2390f3c9
57 changed files with 227 additions and 64 deletions
|
@ -3,7 +3,7 @@
|
|||
module AccountLimitable
|
||||
def scope_status(status)
|
||||
case status.visibility.to_sym
|
||||
when :public, :unlisted
|
||||
when :public, :unlisted, :public_unlisted
|
||||
#scope_local.merge(scope_list_following_account(status.account))
|
||||
scope_local
|
||||
when :private
|
||||
|
|
|
@ -17,8 +17,13 @@ class FanOutOnWriteService < BaseService
|
|||
warm_payload_cache!
|
||||
|
||||
fan_out_to_local_recipients!
|
||||
fan_out_to_public_recipients! if broadcastable?
|
||||
fan_out_to_public_streams! if broadcastable?
|
||||
if broadcastable?
|
||||
fan_out_to_public_recipients!
|
||||
fan_out_to_public_streams!
|
||||
elsif broadcastable_unlisted?
|
||||
fan_out_to_public_recipients!
|
||||
fan_out_to_public_unlisted_streams!
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -41,7 +46,7 @@ class FanOutOnWriteService < BaseService
|
|||
notify_about_update! if update?
|
||||
|
||||
case @status.visibility.to_sym
|
||||
when :public, :unlisted, :private
|
||||
when :public, :unlisted, :public_unlisted, :private
|
||||
deliver_to_all_followers!
|
||||
deliver_to_lists!
|
||||
when :limited
|
||||
|
@ -61,6 +66,11 @@ class FanOutOnWriteService < BaseService
|
|||
broadcast_to_public_streams!
|
||||
end
|
||||
|
||||
def fan_out_to_public_unlisted_streams!
|
||||
broadcast_to_hashtag_streams!
|
||||
broadcast_to_public_unlisted_streams!
|
||||
end
|
||||
|
||||
def deliver_to_self!
|
||||
FeedManager.instance.push_to_home(@account, @status, update: update?) if @account.local?
|
||||
end
|
||||
|
@ -132,6 +142,16 @@ class FanOutOnWriteService < BaseService
|
|||
end
|
||||
end
|
||||
|
||||
def broadcast_to_public_unlisted_streams!
|
||||
return if @status.reply? && @status.in_reply_to_account_id != @account.id
|
||||
|
||||
redis.publish(@status.local? ? 'timeline:public:local' : 'timeline:public:remote', anonymous_payload)
|
||||
|
||||
if @status.with_media?
|
||||
redis.publish(@status.local? ? 'timeline:public:local:media' : 'timeline:public:remote:media', anonymous_payload)
|
||||
end
|
||||
end
|
||||
|
||||
def deliver_to_conversation!
|
||||
AccountConversation.add_status(@account, @status) unless update?
|
||||
end
|
||||
|
@ -158,4 +178,8 @@ class FanOutOnWriteService < BaseService
|
|||
def broadcastable?
|
||||
@status.public_visibility? && !@status.reblog? && !@account.silenced?
|
||||
end
|
||||
|
||||
def broadcastable_unlisted?
|
||||
@status.public_unlisted_visibility? && !@status.reblog? && !@account.silenced?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -65,7 +65,7 @@ class PostStatusService < BaseService
|
|||
@sensitive = (@options[:sensitive].nil? ? @account.user&.setting_default_sensitive : @options[:sensitive]) || @options[:spoiler_text].present?
|
||||
@text = @options.delete(:spoiler_text) if @text.blank? && @options[:spoiler_text].present?
|
||||
@visibility = @options[:visibility] || @account.user&.setting_default_privacy
|
||||
@visibility = :unlisted if @visibility&.to_sym == :public && @account.silenced?
|
||||
@visibility = :unlisted if (@visibility&.to_sym == :public || @visibility&.to_sym == :public_unlisted) && @account.silenced?
|
||||
@scheduled_at = @options[:scheduled_at]&.to_datetime
|
||||
@scheduled_at = nil if scheduled_in_the_past?
|
||||
rescue ArgumentError
|
||||
|
|
|
@ -62,7 +62,7 @@ class ReportService < BaseService
|
|||
# If the account making reports is remote, it is likely anonymized so we have to relax the requirements for attaching statuses.
|
||||
domain = @source_account.domain.to_s.downcase
|
||||
has_followers = @target_account.followers.where(Account.arel_table[:domain].lower.eq(domain)).exists?
|
||||
visibility = has_followers ? %i(public unlisted private) : %i(public unlisted)
|
||||
visibility = has_followers ? %i(public unlisted public_unlisted private) : %i(public unlisted public_unlisted)
|
||||
scope = @target_account.statuses.with_discarded
|
||||
scope.merge!(scope.where(visibility: visibility).or(scope.where('EXISTS (SELECT 1 FROM mentions m JOIN accounts a ON m.account_id = a.id WHERE lower(a.domain) = ?)', domain)))
|
||||
# Allow missing posts to not drop reports that include e.g. a deleted post
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue