]> git.openstreetmap.org Git - rails.git/commitdiff
Merge pull request #5676 from tomhughes/spam-score-reports
authorAndy Allan <git@gravitystorm.co.uk>
Sun, 16 Feb 2025 11:51:52 +0000 (11:51 +0000)
committerGitHub <noreply@github.com>
Sun, 16 Feb 2025 11:51:52 +0000 (11:51 +0000)
Include spam reports on unresolved issues in the spam score

app/models/user.rb

index 16f733c882d30f002f3e7765c703d9bf7bf5254f..21fe2181b20abe9bfce7b196699d6fc368aca722 100644 (file)
@@ -359,11 +359,13 @@ class User < ApplicationRecord
     trace_score = traces.size * 50
     diary_entry_score = diary_entries.visible.inject(0) { |acc, elem| acc + elem.body.spam_score }
     diary_comment_score = diary_comments.visible.inject(0) { |acc, elem| acc + elem.body.spam_score }
+    report_score = Report.where(:category => "spam", :issue => issues.with_status("open")).count * 20
 
     score = description.spam_score / 4.0
     score += diary_entries.visible.where("created_at > ?", 1.day.ago).count * 10
     score += diary_entry_score / diary_entries.visible.length unless diary_entries.visible.empty?
     score += diary_comment_score / diary_comments.visible.length unless diary_comments.visible.empty?
+    score += report_score
     score -= changeset_score
     score -= trace_score