Merge branch 'main' into glitch-soc/merge-upstream

Conflicts:
- `.prettierignore`:
  Upstream added a line at the end of the file, while glitch-soc had its own
  extra lines.
  Took upstream's change.
- `CONTRIBUTING.md`:
  We have our custom CONTRIBUTING.md quoting upstream. Upstream made changes.
  Ported upstream changes.
- `app/controllers/application_controller.rb`:
  Upstream made code style changes in a method that is entirely replaced
  in glitch-soc.
  Ignored the change.
- `app/models/account.rb`:
  Code style changes textually close to glitch-soc-specific changes.
  Ported upstream changes.
- `lib/sanitize_ext/sanitize_config.rb`:
  Upstream code style changes.
  Ignored them.
This commit is contained in:
Claire
2023-02-25 14:00:40 +01:00
946 changed files with 4147 additions and 3072 deletions

View File

@@ -4,16 +4,16 @@ require 'rails_helper'
RSpec.describe BlacklistedEmailValidator, type: :validator do
describe '#validate' do
subject { described_class.new.validate(user); errors }
let(:user) { double(email: 'info@mail.com', sign_up_ip: '1.2.3.4', errors: errors) }
let(:errors) { double(add: nil) }
before do
allow(user).to receive(:valid_invitation?) { false }
allow(user).to receive(:valid_invitation?).and_return(false)
allow_any_instance_of(described_class).to receive(:blocked_email_provider?) { blocked_email }
end
subject { described_class.new.validate(user); errors }
context 'when e-mail provider is blocked' do
let(:blocked_email) { true }
@@ -26,7 +26,7 @@ RSpec.describe BlacklistedEmailValidator, type: :validator do
let(:blocked_email) { false }
it 'does not add errors' do
expect(subject).not_to have_received(:add).with(:email, :blocked)
expect(subject).to_not have_received(:add).with(:email, :blocked)
end
context 'when canonical e-mail is blocked' do

View File

@@ -11,7 +11,7 @@ RSpec.describe DisallowedHashtagsValidator, type: :validator do
described_class.new.validate(status)
end
let(:status) { double(errors: errors, local?: local, reblog?: reblog, text: disallowed_tags.map { |x| '#' + x }.join(' ')) }
let(:status) { double(errors: errors, local?: local, reblog?: reblog, text: disallowed_tags.map { |x| "##{x}" }.join(' ')) }
let(:errors) { double(add: nil) }
context 'for a remote reblog' do
@@ -19,7 +19,7 @@ RSpec.describe DisallowedHashtagsValidator, type: :validator do
let(:reblog) { true }
it 'does not add errors' do
expect(errors).not_to have_received(:add).with(:text, any_args)
expect(errors).to_not have_received(:add).with(:text, any_args)
end
end
@@ -31,7 +31,7 @@ RSpec.describe DisallowedHashtagsValidator, type: :validator do
let(:disallowed_tags) { [] }
it 'does not add errors' do
expect(errors).not_to have_received(:add).with(:text, any_args)
expect(errors).to_not have_received(:add).with(:text, any_args)
end
end

View File

@@ -38,7 +38,7 @@ describe EmailMxValidator do
allow(Resolv::DNS).to receive(:open).and_yield(resolver)
subject.validate(user)
expect(user.errors).not_to have_received(:add)
expect(user.errors).to_not have_received(:add)
end
it 'adds an error if the email domain name contains empty labels' do

View File

@@ -22,7 +22,7 @@ RSpec.describe FollowLimitValidator, type: :validator do
let(:_nil) { true }
it 'not calls errors.add' do
expect(errors).not_to have_received(:add).with(:base, any_args)
expect(errors).to_not have_received(:add).with(:base, any_args)
end
end
@@ -43,7 +43,7 @@ RSpec.describe FollowLimitValidator, type: :validator do
let(:limit_reached) { false }
it 'not calls errors.add' do
expect(errors).not_to have_received(:add).with(:base, any_args)
expect(errors).to_not have_received(:add).with(:base, any_args)
end
end
end

View File

@@ -15,14 +15,14 @@ RSpec.describe PollValidator, type: :validator do
let(:expires_at) { 1.day.from_now }
it 'have no errors' do
expect(errors).not_to have_received(:add)
expect(errors).to_not have_received(:add)
end
context 'expires just 5 min ago' do
let(:expires_at) { 5.minutes.from_now }
it 'not calls errors add' do
expect(errors).not_to have_received(:add)
expect(errors).to_not have_received(:add)
end
end
end

View File

@@ -7,13 +7,13 @@ describe StatusLengthValidator do
it 'does not add errors onto remote statuses' do
status = double(local?: false)
subject.validate(status)
expect(status).not_to receive(:errors)
expect(status).to_not receive(:errors)
end
it 'does not add errors onto local reblogs' do
status = double(local?: false, reblog?: true)
subject.validate(status)
expect(status).not_to receive(:errors)
expect(status).to_not receive(:errors)
end
it 'adds an error when content warning is over MAX_CHARS characters' do

View File

@@ -17,7 +17,7 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do
let(:username) { nil }
it 'not calls errors.add' do
expect(errors).not_to have_received(:add).with(:username, any_args)
expect(errors).to_not have_received(:add).with(:username, any_args)
end
end
@@ -36,7 +36,7 @@ RSpec.describe UnreservedUsernameValidator, type: :validator do
let(:reserved_username) { false }
it 'not calls errors.add' do
expect(errors).not_to have_received(:add).with(:username, any_args)
expect(errors).to_not have_received(:add).with(:username, any_args)
end
end
end

View File

@@ -27,7 +27,7 @@ RSpec.describe URLValidator, type: :validator do
let(:compliant) { true }
it 'not calls errors.add' do
expect(errors).not_to have_received(:add).with(attribute, any_args)
expect(errors).to_not have_received(:add).with(attribute, any_args)
end
end
end