* Change: #647 NGワードの入力フォーム * Wip: 画面改造 * テストコード、画面 * Fix: 複数の問題
This commit is contained in:
parent
0d2b415e26
commit
95ab1f729c
33 changed files with 526 additions and 172 deletions
5
spec/fabricators/ng_word_fabricator.rb
Normal file
5
spec/fabricators/ng_word_fabricator.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Fabricator(:ng_word) do
|
||||
keyword { sequence(:keyword) { |i| "keyword_#{i}" } }
|
||||
end
|
|
@ -1755,8 +1755,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
let(:custom_before) { true }
|
||||
let(:custom_before_sub) { false }
|
||||
let(:content) { 'Lorem ipsum' }
|
||||
let(:ng_words) { 'hello' }
|
||||
let(:ng_words_for_stranger_mention) { 'ohagi' }
|
||||
let(:ng_word) { 'hello' }
|
||||
let(:ng_word_for_stranger_mention) { 'ohagi' }
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
|
@ -1767,7 +1767,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
end
|
||||
|
||||
before do
|
||||
Form::AdminSettings.new(ng_words: ng_words, ng_words_for_stranger_mention: ng_words_for_stranger_mention).save
|
||||
Fabricate(:ng_word, keyword: ng_word, stranger: false)
|
||||
Fabricate(:ng_word, keyword: ng_word_for_stranger_mention, stranger: true)
|
||||
subject.perform unless custom_before_sub
|
||||
end
|
||||
|
||||
|
@ -1777,11 +1778,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
it 'creates status' do
|
||||
expect(sender.statuses.first).to_not be_nil
|
||||
end
|
||||
|
||||
it 'does not record history' do
|
||||
history = NgwordHistory.find_by(uri: object_json[:id])
|
||||
expect(history).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when hit ng words' do
|
||||
|
@ -1796,7 +1792,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
expect(history).to_not be_nil
|
||||
expect(history.status_blocked?).to be true
|
||||
expect(history.within_ng_words?).to be true
|
||||
expect(history.keyword).to eq ng_words
|
||||
expect(history.keyword).to eq ng_word
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1813,11 +1809,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
it 'creates status' do
|
||||
expect(sender.statuses.first).to be_nil
|
||||
end
|
||||
|
||||
it 'records history' do
|
||||
history = NgwordHistory.find_by(uri: object_json[:id])
|
||||
expect(history).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when mention from tags' do
|
||||
|
@ -1844,11 +1835,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
it 'creates status' do
|
||||
expect(sender.statuses.first).to_not be_nil
|
||||
end
|
||||
|
||||
it 'does not record history' do
|
||||
history = NgwordHistory.find_by(uri: object_json[:id])
|
||||
expect(history).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'with using ng words for stranger' do
|
||||
|
@ -1857,14 +1843,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
it 'creates status' do
|
||||
expect(sender.statuses.first).to be_nil
|
||||
end
|
||||
|
||||
it 'records history' do
|
||||
history = NgwordHistory.find_by(uri: object_json[:id])
|
||||
expect(history).to_not be_nil
|
||||
expect(history.status_blocked?).to be true
|
||||
expect(history.within_ng_words_for_stranger_mention?).to be true
|
||||
expect(history.keyword).to eq ng_words_for_stranger_mention
|
||||
end
|
||||
end
|
||||
|
||||
context 'with using ng words for stranger but receiver is following him' do
|
||||
|
@ -1879,11 +1857,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
it 'creates status' do
|
||||
expect(sender.statuses.first).to_not be_nil
|
||||
end
|
||||
|
||||
it 'does not record history' do
|
||||
history = NgwordHistory.find_by(uri: object_json[:id])
|
||||
expect(history).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'with using ng words for stranger but multiple receivers are partically following him' do
|
||||
|
@ -1917,14 +1890,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
it 'creates status' do
|
||||
expect(sender.statuses.first).to be_nil
|
||||
end
|
||||
|
||||
it 'records history' do
|
||||
history = NgwordHistory.find_by(uri: object_json[:id])
|
||||
expect(history).to_not be_nil
|
||||
expect(history.status_blocked?).to be true
|
||||
expect(history.within_ng_words_for_stranger_mention?).to be true
|
||||
expect(history.keyword).to eq ng_words_for_stranger_mention
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1946,14 +1911,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
it 'creates status' do
|
||||
expect(sender.statuses.first).to be_nil
|
||||
end
|
||||
|
||||
it 'records history' do
|
||||
history = NgwordHistory.find_by(uri: object_json[:id])
|
||||
expect(history).to_not be_nil
|
||||
expect(history.status_blocked?).to be true
|
||||
expect(history.within_ng_words_for_stranger_mention?).to be true
|
||||
expect(history.keyword).to eq ng_words_for_stranger_mention
|
||||
end
|
||||
end
|
||||
|
||||
context 'with following' do
|
||||
|
@ -1967,11 +1924,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
it 'creates status' do
|
||||
expect(sender.statuses.first).to_not be_nil
|
||||
end
|
||||
|
||||
it 'does not record history' do
|
||||
history = NgwordHistory.find_by(uri: object_json[:id])
|
||||
expect(history).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
77
spec/models/admin/ng_word_spec.rb
Normal file
77
spec/models/admin/ng_word_spec.rb
Normal file
|
@ -0,0 +1,77 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::NgWord do
|
||||
describe '#reject?' do
|
||||
subject { described_class.reject?(text, stranger: stranger, uri: uri, target_type: :status) }
|
||||
|
||||
let(:text) { 'This is a ohagi.' }
|
||||
let(:stranger) { false }
|
||||
let(:uri) { nil }
|
||||
|
||||
context 'when general post' do
|
||||
it 'ng word hits' do
|
||||
Fabricate(:ng_word, keyword: 'ohagi', stranger: false)
|
||||
expect(subject).to be true
|
||||
end
|
||||
|
||||
it 'else ng word does not hit' do
|
||||
Fabricate(:ng_word, keyword: 'angry', stranger: false)
|
||||
expect(subject).to be false
|
||||
end
|
||||
|
||||
it 'stranger word does not hit' do
|
||||
Fabricate(:ng_word, keyword: 'ohagi', stranger: true)
|
||||
expect(subject).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context 'when mention to stranger' do
|
||||
let(:stranger) { true }
|
||||
|
||||
it 'ng word hits' do
|
||||
Fabricate(:ng_word, keyword: 'ohagi', stranger: true)
|
||||
expect(subject).to be true
|
||||
end
|
||||
|
||||
it 'else ng word does not hit' do
|
||||
Fabricate(:ng_word, keyword: 'angry', stranger: true)
|
||||
expect(subject).to be false
|
||||
end
|
||||
|
||||
it 'general word hits' do
|
||||
Fabricate(:ng_word, keyword: 'ohagi', stranger: false)
|
||||
expect(subject).to be true
|
||||
end
|
||||
end
|
||||
|
||||
context 'when remote post' do
|
||||
let(:uri) { 'https://example.com/note' }
|
||||
|
||||
it 'ng word hits' do
|
||||
Fabricate(:ng_word, keyword: 'ohagi', stranger: false)
|
||||
expect(subject).to be true
|
||||
expect(NgwordHistory.find_by(uri: uri)).to_not be_nil
|
||||
end
|
||||
|
||||
it 'else ng word does not hit' do
|
||||
Fabricate(:ng_word, keyword: 'angry', stranger: false)
|
||||
expect(subject).to be false
|
||||
expect(NgwordHistory.find_by(uri: uri)).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when using regexp' do
|
||||
it 'regexp hits with enable' do
|
||||
Fabricate(:ng_word, keyword: 'oha[ghi]i', regexp: true, stranger: false)
|
||||
expect(subject).to be true
|
||||
end
|
||||
|
||||
it 'regexp does not hit without enable' do
|
||||
Fabricate(:ng_word, keyword: 'oha[ghi]i', regexp: false, stranger: false)
|
||||
expect(subject).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -613,7 +613,7 @@ RSpec.describe PostStatusService do
|
|||
it 'hit ng words' do
|
||||
account = Fabricate(:account)
|
||||
text = 'ng word test'
|
||||
Form::AdminSettings.new(ng_words: 'test').save
|
||||
Fabricate(:ng_word, keyword: 'test', stranger: false)
|
||||
|
||||
expect { subject.call(account, text: text) }.to raise_error(Mastodon::ValidationError)
|
||||
end
|
||||
|
@ -621,7 +621,7 @@ RSpec.describe PostStatusService do
|
|||
it 'not hit ng words' do
|
||||
account = Fabricate(:account)
|
||||
text = 'ng word aiueo'
|
||||
Form::AdminSettings.new(ng_words: 'test').save
|
||||
Fabricate(:ng_word, keyword: 'test', stranger: false)
|
||||
|
||||
status = subject.call(account, text: text)
|
||||
|
||||
|
@ -633,7 +633,8 @@ RSpec.describe PostStatusService do
|
|||
account = Fabricate(:account)
|
||||
Fabricate(:account, username: 'ohagi', domain: nil)
|
||||
text = 'ng word test @ohagi'
|
||||
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', stranger: true)
|
||||
|
||||
expect { subject.call(account, text: text) }.to raise_error(Mastodon::ValidationError)
|
||||
end
|
||||
|
@ -642,7 +643,8 @@ RSpec.describe PostStatusService do
|
|||
account = Fabricate(:account)
|
||||
Fabricate(:account, username: 'ohagi', domain: nil)
|
||||
text = 'ng word test @ohagi'
|
||||
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', stranger: true)
|
||||
|
||||
status = subject.call(account, text: text)
|
||||
|
||||
|
@ -655,7 +657,8 @@ RSpec.describe PostStatusService do
|
|||
mentioned = Fabricate(:account, username: 'ohagi', domain: nil)
|
||||
mentioned.follow!(account)
|
||||
text = 'ng word test @ohagi'
|
||||
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', stranger: true)
|
||||
|
||||
status = subject.call(account, text: text)
|
||||
|
||||
|
@ -666,7 +669,8 @@ RSpec.describe PostStatusService do
|
|||
it 'hit ng words for reply' do
|
||||
account = Fabricate(:account)
|
||||
text = 'ng word test'
|
||||
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', stranger: true)
|
||||
|
||||
expect { subject.call(account, text: text, thread: Fabricate(:status)) }.to raise_error(Mastodon::ValidationError)
|
||||
end
|
||||
|
@ -676,7 +680,8 @@ RSpec.describe PostStatusService do
|
|||
mentioned = Fabricate(:account, username: 'ohagi', domain: nil)
|
||||
mentioned.follow!(account)
|
||||
text = 'ng word test'
|
||||
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', stranger: true)
|
||||
|
||||
status = subject.call(account, text: text)
|
||||
|
||||
|
@ -702,7 +707,8 @@ RSpec.describe PostStatusService do
|
|||
account = Fabricate(:account)
|
||||
Fabricate(:account, username: 'ohagi', domain: nil)
|
||||
text = "ng word test BT: #{ActivityPub::TagManager.instance.uri_for(target_status)}"
|
||||
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', stranger: true)
|
||||
|
||||
expect { subject.call(account, text: text) }.to raise_error(Mastodon::ValidationError)
|
||||
end
|
||||
|
@ -713,7 +719,8 @@ RSpec.describe PostStatusService do
|
|||
target_status.account.follow!(account)
|
||||
Fabricate(:account, username: 'ohagi', domain: nil)
|
||||
text = "ng word test BT: #{ActivityPub::TagManager.instance.uri_for(target_status)}"
|
||||
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', stranger: true)
|
||||
|
||||
status = subject.call(account, text: text)
|
||||
|
||||
|
|
|
@ -272,14 +272,14 @@ RSpec.describe UpdateStatusService do
|
|||
|
||||
it 'hit ng words' do
|
||||
text = 'ng word test'
|
||||
Form::AdminSettings.new(ng_words: 'test').save
|
||||
Fabricate(:ng_word, keyword: 'test', stranger: false)
|
||||
|
||||
expect { subject.call(status, status.account_id, text: text) }.to raise_error(Mastodon::ValidationError)
|
||||
end
|
||||
|
||||
it 'not hit ng words' do
|
||||
text = 'ng word aiueo'
|
||||
Form::AdminSettings.new(ng_words: 'test').save
|
||||
Fabricate(:ng_word, keyword: 'test', stranger: false)
|
||||
|
||||
status2 = subject.call(status, status.account_id, text: text)
|
||||
|
||||
|
@ -290,7 +290,8 @@ RSpec.describe UpdateStatusService do
|
|||
it 'hit ng words for mention' do
|
||||
Fabricate(:account, username: 'ohagi', domain: nil)
|
||||
text = 'ng word test @ohagi'
|
||||
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')
|
||||
|
||||
expect { subject.call(status, status.account_id, text: text) }.to raise_error(Mastodon::ValidationError)
|
||||
expect(status.reload.text).to_not eq text
|
||||
|
@ -300,7 +301,8 @@ RSpec.describe UpdateStatusService do
|
|||
it 'hit ng words for mention but local posts are not checked' do
|
||||
Fabricate(:account, username: 'ohagi', domain: nil)
|
||||
text = 'ng word test @ohagi'
|
||||
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')
|
||||
|
||||
status2 = subject.call(status, status.account_id, text: text)
|
||||
|
||||
|
@ -312,7 +314,8 @@ RSpec.describe UpdateStatusService do
|
|||
mentioned = Fabricate(:account, username: 'ohagi', domain: nil)
|
||||
mentioned.follow!(account)
|
||||
text = 'ng word test @ohagi'
|
||||
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')
|
||||
|
||||
status2 = subject.call(status, status.account_id, text: text)
|
||||
|
||||
|
@ -322,7 +325,8 @@ RSpec.describe UpdateStatusService do
|
|||
|
||||
it 'hit ng words for reply' do
|
||||
text = 'ng word test'
|
||||
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')
|
||||
|
||||
status = PostStatusService.new.call(account, text: 'hello', thread: Fabricate(:status))
|
||||
|
||||
|
@ -334,7 +338,8 @@ RSpec.describe UpdateStatusService do
|
|||
mentioned = Fabricate(:account, username: 'ohagi', domain: nil)
|
||||
mentioned.follow!(account)
|
||||
text = 'ng word test'
|
||||
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')
|
||||
|
||||
status = PostStatusService.new.call(account, text: 'hello', thread: Fabricate(:status, account: mentioned))
|
||||
|
||||
|
@ -360,7 +365,8 @@ RSpec.describe UpdateStatusService do
|
|||
it 'hit ng words for reference' do
|
||||
target_status = Fabricate(:status)
|
||||
text = "ng word test BT: #{ActivityPub::TagManager.instance.uri_for(target_status)}"
|
||||
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')
|
||||
|
||||
status = PostStatusService.new.call(account, text: 'hello')
|
||||
|
||||
|
@ -371,7 +377,8 @@ RSpec.describe UpdateStatusService do
|
|||
target_status = Fabricate(:status)
|
||||
target_status.account.follow!(status.account)
|
||||
text = "ng word test BT: #{ActivityPub::TagManager.instance.uri_for(target_status)}"
|
||||
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')
|
||||
|
||||
status = PostStatusService.new.call(account, text: 'hello')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue