Merge remote-tracking branch 'parent/main' into upstream-20240806
This commit is contained in:
commit
8e5fe5ccb9
166 changed files with 2268 additions and 1390 deletions
|
@ -87,4 +87,37 @@ RSpec.describe 'Requests' do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST /api/v1/notifications/requests/accept' do
|
||||
subject do
|
||||
post '/api/v1/notifications/requests/accept', params: { id: [notification_request.id] }, headers: headers
|
||||
end
|
||||
|
||||
let!(:notification_request) { Fabricate(:notification_request, account: user.account) }
|
||||
|
||||
it_behaves_like 'forbidden for wrong scope', 'read read:notifications'
|
||||
|
||||
it 'returns http success and creates notification permission', :aggregate_failures do
|
||||
subject
|
||||
|
||||
expect(NotificationPermission.find_by(account: notification_request.account, from_account: notification_request.from_account)).to_not be_nil
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST /api/v1/notifications/requests/dismiss' do
|
||||
subject do
|
||||
post '/api/v1/notifications/requests/dismiss', params: { id: [notification_request.id] }, headers: headers
|
||||
end
|
||||
|
||||
let!(:notification_request) { Fabricate(:notification_request, account: user.account) }
|
||||
|
||||
it_behaves_like 'forbidden for wrong scope', 'read read:notifications'
|
||||
|
||||
it 'returns http success and destroys the notification request', :aggregate_failures do
|
||||
expect { subject }.to change(NotificationRequest, :count).by(-1)
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -135,7 +135,7 @@ RSpec.describe 'Notifications' do
|
|||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(body_json_types.uniq).to eq ['mention']
|
||||
expect(body_as_json[0][:page_min_id]).to_not be_nil
|
||||
expect(body_as_json.dig(:notification_groups, 0, :page_min_id)).to_not be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -147,7 +147,7 @@ RSpec.describe 'Notifications' do
|
|||
|
||||
notifications = user.account.notifications
|
||||
|
||||
expect(body_as_json.size)
|
||||
expect(body_as_json[:notification_groups].size)
|
||||
.to eq(params[:limit])
|
||||
|
||||
expect(response)
|
||||
|
@ -161,7 +161,7 @@ RSpec.describe 'Notifications' do
|
|||
end
|
||||
|
||||
def body_json_types
|
||||
body_as_json.pluck(:type)
|
||||
body_as_json[:notification_groups].pluck(:type)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue