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:
Claire
2024-10-26 13:38:07 +02:00
78 changed files with 2363 additions and 2051 deletions

View File

@@ -0,0 +1,25 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'ActivityPub Likes' do
let(:account) { Fabricate(:account) }
let(:status) { Fabricate :status, account: account }
before { Fabricate :favourite, status: status }
describe 'GET /accounts/:account_username/statuses/:status_id/likes' do
it 'returns http success and activity json types and correct items count' do
get account_status_likes_path(account, status)
expect(response)
.to have_http_status(200)
expect(response.media_type)
.to eq 'application/activity+json'
expect(response.parsed_body)
.to include(type: 'Collection')
.and include(totalItems: 1)
end
end
end

View File

@@ -0,0 +1,25 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'ActivityPub Shares' do
let(:account) { Fabricate(:account) }
let(:status) { Fabricate :status, account: account }
before { Fabricate :status, reblog: status }
describe 'GET /accounts/:account_username/statuses/:status_id/shares' do
it 'returns http success and activity json types and correct items count' do
get account_status_shares_path(account, status)
expect(response)
.to have_http_status(200)
expect(response.media_type)
.to eq 'application/activity+json'
expect(response.parsed_body)
.to include(type: 'Collection')
.and include(totalItems: 1)
end
end
end

View File

@@ -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

View File

@@ -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