Add login visibility
This commit is contained in:
parent
0907b67239
commit
20497e0c21
42 changed files with 106 additions and 47 deletions
|
@ -3,8 +3,7 @@
|
|||
module AccountScope
|
||||
def scope_status(status)
|
||||
case status.visibility.to_sym
|
||||
when :public, :unlisted, :public_unlisted
|
||||
# scope_local.merge(scope_list_following_account(status.account))
|
||||
when :public, :unlisted, :public_unlisted, :login
|
||||
scope_local
|
||||
when :private
|
||||
scope_account_local_followers(status.account)
|
||||
|
|
|
@ -46,10 +46,10 @@ class FanOutOnWriteService < BaseService
|
|||
notify_about_update! if update?
|
||||
|
||||
case @status.visibility.to_sym
|
||||
when :public, :unlisted, :public_unlisted, :private
|
||||
when :public, :unlisted, :public_unlisted, :login, :private
|
||||
deliver_to_all_followers!
|
||||
deliver_to_lists!
|
||||
deliver_to_antennas! if [:public, :public_unlisted].include?(@status.visibility.to_sym) && !@account.dissubscribable
|
||||
deliver_to_antennas! if [:public, :public_unlisted, :login].include?(@status.visibility.to_sym) && !@account.dissubscribable
|
||||
deliver_to_stl_antennas!
|
||||
when :limited
|
||||
deliver_to_mentioned_followers!
|
||||
|
@ -121,7 +121,7 @@ class FanOutOnWriteService < BaseService
|
|||
antennas = Antenna.available_stls
|
||||
antennas = antennas.where(account_id: Account.without_suspended.joins(:user).select('accounts.id').where('users.current_sign_in_at > ?', User::ACTIVE_DURATION.ago))
|
||||
|
||||
antennas = antennas.where(account: @account.followers).or(antennas.where(account: @account)).where.not(list_id: 0) if !@account.domain.nil? || [:public, :public_unlisted].exclude?(@status.visibility.to_sym)
|
||||
antennas = antennas.where(account: @account.followers).or(antennas.where(account: @account)).where.not(list_id: 0) if !@account.domain.nil? || [:public, :public_unlisted, :login].exclude?(@status.visibility.to_sym)
|
||||
|
||||
collection = AntennaCollection.new(@status, @options[:update])
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ class GroupReblogService < BaseService
|
|||
return nil if status.account.group?
|
||||
|
||||
visibility = status.visibility.to_sym
|
||||
return nil unless %i(public public_unlisted unlisted private direct).include?(visibility)
|
||||
return nil unless %i(public public_unlisted unlisted login private direct).include?(visibility)
|
||||
|
||||
accounts = status.mentions.map(&:account) | status.active_mentions.map(&:account)
|
||||
transcription = %i(private direct).include?(visibility)
|
||||
|
|
|
@ -72,7 +72,7 @@ class PostStatusService < BaseService
|
|||
end) || @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 || @visibility&.to_sym == :public_unlisted) && @account.silenced?
|
||||
@visibility = :unlisted if (@visibility&.to_sym == :public || @visibility&.to_sym == :public_unlisted || @visibility&.to_sym == :login) && @account.silenced?
|
||||
@visibility = :public_unlisted if @visibility&.to_sym == :public && !@options[:force_visibility] && !@options[:application]&.superapp && @account.user&.setting_public_post_to_unlisted
|
||||
@searchability = searchability
|
||||
@markdown = @options[:markdown] || false
|
||||
|
@ -85,9 +85,9 @@ class PostStatusService < BaseService
|
|||
def searchability
|
||||
case @options[:searchability]&.to_sym
|
||||
when :public
|
||||
case @visibility&.to_sym when :public, :public_unlisted then :public when :unlisted, :private then :private else :direct end
|
||||
case @visibility&.to_sym when :public, :public_unlisted, :login then :public when :unlisted, :private then :private else :direct end
|
||||
when :private
|
||||
case @visibility&.to_sym when :public, :public_unlisted, :unlisted, :private then :private else :direct end
|
||||
case @visibility&.to_sym when :public, :public_unlisted, :login, :unlisted, :private then :private else :direct end
|
||||
when :direct
|
||||
:direct
|
||||
when nil
|
||||
|
|
|
@ -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 public_unlisted private) : %i(public unlisted public_unlisted)
|
||||
visibility = has_followers ? %i(public unlisted public_unlisted login 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