mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 16:59:41 +00:00
Merge commit 'aaa58d4807377e04649499ebee91757b16b9a007' into glitch-soc/merge-upstream
Conflicts: - `.github/workflows/build-security.yml`: Changes were already cherry-picked and adapted in glitch-soc. Kept glitch-soc's version. - `Gemfile.lock`: Changes were already cherry-picked and updated further in glitch-soc. Kept glitch-soc's version. - `lib/mastodon/version.rb`: Changes were already cherry-picked and updated further in glitch-soc. Kept glitch-soc's version.
This commit is contained in:
@@ -49,6 +49,7 @@ RSpec.describe 'Domain Blocks' do
|
||||
{
|
||||
id: domain_block.id.to_s,
|
||||
domain: domain_block.domain,
|
||||
digest: domain_block.domain_digest,
|
||||
created_at: domain_block.created_at.strftime('%Y-%m-%dT%H:%M:%S.%LZ'),
|
||||
severity: domain_block.severity.to_s,
|
||||
reject_media: domain_block.reject_media,
|
||||
@@ -97,6 +98,7 @@ RSpec.describe 'Domain Blocks' do
|
||||
{
|
||||
id: domain_block.id.to_s,
|
||||
domain: domain_block.domain,
|
||||
digest: domain_block.domain_digest,
|
||||
created_at: domain_block.created_at.strftime('%Y-%m-%dT%H:%M:%S.%LZ'),
|
||||
severity: domain_block.severity.to_s,
|
||||
reject_media: domain_block.reject_media,
|
||||
@@ -188,6 +190,7 @@ RSpec.describe 'Domain Blocks' do
|
||||
{
|
||||
id: domain_block.id.to_s,
|
||||
domain: domain_block.domain,
|
||||
digest: domain_block.domain_digest,
|
||||
severity: 'suspend',
|
||||
}
|
||||
)
|
||||
|
||||
@@ -151,7 +151,9 @@ RSpec.describe 'Reports' do
|
||||
let(:params) { { category: 'spam' } }
|
||||
|
||||
it 'updates the report category', :aggregate_failures do
|
||||
expect { subject }.to change { report.reload.category }.from('other').to('spam')
|
||||
expect { subject }
|
||||
.to change { report.reload.category }.from('other').to('spam')
|
||||
.and create_an_action_log
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
|
||||
@@ -184,7 +186,9 @@ RSpec.describe 'Reports' do
|
||||
it_behaves_like 'forbidden for wrong role', ''
|
||||
|
||||
it 'marks report as resolved', :aggregate_failures do
|
||||
expect { subject }.to change { report.reload.unresolved? }.from(true).to(false)
|
||||
expect { subject }
|
||||
.to change { report.reload.unresolved? }.from(true).to(false)
|
||||
.and create_an_action_log
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
@@ -200,7 +204,9 @@ RSpec.describe 'Reports' do
|
||||
it_behaves_like 'forbidden for wrong role', ''
|
||||
|
||||
it 'marks report as unresolved', :aggregate_failures do
|
||||
expect { subject }.to change { report.reload.unresolved? }.from(false).to(true)
|
||||
expect { subject }
|
||||
.to change { report.reload.unresolved? }.from(false).to(true)
|
||||
.and create_an_action_log
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
@@ -216,7 +222,9 @@ RSpec.describe 'Reports' do
|
||||
it_behaves_like 'forbidden for wrong role', ''
|
||||
|
||||
it 'assigns report to the requesting user', :aggregate_failures do
|
||||
expect { subject }.to change { report.reload.assigned_account_id }.from(nil).to(user.account.id)
|
||||
expect { subject }
|
||||
.to change { report.reload.assigned_account_id }.from(nil).to(user.account.id)
|
||||
.and create_an_action_log
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
@@ -232,8 +240,16 @@ RSpec.describe 'Reports' do
|
||||
it_behaves_like 'forbidden for wrong role', ''
|
||||
|
||||
it 'unassigns report from assignee', :aggregate_failures do
|
||||
expect { subject }.to change { report.reload.assigned_account_id }.from(user.account.id).to(nil)
|
||||
expect { subject }
|
||||
.to change { report.reload.assigned_account_id }.from(user.account.id).to(nil)
|
||||
.and create_an_action_log
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_an_action_log
|
||||
change(Admin::ActionLog, :count).by(1)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -52,5 +52,19 @@ RSpec.describe 'API Markers' do
|
||||
expect(user.markers.first.last_read_id).to eq 70_120
|
||||
end
|
||||
end
|
||||
|
||||
context 'when database object becomes stale' do
|
||||
before do
|
||||
allow(Marker).to receive(:transaction).and_raise(ActiveRecord::StaleObjectError)
|
||||
post '/api/v1/markers', headers: headers, params: { home: { last_read_id: '69420' } }
|
||||
end
|
||||
|
||||
it 'returns error json' do
|
||||
expect(response)
|
||||
.to have_http_status(409)
|
||||
expect(body_as_json)
|
||||
.to include(error: /Conflict during update/)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,10 +9,28 @@ describe 'Suggestions API' do
|
||||
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
||||
|
||||
describe 'GET /api/v2/suggestions' do
|
||||
it 'returns http success' do
|
||||
let(:bob) { Fabricate(:account) }
|
||||
let(:jeff) { Fabricate(:account) }
|
||||
let(:params) { {} }
|
||||
|
||||
before do
|
||||
Setting.bootstrap_timeline_accounts = [bob, jeff].map(&:acct).join(',')
|
||||
end
|
||||
|
||||
it 'returns the expected suggestions' do
|
||||
get '/api/v2/suggestions', headers: headers
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
|
||||
expect(body_as_json).to match_array(
|
||||
[bob, jeff].map do |account|
|
||||
hash_including({
|
||||
source: 'staff',
|
||||
sources: ['featured'],
|
||||
account: hash_including({ id: account.id.to_s }),
|
||||
})
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user