Merge branch 'main' into glitch-soc/merge-upstream

Conflicts:
- `README.md`:
  Our README is completely different.
  Discarded upstream changes.
This commit is contained in:
Claire
2022-11-28 11:33:34 +01:00
246 changed files with 17637 additions and 6738 deletions

View File

@ -68,6 +68,7 @@ class Status < ApplicationRecord
has_many :reblogged_by_accounts, through: :reblogs, class_name: 'Account', source: :account
has_many :replies, foreign_key: 'in_reply_to_id', class_name: 'Status', inverse_of: :thread
has_many :mentions, dependent: :destroy, inverse_of: :status
has_many :mentioned_accounts, through: :mentions, source: :account, class_name: 'Account'
has_many :active_mentions, -> { active }, class_name: 'Mention', inverse_of: :status
has_many :media_attachments, dependent: :nullify
@ -146,11 +147,11 @@ class Status < ApplicationRecord
ids << account_id if local?
if preloaded.nil?
ids += mentions.where(account: Account.local, silent: false).pluck(:account_id)
ids += favourites.where(account: Account.local).pluck(:account_id)
ids += reblogs.where(account: Account.local).pluck(:account_id)
ids += bookmarks.where(account: Account.local).pluck(:account_id)
ids += poll.votes.where(account: Account.local).pluck(:account_id) if poll.present?
ids += mentions.joins(:account).merge(Account.local).active.pluck(:account_id)
ids += favourites.joins(:account).merge(Account.local).pluck(:account_id)
ids += reblogs.joins(:account).merge(Account.local).pluck(:account_id)
ids += bookmarks.joins(:account).merge(Account.local).pluck(:account_id)
ids += poll.votes.joins(:account).merge(Account.local).pluck(:account_id) if poll.present?
else
ids += preloaded.mentions[id] || []
ids += preloaded.favourites[id] || []
@ -590,8 +591,8 @@ class Status < ApplicationRecord
def unlink_from_conversations
return unless direct_visibility?
mentioned_accounts = (association(:mentions).loaded? ? mentions : mentions.includes(:account)).map(&:account)
inbox_owners = mentioned_accounts.select(&:local?) + (account.local? ? [account] : [])
inbox_owners = mentioned_accounts.local
inbox_owners += [account] if account.local?
inbox_owners.each do |inbox_owner|
AccountConversation.remove_status(inbox_owner, self)