rename field to be generic

This commit is contained in:
Pia B
2026-06-17 12:07:33 +02:00
parent 467e275781
commit 75ee73a6ff
4 changed files with 11 additions and 13 deletions

View File

@@ -39,9 +39,7 @@ module Admin
def log_action_from_change
action_log = current_account.action_logs.new(action: 'update', target: @tag)
action_log.usable = @tag.saved_changes['usable']&.last
action_log.trendable = @tag.saved_changes['trendable']&.last
action_log.listable = @tag.saved_changes['listable']&.last
action_log.log_changes = @tag.saved_changes.slice('usable', 'trendable', 'listable').transform_values(&:last)
action_log.save
end

View File

@@ -19,7 +19,7 @@
#
class Admin::ActionLog < ApplicationRecord
TAG_ATTRIBUTES = %i(usable trendable listable).freeze
LOG_ATTRIBUTES = %i(usable trendable listable).freeze
belongs_to :account
belongs_to :target, polymorphic: true, optional: true
@@ -28,7 +28,7 @@ class Admin::ActionLog < ApplicationRecord
before_validation :set_route_param
before_validation :set_permalink
store_accessor :tag_changes, *TAG_ATTRIBUTES
store_accessor :log_changes, *LOG_ATTRIBUTES
scope :latest, -> { order(id: :desc) }

View File

@@ -289,11 +289,11 @@ en-GB:
enable_relay_html: "%{name} enabled the relay %{target}"
enable_sign_in_token_auth_user_html: "%{name} enabled email token authentication for %{target}"
enable_user_html: "%{name} enabled login for user %{target}"
listable_tag_html: "can be suggested"
listable_tag_html: can be suggested
memorialize_account_html: "%{name} turned %{target}'s account into a memoriam page"
not_listable_tag_html: "won't be suggested"
not_trendable_tag_html: "won't appear under trends"
not_usable_tag_html: "cannot be used"
not_listable_tag_html: won't be suggested
not_trendable_tag_html: won't appear under trends
not_usable_tag_html: cannot be used
promote_user_html: "%{name} promoted user %{target}"
publish_terms_of_service_html: "%{name} published updates to the terms of service"
reject_appeal_html: "%{name} rejected moderation decision appeal from %{target}"
@@ -306,7 +306,7 @@ en-GB:
sensitive_account_html: "%{name} marked %{target}'s media as sensitive"
silence_account_html: "%{name} limited %{target}'s account"
suspend_account_html: "%{name} suspended %{target}'s account"
trendable_tag_html: "can appear under trends"
trendable_tag_html: can appear under trends
unassigned_report_html: "%{name} unassigned report %{target}"
unblock_email_account_html: "%{name} unblocked %{target}'s email address"
unsensitive_account_html: "%{name} unmarked %{target}'s media as sensitive"
@@ -319,10 +319,10 @@ en-GB:
update_ip_block_html: "%{name} changed rule for IP %{target}"
update_report_html: "%{name} updated report %{target}"
update_status_html: "%{name} updated post by %{target}"
update_tag_html: "%{name} changed %{target} settings to: %{usable} %{trendable} %{listable}"
update_user_role_html: "%{name} changed %{target} role"
update_username_block_html: "%{name} updated rule for usernames containing %{target}"
update_tag_html: "%{name} changed %{target} settings to: %{usable} %{trendable} %{listable}"
usable_tag_html: "can be used;"
usable_tag_html: can be used;
deleted_account: deleted account
empty: No logs found.
filter_by_action: Filter by action

View File

@@ -25,7 +25,7 @@ RSpec.describe 'Admin Tags' do
expect(response).to have_http_status(302)
expect(Admin::ActionLog.last.human_identifier).to eq('#supertag')
expect(Admin::ActionLog.pluck(:action)).to eq(%w(update))
expect(Admin::ActionLog.pluck(:tag_changes)).to eq([{ 'listable' => false, 'trendable' => true }])
expect(Admin::ActionLog.pluck(:log_changes)).to eq([{ 'listable' => false, 'trendable' => true }])
end
end
end