Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: Perform a toxicity check after a post gets edited.
We need to check for toxicity after editing to prevent users from posting toxic content after the original post gets created.
- Loading branch information
1 parent
1885cae
commit fcaf0f5
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
describe 'scanning posts using the porspective API' do | ||
|
||
before do | ||
SiteSetting.perspective_enabled = true | ||
end | ||
|
||
describe 'when a post is edited' do | ||
let(:post) { Fabricate(:post) } | ||
|
||
it 'queues the post for a toxicity check' do | ||
expect { | ||
PostRevisor.new(post).revise!( | ||
post.user, | ||
{ raw: 'updated body' } | ||
) | ||
}.to change(Jobs::FlagToxicPost.jobs, :size).by(1) | ||
end | ||
end | ||
end |