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
3 changed files with 5 additions and 5 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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