* Add: #591 リモート保留中アカウントからメンションが来た場合にuriを記録し、承認時にフェッチしに行く処理 * Rename fetch_remove_status_worker.rb to fetch_remote_status_worker.rb * Wip * Add lock code
This commit is contained in:
parent
b2acc7dbb8
commit
2ab9ea642a
22 changed files with 307 additions and 15 deletions
|
@ -298,14 +298,19 @@ class Account < ApplicationRecord
|
|||
end
|
||||
|
||||
def approve_remote!
|
||||
return unless remote_pending
|
||||
|
||||
update!(remote_pending: false)
|
||||
unsuspend!
|
||||
EnableFollowRequestsWorker.perform_async(id)
|
||||
ActivateRemoteAccountWorker.perform_async(id)
|
||||
end
|
||||
|
||||
def reject_remote!
|
||||
return unless remote_pending
|
||||
|
||||
update!(remote_pending: false, suspension_origin: :local)
|
||||
pending_follow_requests.destroy_all
|
||||
pending_statuses.destroy_all
|
||||
suspend!
|
||||
end
|
||||
|
||||
|
|
|
@ -50,6 +50,11 @@ module Account::Associations
|
|||
has_many :account_warnings, dependent: :destroy, inverse_of: :account
|
||||
has_many :strikes, class_name: 'AccountWarning', foreign_key: :target_account_id, dependent: :destroy, inverse_of: :target_account
|
||||
|
||||
# Remote pendings
|
||||
has_many :pending_follow_requests, dependent: :destroy
|
||||
has_many :pending_statuses, dependent: :destroy
|
||||
has_many :fetchable_pending_statuses, class_name: 'PendingStatus', foreign_key: :fetch_account_id, dependent: :destroy, inverse_of: :fetch_account
|
||||
|
||||
# Antennas (that the account is on, not owned by the account)
|
||||
has_many :antenna_accounts, inverse_of: :account, dependent: :destroy
|
||||
has_many :joined_antennas, class_name: 'Antenna', through: :antenna_accounts, source: :antenna
|
||||
|
|
|
@ -74,7 +74,6 @@ module Account::Interactions
|
|||
included do
|
||||
# Follow relations
|
||||
has_many :follow_requests, dependent: :destroy
|
||||
has_many :pending_follow_requests, dependent: :destroy
|
||||
|
||||
with_options class_name: 'Follow', dependent: :destroy do
|
||||
has_many :active_relationships, foreign_key: 'account_id', inverse_of: :account
|
||||
|
|
18
app/models/pending_status.rb
Normal file
18
app/models/pending_status.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: pending_statuses
|
||||
#
|
||||
# id :bigint(8) not null, primary key
|
||||
# account_id :bigint(8) not null
|
||||
# fetch_account_id :bigint(8) not null
|
||||
# uri :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
|
||||
class PendingStatus < ApplicationRecord
|
||||
belongs_to :account
|
||||
belongs_to :fetch_account, class_name: 'Account'
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue