mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2025-01-18 12:44:04 +01:00
Merge commit 'c20824fa760061cf8fba258dbbd6b0a615df4749' into glitch-soc/merge-upstream
This commit is contained in:
commit
ad71a8d1f7
10 changed files with 66 additions and 29 deletions
2
.github/workflows/lint-haml.yml
vendored
2
.github/workflows/lint-haml.yml
vendored
|
@ -43,4 +43,4 @@ jobs:
|
|||
- name: Run haml-lint
|
||||
run: |
|
||||
echo "::add-matcher::.github/workflows/haml-lint-problem-matcher.json"
|
||||
bin/haml-lint --reporter github
|
||||
bin/haml-lint --parallel --reporter github
|
||||
|
|
|
@ -58,3 +58,6 @@ Style/TrailingCommaInArrayLiteral:
|
|||
|
||||
Style/TrailingCommaInHashLiteral:
|
||||
EnforcedStyleForMultiline: comma
|
||||
|
||||
Style/WordArray:
|
||||
MinSize: 3 # Override default of 2
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config --auto-gen-only-exclude --no-offense-counts --no-auto-gen-timestamp`
|
||||
# using RuboCop version 1.69.2.
|
||||
# using RuboCop version 1.70.0.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
|
@ -103,10 +103,3 @@ Style/RedundantConstantBase:
|
|||
Exclude:
|
||||
- 'config/environments/production.rb'
|
||||
- 'config/initializers/sidekiq.rb'
|
||||
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: WordRegex.
|
||||
# SupportedStyles: percent, brackets
|
||||
Style/WordArray:
|
||||
EnforcedStyle: percent
|
||||
MinSize: 3
|
||||
|
|
|
@ -529,7 +529,7 @@ GEM
|
|||
opentelemetry-instrumentation-rack (0.25.0)
|
||||
opentelemetry-api (~> 1.0)
|
||||
opentelemetry-instrumentation-base (~> 0.22.1)
|
||||
opentelemetry-instrumentation-rails (0.34.0)
|
||||
opentelemetry-instrumentation-rails (0.34.1)
|
||||
opentelemetry-api (~> 1.0)
|
||||
opentelemetry-instrumentation-action_mailer (~> 0.3.0)
|
||||
opentelemetry-instrumentation-action_pack (~> 0.10.0)
|
||||
|
@ -538,6 +538,7 @@ GEM
|
|||
opentelemetry-instrumentation-active_record (~> 0.8.0)
|
||||
opentelemetry-instrumentation-active_support (~> 0.7.0)
|
||||
opentelemetry-instrumentation-base (~> 0.22.1)
|
||||
opentelemetry-instrumentation-concurrent_ruby (~> 0.21.4)
|
||||
opentelemetry-instrumentation-redis (0.25.7)
|
||||
opentelemetry-api (~> 1.0)
|
||||
opentelemetry-instrumentation-base (~> 0.22.1)
|
||||
|
@ -793,7 +794,7 @@ GEM
|
|||
simplecov-html (0.13.1)
|
||||
simplecov-lcov (0.8.0)
|
||||
simplecov_json_formatter (0.1.4)
|
||||
stackprof (0.2.26)
|
||||
stackprof (0.2.27)
|
||||
stoplight (4.1.0)
|
||||
redlock (~> 1.0)
|
||||
stringio (3.1.2)
|
||||
|
|
|
@ -126,6 +126,8 @@ class Account < ApplicationRecord
|
|||
validates :uri, absence: true
|
||||
end
|
||||
|
||||
validates :domain, exclusion: { in: [''] }
|
||||
|
||||
normalizes :username, with: ->(username) { username.squish }
|
||||
|
||||
scope :without_internal, -> { where(id: 1...) }
|
||||
|
@ -187,7 +189,7 @@ class Account < ApplicationRecord
|
|||
end
|
||||
|
||||
def remote?
|
||||
domain.present?
|
||||
!domain.nil?
|
||||
end
|
||||
|
||||
def moved?
|
||||
|
|
|
@ -3,7 +3,7 @@ const config = {
|
|||
'Gemfile|*.{rb,ruby,ru,rake}': 'bin/rubocop --force-exclusion -a',
|
||||
'*.{js,jsx,ts,tsx}': 'eslint --fix',
|
||||
'*.{css,scss}': 'stylelint --fix',
|
||||
'*.haml': 'bin/haml-lint -a',
|
||||
'*.haml': 'bin/haml-lint -a --parallel',
|
||||
'**/*.ts?(x)': () => 'tsc -p tsconfig.json --noEmit',
|
||||
};
|
||||
|
||||
|
|
|
@ -49,14 +49,16 @@ RSpec.describe Account do
|
|||
end
|
||||
|
||||
describe '#local?' do
|
||||
it 'returns true when domain is null' do
|
||||
account = Fabricate(:account, domain: nil)
|
||||
expect(account).to be_local
|
||||
context 'when the domain is null' do
|
||||
subject { Fabricate.build :account, domain: nil }
|
||||
|
||||
it { is_expected.to be_local }
|
||||
end
|
||||
|
||||
it 'returns false when domain is present' do
|
||||
account = Fabricate(:account, domain: 'foreign.tld')
|
||||
expect(account).to_not be_local
|
||||
context 'when the domain is present' do
|
||||
subject { Fabricate.build :account, domain: 'host.example' }
|
||||
|
||||
it { is_expected.to_not be_local }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -67,12 +69,6 @@ RSpec.describe Account do
|
|||
it { is_expected.to_not be_remote }
|
||||
end
|
||||
|
||||
context 'when the domain is blank' do
|
||||
subject { Fabricate.build :account, domain: '' }
|
||||
|
||||
it { is_expected.to_not be_remote }
|
||||
end
|
||||
|
||||
context 'when the domain is present' do
|
||||
subject { Fabricate.build :account, domain: 'host.example' }
|
||||
|
||||
|
@ -557,6 +553,8 @@ RSpec.describe Account do
|
|||
describe 'Validations' do
|
||||
it { is_expected.to validate_presence_of(:username) }
|
||||
|
||||
it { is_expected.to_not allow_value('').for(:domain) }
|
||||
|
||||
context 'when account is local' do
|
||||
subject { Fabricate.build :account, domain: nil }
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ RSpec.describe ImportService, :inline_jobs do
|
|||
subject { described_class.new }
|
||||
|
||||
let(:csv) { attachment_fixture('bookmark-imports.txt') }
|
||||
let(:local_account) { Fabricate(:account, username: 'foo', domain: '') }
|
||||
let(:local_account) { Fabricate(:account, username: 'foo', domain: nil) }
|
||||
let!(:remote_status) { Fabricate(:status, uri: 'https://example.com/statuses/1312') }
|
||||
let!(:direct_status) { Fabricate(:status, uri: 'https://example.com/statuses/direct', visibility: :direct) }
|
||||
|
||||
|
|
|
@ -5,9 +5,7 @@ require 'rails_helper'
|
|||
RSpec.describe 'Admin::EmailDomainBlocks' do
|
||||
let(:current_user) { Fabricate(:admin_user) }
|
||||
|
||||
before do
|
||||
sign_in current_user
|
||||
end
|
||||
before { sign_in current_user }
|
||||
|
||||
describe 'Performing batch updates' do
|
||||
before do
|
||||
|
@ -22,6 +20,27 @@ RSpec.describe 'Admin::EmailDomainBlocks' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with a selected block' do
|
||||
let!(:email_domain_block) { Fabricate :email_domain_block }
|
||||
|
||||
it 'deletes the block' do
|
||||
visit admin_email_domain_blocks_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_delete }
|
||||
.to change(EmailDomainBlock, :count).by(-1)
|
||||
expect { email_domain_block.reload }
|
||||
.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
def check_item
|
||||
within '.batch-table__row' do
|
||||
find('input[type=checkbox]').check
|
||||
end
|
||||
end
|
||||
|
||||
def button_for_delete
|
||||
I18n.t('admin.email_domain_blocks.delete')
|
||||
end
|
||||
|
|
|
@ -48,6 +48,27 @@ RSpec.describe 'Admin::IpBlocks' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with a selected block' do
|
||||
let!(:ip_block) { Fabricate :ip_block }
|
||||
|
||||
it 'deletes the block' do
|
||||
visit admin_ip_blocks_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_delete }
|
||||
.to change(IpBlock, :count).by(-1)
|
||||
expect { ip_block.reload }
|
||||
.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
def check_item
|
||||
within '.batch-table__row' do
|
||||
find('input[type=checkbox]').check
|
||||
end
|
||||
end
|
||||
|
||||
def button_for_delete
|
||||
I18n.t('admin.ip_blocks.delete')
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue