Add: メンション数上限 (#565)

* Add: メンション数上限

* Fix test
This commit is contained in:
KMY(雪あすか) 2024-02-17 09:50:06 +09:00 committed by GitHub
parent 5424567aef
commit 7411941885
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 94 additions and 5 deletions

View file

@ -740,6 +740,29 @@ RSpec.describe PostStatusService, type: :service do
expect { subject.call(account, text: text) }.to raise_error Mastodon::ValidationError
end
it 'using mentions under limit' do
Fabricate(:account, username: 'a')
Fabricate(:account, username: 'b')
account = Fabricate(:account)
text = '@a @b'
Form::AdminSettings.new(post_mentions_max: 2).save
status = subject.call(account, text: text)
expect(status).to be_persisted
expect(status.text).to eq text
end
it 'using mentions over limit' do
Fabricate(:account, username: 'a')
Fabricate(:account, username: 'b')
account = Fabricate(:account)
text = '@a @b'
Form::AdminSettings.new(post_mentions_max: 1).save
expect { subject.call(account, text: text) }.to raise_error Mastodon::ValidationError
end
end
def create_status_with_options(**options)