Add action_logs association for account (#36022)

This commit is contained in:
Matt Jankowski 2026-01-28 06:04:00 -05:00 committed by GitHub
parent c1626486bc
commit f861a5cee0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -4,10 +4,8 @@ module AccountableConcern
extend ActiveSupport::Concern extend ActiveSupport::Concern
def log_action(action, target) def log_action(action, target)
Admin::ActionLog.create( current_account
account: current_account, .action_logs
action: action, .create(action:, target:)
target: target
)
end end
end end

View File

@ -12,6 +12,7 @@ module Account::Associations
has_many :account_notes has_many :account_notes
has_many :account_pins has_many :account_pins
has_many :account_warnings has_many :account_warnings
has_many :action_logs, class_name: 'Admin::ActionLog'
has_many :aliases, class_name: 'AccountAlias' has_many :aliases, class_name: 'AccountAlias'
has_many :bookmarks has_many :bookmarks
has_many :collections has_many :collections

View File

@ -8,6 +8,7 @@ RSpec.describe Account do
describe 'Associations' do describe 'Associations' do
it { is_expected.to have_many(:account_notes).inverse_of(:account) } 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) } it { is_expected.to have_many(:targeted_account_notes).inverse_of(:target_account) }
end end