Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 27d7ddf

Browse files
committed
lint and address limit
1 parent 9df12aa commit 27d7ddf

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

db/migrate/20241206051225_add_ai_spam_logs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def change
77
t.bigint :ai_api_audit_log_id
88
t.bigint :reviewable_id
99
t.boolean :is_spam, null: false
10-
t.text :payload, null: false, default: "", limit: 20_000
10+
t.string :payload, null: false, default: "", limit: 20_000
1111
t.timestamps
1212
end
1313

lib/ai_moderation/entry_point.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ def inject_into(plugin)
99
plugin.on(:post_process_cooked) { |_doc, post| SpamScanner.after_cooked_post(post) }
1010

1111
plugin.on(:site_setting_changed) do |name, _old_value, new_value|
12-
if name == :ai_spam_detection_enabled && new_value
13-
SpamScanner.ensure_flagging_user!
14-
end
12+
SpamScanner.ensure_flagging_user! if name == :ai_spam_detection_enabled && new_value
1513
end
1614
end
1715
end

lib/ai_moderation/spam_scanner.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,13 @@ def self.hide_posts_and_topics(user)
283283
Post.hidden_reasons[:new_user_spam_threshold_reached],
284284
],
285285
)
286-
topic_ids = Post
287-
.where(user_id: user.id, post_number: 1)
288-
.where("created_at > ?", 24.hours.ago)
289-
.select(:topic_id)
290-
291-
Topic
292-
.where(id: topic_ids)
293-
.update_all(visible: false)
286+
topic_ids =
287+
Post
288+
.where(user_id: user.id, post_number: 1)
289+
.where("created_at > ?", 24.hours.ago)
290+
.select(:topic_id)
294291

292+
Topic.where(id: topic_ids).update_all(visible: false)
295293
end
296294
end
297295
end

spec/lib/modules/ai_moderation/spam_scanner_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@
160160
before { Jobs.run_immediately! }
161161

162162
it "Correctly handles spam scanning" do
163-
164163
expect(described_class.flagging_user.id).not_to eq(Discourse.system_user.id)
165164

166165
# flag post for scanning

0 commit comments

Comments
 (0)