Merge commit '2ce0b666a139726dc406e6c1887728553b947e59' into glitch-soc/merge-upstream

Conflicts:
- `config/webpack/generateLocalePacks.js`:
  A dependency update changed how functions are imported.
  Also, some linting fixes not applicable to glitch-soc.
This commit is contained in:
Claire
2023-05-25 20:43:25 +02:00
128 changed files with 1393 additions and 560 deletions

View File

@@ -14,9 +14,7 @@ RSpec.describe ActivityPub::FollowersSynchronizationsController do
follower_2.follow!(account)
follower_3.follow!(account)
follower_4.follow!(account)
end
before do
allow(controller).to receive(:signed_request_actor).and_return(remote_account)
end

View File

@@ -27,9 +27,7 @@ RSpec.describe ActivityPub::OutboxesController do
Fabricate(:status, account: account, visibility: :private)
Fabricate(:status, account: account, visibility: :direct)
Fabricate(:status, account: account, visibility: :limited)
end
before do
allow(controller).to receive(:signed_request_actor).and_return(remote_account)
end

View File

@@ -5,16 +5,16 @@ require 'rails_helper'
RSpec.describe Admin::Disputes::AppealsController do
render_views
before { sign_in current_user, scope: :user }
before do
sign_in current_user, scope: :user
target_account.suspend!
end
let(:target_account) { Fabricate(:account) }
let(:strike) { Fabricate(:account_warning, target_account: target_account, action: :suspend) }
let(:appeal) { Fabricate(:appeal, strike: strike, account: target_account) }
before do
target_account.suspend!
end
describe 'POST #approve' do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@@ -146,13 +146,13 @@ describe Admin::Reports::ActionsController do
end
end
context 'with Action as submit button' do
context 'with action as submit button' do
subject { post :create, params: common_params.merge({ action => '' }) }
it_behaves_like 'all action types'
end
context 'with Action as submit button' do
context 'with moderation action as an extra field' do
subject { post :create, params: common_params.merge({ moderation_action: action }) }
it_behaves_like 'all action types'

View File

@@ -20,4 +20,52 @@ describe Api::V1::Admin::CanonicalEmailBlocksController do
expect(response).to have_http_status(200)
end
end
describe 'POST #test' do
context 'when required email is not provided' do
it 'returns http bad request' do
post :test
expect(response).to have_http_status(400)
end
end
context 'when required email is provided' do
let(:params) { { email: 'example@email.com' } }
context 'when there is a matching canonical email block' do
let!(:canonical_email_block) { CanonicalEmailBlock.create(params) }
it 'returns http success' do
post :test, params: params
expect(response).to have_http_status(200)
end
it 'returns expected canonical email hash' do
post :test, params: params
json = body_as_json
expect(json[0][:canonical_email_hash]).to eq(canonical_email_block.canonical_email_hash)
end
end
context 'when there is no matching canonical email block' do
it 'returns http success' do
post :test, params: params
expect(response).to have_http_status(200)
end
it 'returns an empty list' do
post :test, params: params
json = body_as_json
expect(json).to be_empty
end
end
end
end
end

View File

@@ -97,10 +97,12 @@ RSpec.describe Auth::RegistrationsController do
end
describe 'POST #create' do
let(:accept_language) { Rails.application.config.i18n.available_locales.sample.to_s }
let(:accept_language) { 'de' }
before do
session[:registration_form_time] = 5.seconds.ago
request.env['devise.mapping'] = Devise.mappings[:user]
end
around do |example|
@@ -109,8 +111,6 @@ RSpec.describe Auth::RegistrationsController do
end
end
before { request.env['devise.mapping'] = Devise.mappings[:user] }
context do
subject do
Setting.registrations_mode = 'open'