Merge commit '77cd16f4ee7ab807df6fffb1538a6659a8182a9e' into glitch-soc/merge-upstream
Conflicts: - `app/javascript/styles/mastodon/components.scss`: Conflict caused by glitch-soc changing the path to images, and upstream removing styling using such an image. Removed the styling as upstream did. - `app/models/account.rb`: Conflict due to upstream changing lines adjacent to a change made in glitch-soc to have configurable limits. Ported upstream's changes. - `yarn.lock`: Dependencies adjacent to glitch-soc-only dependencies updated. Updated them as well.
This commit is contained in:
commit
8103e69b17
78 files changed
+2363
-2051
No files matched your search
@@ -0,0 +1,36 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Domain Blocks Previews API' do
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
let(:scopes) { 'write:blocks' }
|
||||
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
||||
let(:account) { Fabricate(:account, user: user) }
|
||||
|
||||
describe 'GET /api/v1/domain_blocks/preview' do
|
||||
subject { get '/api/v1/domain_blocks/preview', params: { domain: domain }, headers: headers }
|
||||
|
||||
let(:domain) { 'host.example' }
|
||||
|
||||
before do
|
||||
Fabricate :follow, account: account, target_account: Fabricate(:account, domain: domain)
|
||||
Fabricate :follow, target_account: account, account: Fabricate(:account, domain: domain)
|
||||
end
|
||||
|
||||
it_behaves_like 'forbidden for wrong scope', 'write:statuses'
|
||||
|
||||
it 'returns http success and follower counts' do
|
||||
subject
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body)
|
||||
.to include(followers_count: 1)
|
||||
.and include(following_count: 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,55 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'API Web Push Subscriptions' do
|
||||
describe 'DELETE /api/web/push_subscriptions/:id' do
|
||||
subject { delete api_web_push_subscription_path(token) }
|
||||
|
||||
context 'when the subscription exists' do
|
||||
let!(:web_push_subscription) do
|
||||
Fabricate(:web_push_subscription)
|
||||
end
|
||||
let(:token) do
|
||||
web_push_subscription.generate_token_for(:unsubscribe)
|
||||
end
|
||||
|
||||
it 'deletes the subscription' do
|
||||
expect { subject }
|
||||
.to change(Web::PushSubscription, :count).by(-1)
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the subscription does not exist' do
|
||||
let(:web_push_subscription) do
|
||||
Fabricate(:web_push_subscription)
|
||||
end
|
||||
let(:token) do
|
||||
web_push_subscription.generate_token_for(:unsubscribe)
|
||||
end
|
||||
|
||||
before do
|
||||
token # memoize before destroying the record
|
||||
web_push_subscription.destroy!
|
||||
end
|
||||
|
||||
it 'does nothing' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the token is invalid' do
|
||||
let(:token) { 'invalid--invalid' }
|
||||
|
||||
it 'does nothing' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user