Merge commit '0ad2413b35287958f59073a5b63aecc659a64d98' into glitch-soc/merge-upstream
Conflicts: - `app/javascript/styles/mastodon/forms.scss`: Conflict because we ran eslint autofix on upstream files. - `config/initializers/content_security_policy.rb`: Code style changes but we have a different version. Kept our version. - `streaming/index.js`: Upstream fixed a typo close to glitch-soc-only code. Applied upstream's changes.
This commit is contained in:
@@ -19,7 +19,7 @@ class Appeal < ApplicationRecord
|
||||
MAX_STRIKE_AGE = 20.days
|
||||
|
||||
belongs_to :account
|
||||
belongs_to :strike, class_name: 'AccountWarning', foreign_key: 'account_warning_id'
|
||||
belongs_to :strike, class_name: 'AccountWarning', foreign_key: 'account_warning_id', inverse_of: :appeal
|
||||
belongs_to :approved_by_account, class_name: 'Account', optional: true
|
||||
belongs_to :rejected_by_account, class_name: 'Account', optional: true
|
||||
|
||||
|
||||
@@ -81,8 +81,10 @@ module AccountInteractions
|
||||
# Follow relations
|
||||
has_many :follow_requests, dependent: :destroy
|
||||
|
||||
has_many :active_relationships, class_name: 'Follow', foreign_key: 'account_id', dependent: :destroy
|
||||
has_many :passive_relationships, class_name: 'Follow', foreign_key: 'target_account_id', dependent: :destroy
|
||||
with_options class_name: 'Follow', dependent: :destroy do
|
||||
has_many :active_relationships, foreign_key: 'account_id', inverse_of: :account
|
||||
has_many :passive_relationships, foreign_key: 'target_account_id', inverse_of: :target_account
|
||||
end
|
||||
|
||||
has_many :following, -> { order('follows.id desc') }, through: :active_relationships, source: :target_account
|
||||
has_many :followers, -> { order('follows.id desc') }, through: :passive_relationships, source: :account
|
||||
@@ -91,15 +93,19 @@ module AccountInteractions
|
||||
has_many :account_notes, dependent: :destroy
|
||||
|
||||
# Block relationships
|
||||
has_many :block_relationships, class_name: 'Block', foreign_key: 'account_id', dependent: :destroy
|
||||
with_options class_name: 'Block', dependent: :destroy do
|
||||
has_many :block_relationships, foreign_key: 'account_id', inverse_of: :account
|
||||
has_many :blocked_by_relationships, foreign_key: :target_account_id, inverse_of: :target_account
|
||||
end
|
||||
has_many :blocking, -> { order('blocks.id desc') }, through: :block_relationships, source: :target_account
|
||||
has_many :blocked_by_relationships, class_name: 'Block', foreign_key: :target_account_id, dependent: :destroy
|
||||
has_many :blocked_by, -> { order('blocks.id desc') }, through: :blocked_by_relationships, source: :account
|
||||
|
||||
# Mute relationships
|
||||
has_many :mute_relationships, class_name: 'Mute', foreign_key: 'account_id', dependent: :destroy
|
||||
with_options class_name: 'Mute', dependent: :destroy do
|
||||
has_many :mute_relationships, foreign_key: 'account_id', inverse_of: :account
|
||||
has_many :muted_by_relationships, foreign_key: :target_account_id, inverse_of: :target_account
|
||||
end
|
||||
has_many :muting, -> { order('mutes.id desc') }, through: :mute_relationships, source: :target_account
|
||||
has_many :muted_by_relationships, class_name: 'Mute', foreign_key: :target_account_id, dependent: :destroy
|
||||
has_many :muted_by, -> { order('mutes.id desc') }, through: :muted_by_relationships, source: :account
|
||||
has_many :conversation_mutes, dependent: :destroy
|
||||
has_many :domain_blocks, class_name: 'AccountDomainBlock', dependent: :destroy
|
||||
|
||||
@@ -46,7 +46,7 @@ module Attachmentable
|
||||
def set_file_extension(attachment) # rubocop:disable Naming/AccessorMethodName
|
||||
return if attachment.blank?
|
||||
|
||||
attachment.instance_write :file_name, [Paperclip::Interpolations.basename(attachment, :original), appropriate_extension(attachment)].delete_if(&:blank?).join('.')
|
||||
attachment.instance_write :file_name, [Paperclip::Interpolations.basename(attachment, :original), appropriate_extension(attachment)].compact_blank!.join('.')
|
||||
end
|
||||
|
||||
def check_image_dimension(attachment)
|
||||
|
||||
@@ -37,7 +37,8 @@ class CustomEmoji < ApplicationRecord
|
||||
IMAGE_MIME_TYPES = %w(image/png image/gif image/webp).freeze
|
||||
|
||||
belongs_to :category, class_name: 'CustomEmojiCategory', optional: true
|
||||
has_one :local_counterpart, -> { where(domain: nil) }, class_name: 'CustomEmoji', primary_key: :shortcode, foreign_key: :shortcode
|
||||
|
||||
has_one :local_counterpart, -> { where(domain: nil) }, class_name: 'CustomEmoji', primary_key: :shortcode, foreign_key: :shortcode, inverse_of: false
|
||||
|
||||
has_attached_file :image, styles: { static: { format: 'png', convert_options: '-coalesce +profile "!icc,*" +set modify-date +set create-date' } }, validate_media_type: false
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class DomainBlock < ApplicationRecord
|
||||
|
||||
validates :domain, presence: true, uniqueness: true, domain: true
|
||||
|
||||
has_many :accounts, foreign_key: :domain, primary_key: :domain
|
||||
has_many :accounts, foreign_key: :domain, primary_key: :domain, inverse_of: false
|
||||
delegate :count, to: :accounts, prefix: true
|
||||
|
||||
scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class FollowRecommendation < ApplicationRecord
|
||||
self.primary_key = :account_id
|
||||
|
||||
belongs_to :account_summary, foreign_key: :account_id
|
||||
belongs_to :account_summary, foreign_key: :account_id, inverse_of: false
|
||||
belongs_to :account
|
||||
|
||||
scope :localized, ->(locale) { joins(:account_summary).merge(AccountSummary.localized(locale)) }
|
||||
|
||||
@@ -13,11 +13,13 @@ class Instance < ApplicationRecord
|
||||
|
||||
attr_accessor :failure_days
|
||||
|
||||
has_many :accounts, foreign_key: :domain, primary_key: :domain
|
||||
has_many :accounts, foreign_key: :domain, primary_key: :domain, inverse_of: false
|
||||
|
||||
belongs_to :domain_block, foreign_key: :domain, primary_key: :domain
|
||||
belongs_to :domain_allow, foreign_key: :domain, primary_key: :domain
|
||||
belongs_to :unavailable_domain, foreign_key: :domain, primary_key: :domain # skipcq: RB-RL1031
|
||||
with_options foreign_key: :domain, primary_key: :domain, inverse_of: false do
|
||||
belongs_to :domain_block
|
||||
belongs_to :domain_allow
|
||||
belongs_to :unavailable_domain # skipcq: RB-RL1031
|
||||
end
|
||||
|
||||
scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
|
||||
|
||||
|
||||
@@ -55,13 +55,15 @@ class Notification < ApplicationRecord
|
||||
belongs_to :from_account, class_name: 'Account', optional: true
|
||||
belongs_to :activity, polymorphic: true, optional: true
|
||||
|
||||
belongs_to :mention, foreign_key: 'activity_id', optional: true
|
||||
belongs_to :status, foreign_key: 'activity_id', optional: true
|
||||
belongs_to :follow, foreign_key: 'activity_id', optional: true
|
||||
belongs_to :follow_request, foreign_key: 'activity_id', optional: true
|
||||
belongs_to :favourite, foreign_key: 'activity_id', optional: true
|
||||
belongs_to :poll, foreign_key: 'activity_id', optional: true
|
||||
belongs_to :report, foreign_key: 'activity_id', optional: true
|
||||
with_options foreign_key: 'activity_id', optional: true do
|
||||
belongs_to :mention, inverse_of: :notification
|
||||
belongs_to :status, inverse_of: :notification
|
||||
belongs_to :follow, inverse_of: :notification
|
||||
belongs_to :follow_request, inverse_of: :notification
|
||||
belongs_to :favourite, inverse_of: :notification
|
||||
belongs_to :poll, inverse_of: false
|
||||
belongs_to :report, inverse_of: false
|
||||
end
|
||||
|
||||
validates :type, inclusion: { in: TYPES }
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ class Poll < ApplicationRecord
|
||||
end
|
||||
|
||||
def prepare_options
|
||||
self.options = options.map(&:strip).reject(&:blank?)
|
||||
self.options = options.map(&:strip).compact_blank
|
||||
end
|
||||
|
||||
def reset_parent_cache
|
||||
|
||||
@@ -58,7 +58,7 @@ class Status < ApplicationRecord
|
||||
belongs_to :account, inverse_of: :statuses
|
||||
belongs_to :in_reply_to_account, class_name: 'Account', optional: true
|
||||
belongs_to :conversation, optional: true
|
||||
belongs_to :preloadable_poll, class_name: 'Poll', foreign_key: 'poll_id', optional: true
|
||||
belongs_to :preloadable_poll, class_name: 'Poll', foreign_key: 'poll_id', optional: true, inverse_of: false
|
||||
|
||||
belongs_to :thread, foreign_key: 'in_reply_to_id', class_name: 'Status', inverse_of: :replies, optional: true
|
||||
belongs_to :reblog, foreign_key: 'reblog_of_id', class_name: 'Status', inverse_of: :reblogs, optional: true
|
||||
|
||||
@@ -445,7 +445,6 @@ class User < ApplicationRecord
|
||||
return if chosen_languages.nil?
|
||||
|
||||
chosen_languages.compact_blank!
|
||||
|
||||
self.chosen_languages = nil if chosen_languages.empty?
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user