mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-05 17:31:12 +00:00
Merge 50961e32e0
into 14cb5ff881
This commit is contained in:
commit
abae1092a2
|
@ -6,6 +6,7 @@ class Admin::Reports::ActionsController < Admin::BaseController
|
||||||
def preview
|
def preview
|
||||||
authorize @report, :show?
|
authorize @report, :show?
|
||||||
@moderation_action = action_from_button
|
@moderation_action = action_from_button
|
||||||
|
@statuses = @report.statuses.includes(:application, :media_attachments)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|
|
@ -79,6 +79,10 @@ class Report < ApplicationRecord
|
||||||
Status.with_discarded.where(id: status_ids)
|
Status.with_discarded.where(id: status_ids)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def deleted_status_ids
|
||||||
|
status_ids.difference(statuses.pluck(:id))
|
||||||
|
end
|
||||||
|
|
||||||
def media_attachments_count
|
def media_attachments_count
|
||||||
statuses_to_query = []
|
statuses_to_query = []
|
||||||
count = 0
|
count = 0
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
.strike-card__statuses-list__item
|
||||||
|
.one-liner= t('disputes.strikes.status', id: status_id)
|
||||||
|
.strike-card__statuses-list__item__meta
|
||||||
|
= t('disputes.strikes.status_removed')
|
13
app/views/admin/reports/actions/_status.html.haml
Normal file
13
app/views/admin/reports/actions/_status.html.haml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
.strike-card__statuses-list__item
|
||||||
|
.one-liner
|
||||||
|
.emojify= one_line_preview(status)
|
||||||
|
- status.ordered_media_attachments.each do |media|
|
||||||
|
%abbr{ title: media.description }
|
||||||
|
= material_symbol 'link'
|
||||||
|
= media.file_file_name
|
||||||
|
.strike-card__statuses-list__item__meta
|
||||||
|
= link_to ActivityPub::TagManager.instance.url_for(status), target: '_blank', rel: 'noopener' do
|
||||||
|
%time.formatted{ datetime: status.created_at.iso8601, title: l(status.created_at) }= l(status.created_at)
|
||||||
|
- if status.application.present?
|
||||||
|
·
|
||||||
|
= status.application.name
|
|
@ -50,28 +50,8 @@
|
||||||
%strong= t('user_mailer.warning.statuses')
|
%strong= t('user_mailer.warning.statuses')
|
||||||
|
|
||||||
.strike-card__statuses-list
|
.strike-card__statuses-list
|
||||||
- status_map = @report.statuses.includes(:application, :media_attachments).index_by(&:id)
|
= render partial: 'status', collection: @statuses
|
||||||
|
= render partial: 'deleted_status', collection: @report.deleted_status_ids, as: :status_id
|
||||||
- @report.status_ids.each do |status_id|
|
|
||||||
.strike-card__statuses-list__item
|
|
||||||
- if (status = status_map[status_id.to_i])
|
|
||||||
.one-liner
|
|
||||||
.emojify= one_line_preview(status)
|
|
||||||
|
|
||||||
- status.ordered_media_attachments.each do |media_attachment|
|
|
||||||
%abbr{ title: media_attachment.description }
|
|
||||||
= material_symbol 'link'
|
|
||||||
= media_attachment.file_file_name
|
|
||||||
.strike-card__statuses-list__item__meta
|
|
||||||
= link_to ActivityPub::TagManager.instance.url_for(status), target: '_blank', rel: 'noopener' do
|
|
||||||
%time.formatted{ datetime: status.created_at.iso8601, title: l(status.created_at) }= l(status.created_at)
|
|
||||||
- unless status.application.nil?
|
|
||||||
·
|
|
||||||
= status.application.name
|
|
||||||
- else
|
|
||||||
.one-liner= t('disputes.strikes.status', id: status_id)
|
|
||||||
.strike-card__statuses-list__item__meta
|
|
||||||
= t('disputes.strikes.status_removed')
|
|
||||||
|
|
||||||
%hr.spacer/
|
%hr.spacer/
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,17 @@ RSpec.describe Report do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#deleted_status_ids' do
|
||||||
|
let!(:status) { Fabricate :status }
|
||||||
|
let(:report) { Fabricate.build :report, status_ids: [deleted, status.id] }
|
||||||
|
let(:deleted) { 123_123_123 }
|
||||||
|
|
||||||
|
it 'returns ids of stored statuses which no longer exist' do
|
||||||
|
expect(report.deleted_status_ids)
|
||||||
|
.to contain_exactly(deleted)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'media_attachments_count' do
|
describe 'media_attachments_count' do
|
||||||
it 'returns count of media attachments in statuses' do
|
it 'returns count of media attachments in statuses' do
|
||||||
status1 = Fabricate(:status, ordered_media_attachment_ids: [1, 2])
|
status1 = Fabricate(:status, ordered_media_attachment_ids: [1, 2])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user