Change: #647 NGワードの入力フォーム (#663)

* Change: #647 NGワードの入力フォーム

* Wip: 画面改造

* テストコード、画面

* Fix: 複数の問題
This commit is contained in:
KMY(雪あすか) 2024-03-26 08:44:16 +09:00 committed by GitHub
parent 0d2b415e26
commit 95ab1f729c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 526 additions and 172 deletions

View file

@ -425,7 +425,7 @@ RSpec.describe ActivityPub::ProcessAccountService do
end
it 'creates account when ng word is not set' do
Setting.ng_words = ['Amazon']
Fabricate(:ng_word, keyword: 'Amazon', stranger: false)
subject
expect(account.reload.display_name).to eq 'Ohagi'
@ -434,7 +434,7 @@ RSpec.describe ActivityPub::ProcessAccountService do
end
it 'does not create account when ng word is set' do
Setting.ng_words = ['Ohagi']
Fabricate(:ng_word, keyword: 'Ohagi', stranger: false)
subject
expect(account.reload.display_name).to_not eq 'Ohagi'

View file

@ -515,7 +515,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
let(:content) { 'ng word test' }
it 'update status' do
Form::AdminSettings.new(ng_words: 'test').save
Fabricate(:ng_word, keyword: 'test', stranger: false)
subject.call(status, json, json)
expect(status.reload.text).to_not eq content
@ -526,7 +526,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
let(:content) { 'ng word aiueo' }
it 'update status' do
Form::AdminSettings.new(ng_words: 'test').save
Fabricate(:ng_word, keyword: 'test', stranger: false)
subject.call(status, json, json)
expect(status.reload.text).to eq content
@ -542,7 +542,8 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
let(:content) { 'ng word test' }
it 'update status' do
Form::AdminSettings.new(ng_words_for_stranger_mention: 'test', stranger_mention_from_local_ng: '1').save
Form::AdminSettings.new(stranger_mention_from_local_ng: '1').save
Fabricate(:ng_word, keyword: 'test')
subject.call(status, json, json)
expect(status.reload.text).to_not eq content
@ -550,7 +551,8 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
end
it 'update status when following' do
Form::AdminSettings.new(ng_words_for_stranger_mention: 'test', stranger_mention_from_local_ng: '1').save
Form::AdminSettings.new(stranger_mention_from_local_ng: '1').save
Fabricate(:ng_word, keyword: 'test')
alice.follow!(status.account)
subject.call(status, json, json)
@ -568,7 +570,8 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
let(:content) { 'ng word test' }
it 'update status' do
Form::AdminSettings.new(ng_words_for_stranger_mention: 'test', stranger_mention_from_local_ng: '0').save
Form::AdminSettings.new(stranger_mention_from_local_ng: '0').save
Fabricate(:ng_word, keyword: 'test')
subject.call(status, json, json)
expect(status.reload.text).to_not eq content
@ -589,7 +592,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
end
it 'update status' do
Form::AdminSettings.new(ng_words_for_stranger_mention: 'test').save
Fabricate(:ng_word, keyword: 'test')
subject.call(status, json, json)
expect(status.reload.text).to eq content
@ -607,7 +610,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
let(:thread) { Fabricate(:status, account: alice) }
it 'update status' do
Form::AdminSettings.new(ng_words_for_stranger_mention: 'test').save
Fabricate(:ng_word, keyword: 'test')
subject.call(status, json, json)
expect(status.reload.text).to_not eq content
@ -629,7 +632,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
end
it 'update status' do
Form::AdminSettings.new(ng_words_for_stranger_mention: 'test').save
Fabricate(:ng_word, keyword: 'test')
subject.call(status, json, json)
expect(status.reload.text).to eq content
@ -658,7 +661,8 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
let(:content) { 'ng word test' }
it 'update status' do
Form::AdminSettings.new(ng_words_for_stranger_mention: 'test', stranger_mention_from_local_ng: '1').save
Form::AdminSettings.new(stranger_mention_from_local_ng: '1').save
Fabricate(:ng_word, keyword: 'test')
subject.call(status, json, json)
expect(status.reload.text).to_not eq content
@ -671,7 +675,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
end
it 'update status' do
Form::AdminSettings.new(ng_words_for_stranger_mention: 'test').save
Fabricate(:ng_word, keyword: 'test')
subject.call(status, json, json)
expect(status.reload.text).to eq content