mirror of
https://github.com/mastodon/mastodon.git
synced 2026-08-27 00:25:50 -05:00
add request spec and change selection
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -111,7 +111,7 @@ class Tag < ApplicationRecord
|
||||
end
|
||||
|
||||
def to_log_human_identifier
|
||||
"##{display_name}"
|
||||
formatted_name
|
||||
end
|
||||
|
||||
class << self
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user