Add circle visibility

This commit is contained in:
KMY 2023-08-21 18:22:14 +09:00
parent 44eb57183e
commit 3af223275f
20 changed files with 154 additions and 12 deletions

View file

@ -7,9 +7,10 @@ class ProcessMentionsService < BaseService
# and create local mention pointers
# @param [Status] status
# @param [Boolean] save_records Whether to save records in database
def call(status, limited_type: '', save_records: true)
def call(status, limited_type: '', circle: nil, save_records: true)
@status = status
@limited_type = limited_type
@circle = circle
@save_records = save_records
return unless @status.local?
@ -63,7 +64,8 @@ class ProcessMentionsService < BaseService
"@#{mentioned_account.acct}"
end
process_mutual! if @limited_type == 'mutual'
process_mutual! if @limited_type == :mutual
process_circle! if @limited_type == :circle
@status.save! if @save_records
end
@ -103,4 +105,12 @@ class ProcessMentionsService < BaseService
@current_mentions << @status.mentions.new(silent: true, account: target_account) unless mentioned_account_ids.include?(target_account.id)
end
end
def process_circle!
mentioned_account_ids = @current_mentions.map(&:account_id)
@circle.accounts.find_each do |target_account|
@current_mentions << @status.mentions.new(silent: true, account: target_account) unless mentioned_account_ids.include?(target_account.id)
end
end
end