Add: #605 リモート投稿に適用するセンシティブワード設定 (#612)

This commit is contained in:
KMY(雪あすか) 2024-02-27 10:14:42 +09:00 committed by GitHub
parent 7d96d5828e
commit 9dd11117db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 149 additions and 11 deletions

View file

@ -2087,6 +2087,45 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'when sensitive word is set' do
let(:custom_before) { true }
let(:content) { 'Lorem ipsum' }
let(:sensitive_words_all) { 'hello' }
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
type: 'Note',
content: content,
to: 'https://www.w3.org/ns/activitystreams#Public',
}
end
before do
Form::AdminSettings.new(sensitive_words_all: sensitive_words_all, sensitive_words: 'ipsum').save
subject.perform
end
context 'when not contains sensitive words' do
it 'creates status' do
status = sender.statuses.first
expect(status).to_not be_nil
expect(status.spoiler_text).to eq ''
end
end
context 'when contains sensitive words' do
let(:content) { 'hello world' }
it 'creates status' do
status = sender.statuses.first
expect(status).to_not be_nil
expect(status.spoiler_text).to_not eq ''
end
end
end
context 'when hashtags limit is set' do
let(:post_hash_tags_max) { 2 }
let(:custom_before) { true }