Merge remote-tracking branch 'parent/main' into upstream-20240326

This commit is contained in:
KMY 2024-03-26 09:08:20 +09:00
commit 6c9b221cb2
263 changed files with 4628 additions and 1518 deletions

View file

@ -83,6 +83,11 @@ module Account::Interactions
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
with_options class_name: 'SeveredRelationship', dependent: :destroy do
has_many :severed_relationships, foreign_key: 'local_account_id', inverse_of: :local_account
has_many :remote_severed_relationships, foreign_key: 'remote_account_id', inverse_of: :remote_account
end
# Account notes
has_many :account_notes, dependent: :destroy

View file

@ -27,6 +27,16 @@ module Account::Merging
end
end
[
Notification, NotificationPermission, NotificationRequest
].each do |klass|
klass.where(from_account_id: other_account.id).reorder(nil).find_each do |record|
record.update_attribute(:from_account_id, id)
rescue ActiveRecord::RecordNotUnique
next
end
end
target_classes = [
Follow, FollowRequest, Block, Mute, AccountModerationNote, AccountPin,
AccountNote
@ -48,6 +58,18 @@ module Account::Merging
record.update_attribute(:account_warning_id, id)
end
SeveredRelationship.about_local_account(other_account).reorder(nil).find_each do |record|
record.update_attribute(:local_account_id, id)
rescue ActiveRecord::RecordNotUnique
next
end
SeveredRelationship.about_remote_account(other_account).reorder(nil).find_each do |record|
record.update_attribute(:remote_account_id, id)
rescue ActiveRecord::RecordNotUnique
next
end
# Some follow relationships have moved, so the cache is stale
Rails.cache.delete_matched("followers_hash:#{id}:*")
Rails.cache.delete_matched("relationships:#{id}:*")

View file

@ -0,0 +1,27 @@
# frozen_string_literal: true
module BrowserDetection
extend ActiveSupport::Concern
included do
before_save :assign_user_agent
end
def detection
@detection ||= Browser.new(user_agent)
end
def browser
detection.id
end
def platform
detection.platform.id
end
private
def assign_user_agent
self.user_agent ||= ''
end
end

View file

@ -87,10 +87,6 @@ module User::HasSettings
settings['slip_local_emoji_reaction']
end
def setting_unfollow_modal
settings['web.unfollow_modal']
end
def setting_boost_modal
settings['web.reblog_modal']
end