generated from discourse/discourse-plugin-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: link correctly to filters to assist in debugging spam (#1031)
- Add spam_score_type to AiSpamSerializer for better integration with reviewables. - Introduce a custom filter for detecting AI spam false negatives in moderation workflows. - Refactor spam report generation to improve identification of false negatives. - Add tests to verify the custom filter and its behavior. - Introduce links for all spam counts in report
- Loading branch information
1 parent
90ce942
commit fae2d5f
Showing
5 changed files
with
118 additions
and
28 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
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
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,47 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe ReviewablesController do | ||
fab!(:post1) { Fabricate(:post) } | ||
fab!(:post2) { Fabricate(:post) } | ||
fab!(:admin) | ||
fab!(:llm_model) | ||
|
||
fab!(:reviewable) do | ||
Reviewable.create!( | ||
target: post1, | ||
topic: post2.topic, | ||
type: ReviewablePost, | ||
created_by: admin, | ||
status: Reviewable.statuses[:pending], | ||
) | ||
end | ||
|
||
fab!(:reviewable2) do | ||
Reviewable.create!( | ||
target: post2, | ||
topic: post2.topic, | ||
type: ReviewablePost, | ||
created_by: admin, | ||
status: Reviewable.statuses[:pending], | ||
) | ||
end | ||
|
||
fab!(:ai_spam_log_missed) do | ||
AiSpamLog.create!(is_spam: false, post_id: post1.id, llm_model_id: llm_model.id) | ||
end | ||
# we amend the behavior with a custom filter so we need to confirm it works | ||
it "properly applies custom filter" do | ||
sign_in(admin) | ||
|
||
get '/review.json?additional_filters={"ai_spam_false_negative":true}' | ||
expect(response.status).to eq(200) | ||
|
||
json = JSON.parse(response.body) | ||
expect(json["reviewables"].length).to eq(1) | ||
|
||
get "/review.json" | ||
expect(response.status).to eq(200) | ||
json = JSON.parse(response.body) | ||
expect(json["reviewables"].length).to eq(2) | ||
end | ||
end |