Fix mention_urls error
This commit is contained in:
parent
489eeb4aa7
commit
5b4661c2f7
3 changed files with 22 additions and 2 deletions
|
@ -212,4 +212,24 @@ class ActivityPub::TagManager
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def mentions_uris(status)
|
||||||
|
if status.account.silenced?
|
||||||
|
# Only notify followers if the account is locally silenced
|
||||||
|
account_ids = status.active_mentions.pluck(:account_id)
|
||||||
|
uris = status.account.followers.where(id: account_ids).each_with_object([]) do |account, result|
|
||||||
|
result << uri_for(account)
|
||||||
|
result << account_followers_url(account) if account.group?
|
||||||
|
end
|
||||||
|
uris.concat(FollowRequest.where(target_account_id: status.account_id, account_id: account_ids).each_with_object([]) do |request, result|
|
||||||
|
result << uri_for(request.account)
|
||||||
|
result << account_followers_url(request.account) if request.account.group?
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
status.active_mentions.each_with_object([]) do |mention, result|
|
||||||
|
result << uri_for(mention.account)
|
||||||
|
result << account_followers_url(mention.account) if mention.account.group?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,7 +42,7 @@ class SearchService < BaseService
|
||||||
case @searchability
|
case @searchability
|
||||||
when 'public'
|
when 'public'
|
||||||
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'public' }))
|
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'public' }))
|
||||||
privacy_definition = privacy_definition.or(StatusesIndex.filter(terms: { searchability: %w(unlisted) }).filter(terms: { account_id: following_account_ids })) unless following_account_ids.empty?
|
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'unlisted' }).filter(terms: { account_id: following_account_ids })) unless following_account_ids.empty?
|
||||||
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'direct' }).filter(term: { account_id: @account.id }))
|
privacy_definition = privacy_definition.or(StatusesIndex.filter(term: { searchability: 'direct' }).filter(term: { account_id: @account.id }))
|
||||||
when 'unlisted', 'private'
|
when 'unlisted', 'private'
|
||||||
privacy_definition = privacy_definition.or(StatusesIndex.filter(terms: { searchability: %w(public unlisted) }).filter(terms: { account_id: following_account_ids })) unless following_account_ids.empty?
|
privacy_definition = privacy_definition.or(StatusesIndex.filter(terms: { searchability: %w(public unlisted) }).filter(terms: { account_id: following_account_ids })) unless following_account_ids.empty?
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class AddSearchabilityToAccounts < ActiveRecord::Migration[6.1]
|
class AddSearchabilityToAccounts < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
add_column :accounts, :searchability, :integer, null: false, default: 0
|
add_column :accounts, :searchability, :integer, null: false, default: 3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue