mastodon/app/models/admin/action_log.rb
Matt Jankowski efc85e39a0
Some checks are pending
Check i18n / check-i18n (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Check formatting / lint (push) Waiting to run
Ruby Linting / lint (push) Waiting to run
Historical data migration test / test (14-alpine) (push) Waiting to run
Historical data migration test / test (15-alpine) (push) Waiting to run
Historical data migration test / test (16-alpine) (push) Waiting to run
Historical data migration test / test (17-alpine) (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / Libvips tests (.ruby-version) (push) Blocked by required conditions
Ruby Testing / Libvips tests (3.2) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Add missing NOT NULL requirement to small, indexed, valid data tables (#33284)
2024-12-14 00:16:03 +00:00

51 lines
1.2 KiB
Ruby

# frozen_string_literal: true
# == Schema Information
#
# Table name: admin_action_logs
#
# id :bigint(8) not null, primary key
# action :string default(""), not null
# human_identifier :string
# permalink :string
# route_param :string
# target_type :string
# created_at :datetime not null
# updated_at :datetime not null
# account_id :bigint(8) not null
# target_id :bigint(8)
#
class Admin::ActionLog < ApplicationRecord
self.ignored_columns += %w(
recorded_changes
)
belongs_to :account
belongs_to :target, polymorphic: true, optional: true
before_validation :set_human_identifier
before_validation :set_route_param
before_validation :set_permalink
scope :latest, -> { order(id: :desc) }
def action
super.to_sym
end
private
def set_human_identifier
self.human_identifier = target.to_log_human_identifier if target.respond_to?(:to_log_human_identifier)
end
def set_route_param
self.route_param = target.to_log_route_param if target.respond_to?(:to_log_route_param)
end
def set_permalink
self.permalink = target.to_log_permalink if target.respond_to?(:to_log_permalink)
end
end