Merge commit '6c3bd944f8890e1a349bd06e9585cb5ec25507e6' into glitch-soc/merge-upstream

This commit is contained in:
Claire committed 2026-02-13 13:03:51 +01:00
commit ddc7df2064
44 files changed
+230 -48

No files matched your search

+72 -19
View File
@@ -11,20 +11,22 @@ RSpec.describe 'Reports' do
end
let!(:admin) { Fabricate(:admin_user) }
let(:status) { Fabricate(:status) }
let(:target_account) { status.account }
let(:target_account) { Fabricate(:account) }
let(:category) { 'other' }
let(:forward) { nil }
let(:rule_ids) { nil }
let(:status_ids) { nil }
let(:collection_ids) { nil }
let(:params) do
{
status_ids: [status.id],
status_ids:,
collection_ids:,
account_id: target_account.id,
comment: 'reasons',
category: category,
rule_ids: rule_ids,
forward: forward,
category:,
rule_ids:,
forward:,
}
end
@@ -38,7 +40,6 @@ RSpec.describe 'Reports' do
.to start_with('application/json')
expect(response.parsed_body).to match(
a_hash_including(
status_ids: [status.id.to_s],
category: category,
comment: 'reasons'
)
@@ -57,18 +58,6 @@ RSpec.describe 'Reports' do
)
end
context 'when a status does not belong to the reported account' do
let(:target_account) { Fabricate(:account) }
it 'returns http not found' do
subject
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
context 'when a category is chosen' do
let(:category) { 'spam' }
@@ -91,5 +80,69 @@ RSpec.describe 'Reports' do
expect(target_account.targeted_reports.first.rule_ids).to contain_exactly(rule.id)
end
end
context 'with attached status' do
let(:status) { Fabricate(:status, account: target_account) }
let(:status_ids) { [status.id] }
it 'creates a report including the status ids', :aggregate_failures, :inline_jobs do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(response.parsed_body).to match(
a_hash_including(
status_ids: [status.id.to_s],
category: category,
comment: 'reasons'
)
)
end
context 'when a status does not belong to the reported account' do
let(:status) { Fabricate(:status) }
it 'returns http not found' do
subject
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
end
context 'with attached collection', feature: :collections do
let(:collection) { Fabricate(:collection, account: target_account) }
let(:collection_ids) { [collection.id] }
it 'creates a report including the collection ids', :aggregate_failures, :inline_jobs do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(response.parsed_body).to match(
a_hash_including(
collection_ids: [collection.id.to_s],
category: category,
comment: 'reasons'
)
)
end
context 'when a collection does not belong to the reported account' do
let(:collection) { Fabricate(:collection) }
it 'returns http not found' do
subject
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
end
end
end