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

This commit is contained in:
Claire
2022-11-08 15:44:57 +01:00
15 changed files with 142 additions and 27 deletions

View File

@@ -139,7 +139,12 @@ class AccountStatusesCleanupPolicy < ApplicationRecord
# Filtering on `id` rather than `min_status_age` ago will treat
# non-snowflake statuses as older than they really are, but Mastodon
# has switched to snowflake IDs significantly over 2 years ago anyway.
max_id = [max_id, Mastodon::Snowflake.id_at(min_status_age.seconds.ago, with_random: false)].compact.min
snowflake_id = Mastodon::Snowflake.id_at(min_status_age.seconds.ago, with_random: false)
if max_id.nil? || snowflake_id < max_id
max_id = snowflake_id
end
Status.where(Status.arel_table[:id].lteq(max_id))
end

View File

@@ -63,6 +63,8 @@ class FeaturedTag < ApplicationRecord
end
def validate_featured_tags_limit
return unless account.local?
errors.add(:base, I18n.t('featured_tags.errors.limit')) if account.featured_tags.count >= LIMIT
end