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

Conflicts:
- `db/schema.rb`:
  Conflict due to glitch-soc adding the `content_type` column on status edits
  and thus having a different schema version number.
  Solved by taking upstream's schema version number, as it is higher than
  glitch-soc's.
This commit is contained in:
Claire
2022-02-17 10:58:25 +01:00
81 changed files with 1461 additions and 381 deletions

View File

@ -111,7 +111,7 @@ class User < ApplicationRecord
scope :inactive, -> { where(arel_table[:current_sign_in_at].lt(ACTIVE_DURATION.ago)) }
scope :active, -> { confirmed.where(arel_table[:current_sign_in_at].gteq(ACTIVE_DURATION.ago)).joins(:account).where(accounts: { suspended_at: nil }) }
scope :matches_email, ->(value) { where(arel_table[:email].matches("#{value}%")) }
scope :matches_ip, ->(value) { left_joins(:ips).where('user_ips.ip <<= ?', value) }
scope :matches_ip, ->(value) { left_joins(:ips).where('user_ips.ip <<= ?', value).group('users.id') }
scope :emailable, -> { confirmed.enabled.joins(:account).merge(Account.searchable) }
before_validation :sanitize_languages
@ -265,6 +265,10 @@ class User < ApplicationRecord
settings.notification_emails['pending_account']
end
def allows_appeal_emails?
settings.notification_emails['appeal']
end
def allows_trending_tag_emails?
settings.notification_emails['trending_tag']
end