1
0
Fork 0
forked from gitea/nas

Add: #600 NGルール (#602)

* Wip

* Wip

* Wip: History

* Wip: テストコード作成

* Fix test

* Wip

* Wip

* Wip

* Fix test

* Wip

* Wip

* Wip

* Wip

* なんとか完成、これから動作確認

* spell miss

* Change ng rule timings

* Fix test

* Wip

* Fix test

* Wip

* Fix form

* 表示まわりの改善
This commit is contained in:
KMY(雪あすか) 2024-02-26 17:45:41 +09:00 committed by GitHub
parent 0779c748a6
commit 7d96d5828e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
56 changed files with 2062 additions and 42 deletions

View file

@ -55,6 +55,32 @@ RSpec.describe ActivityPub::Activity::Like do
end
end
context 'when ng rule is existing' do
subject { described_class.new(json, sender) }
context 'when ng rule is match' do
before do
Fabricate(:ng_rule, account_domain: 'example.com', reaction_type: ['favourite'])
subject.perform
end
it 'does not create a reblog by sender of status' do
expect(sender.favourited?(status)).to be false
end
end
context 'when ng rule is not match' do
before do
Fabricate(:ng_rule, account_domain: 'foo.bar', reaction_type: ['favourite'])
subject.perform
end
it 'creates a reblog by sender of status' do
expect(sender.favourited?(status)).to be true
end
end
end
describe '#perform when receive emoji reaction' do
subject do
described_class.new(json, sender).perform
@ -592,6 +618,30 @@ RSpec.describe ActivityPub::Activity::Like do
end
end
end
context 'when ng rule is existing' do
let(:content) { '😀' }
context 'when ng rule is match' do
before do
Fabricate(:ng_rule, account_domain: 'example.com', reaction_type: ['emoji_reaction'])
end
it 'does not create a reblog by sender of status' do
expect(subject.count).to eq 0
end
end
context 'when ng rule is not match' do
before do
Fabricate(:ng_rule, account_domain: 'foo.bar', reaction_type: ['emoji_reaction'])
end
it 'creates a reblog by sender of status' do
expect(subject.count).to eq 1
end
end
end
end
describe '#perform when rejecting favourite domain block' do