mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Add action_logs association for account (#36022)
This commit is contained in:
@@ -4,10 +4,8 @@ module AccountableConcern
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def log_action(action, target)
|
||||
Admin::ActionLog.create(
|
||||
account: current_account,
|
||||
action: action,
|
||||
target: target
|
||||
)
|
||||
current_account
|
||||
.action_logs
|
||||
.create(action:, target:)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,6 +12,7 @@ module Account::Associations
|
||||
has_many :account_notes
|
||||
has_many :account_pins
|
||||
has_many :account_warnings
|
||||
has_many :action_logs, class_name: 'Admin::ActionLog'
|
||||
has_many :aliases, class_name: 'AccountAlias'
|
||||
has_many :bookmarks
|
||||
has_many :collections
|
||||
|
||||
@@ -8,6 +8,7 @@ RSpec.describe Account do
|
||||
|
||||
describe 'Associations' do
|
||||
it { is_expected.to have_many(:account_notes).inverse_of(:account) }
|
||||
it { is_expected.to have_many(:action_logs).class_name('Admin::ActionLog') }
|
||||
it { is_expected.to have_many(:targeted_account_notes).inverse_of(:target_account) }
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user