add request spec and change selection
Some checks are pending
Chromatic / Check for relevant changes (push) Waiting to run
Chromatic / Run Chromatic (push) Blocked by required conditions

This commit is contained in:
Pia B
2026-06-09 15:57:01 +02:00
parent 9b521cf2c3
commit 8b1d3b91b7
5 changed files with 18 additions and 3 deletions

View File

@@ -17,7 +17,7 @@ module Admin
authorize @tag, :show?
@time_period = report_range
@action_logs = Admin::ActionLogFilter.new(action_type: :update_tag).results.limit(5)
@action_logs = Admin::ActionLogFilter.new(target_tag: @tag.formatted_name).results.limit(5)
end
def update

View File

@@ -117,6 +117,8 @@ class Admin::ActionLogFilter
when 'target_domain'
normalized_domain = TagManager.instance.normalize_domain(value)
latest_action_logs.where(human_identifier: normalized_domain, target_type: INSTANCE_TARGET_TYPES)
when 'target_tag'
latest_action_logs.where(human_identifier: value)
else
raise Mastodon::InvalidParameterError, "Unknown filter: #{key}"
end

View File

@@ -111,7 +111,7 @@ class Tag < ApplicationRecord
end
def to_log_human_identifier
"##{display_name}"
formatted_name
end
class << self

View File

@@ -95,7 +95,7 @@
%hr.spacer/
%h3= t('admin.tags.audit_log.title')
- if @action_logs.empty?
- if @action_logs.nil?
%p= t('accounts.nothing_here')
- else
.report-notes

View File

@@ -15,4 +15,17 @@ RSpec.describe 'Admin Tags' do
.to have_http_status(400)
end
end
describe 'update tag' do
before { sign_in Fabricate(:admin_user) }
let(:tag) { Fabricate :tag, name: '#supertag' }
it 'redirects to tag page and saves log action for tag' do
put admin_tag_path(tag.id, params: { tag: { trendable: true } })
expect(response).to have_http_status(302)
expect(Admin::ActionLog.last.human_identifier).to eq(tag.formatted_name)
end
end
end