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

Conflicts:
- `app/views/admin/settings/appearance/show.html.haml`:
  Upstream enforced an uniform code style around lambdas, and glitch-soc
  had a different lambda due to its theming system.
  Applied the same code style changes.
- `app/views/settings/preferences/appearance/show.html.haml`:
  Upstream enforced an uniform code style around lambdas, and glitch-soc
  removed some code just after the lambda.
  Applied the same code style changes.
This commit is contained in:
Claire
2023-07-17 19:02:23 +02:00
42 changed files with 824 additions and 486 deletions

View File

@ -205,6 +205,26 @@ class FeedManager
end
end
# Remove a tag's statuses from a home feed
# @param [Tag] from_tag
# @param [Account] into_account
# @return [void]
def unmerge_tag_from_home(from_tag, into_account)
timeline_key = key(:home, into_account.id)
timeline_status_ids = redis.zrange(timeline_key, 0, -1)
# This is a bit tricky because we need posts tagged with this hashtag that are not
# also tagged with another followed hashtag or from a followed user
scope = from_tag.statuses
.where(id: timeline_status_ids)
.where.not(account: into_account.following)
.tagged_with_none(TagFollow.where(account: into_account).pluck(:tag_id))
scope.select('id, reblog_of_id').reorder(nil).find_each do |status|
remove_from_feed(:home, into_account.id, status, aggregate_reblogs: into_account.user&.aggregates_reblogs?)
end
end
# Clear all statuses from or mentioning target_account from a home feed
# @param [Account] account
# @param [Account] target_account