Skip to content

Comments

Fix modreport to include reports of deleted messages#286

Merged
vcarl merged 2 commits intomainfrom
fix-modreport-include-deleted-messages
Feb 20, 2026
Merged

Fix modreport to include reports of deleted messages#286
vcarl merged 2 commits intomainfrom
fix-modreport-include-deleted-messages

Conversation

@vcarl
Copy link
Member

@vcarl vcarl commented Feb 20, 2026

Summary

  • Fixed /modreport command to include reports where the reported message was deleted
  • Removed incorrect deleted_at IS NULL filters from all modreport queries

Problem

The /modreport command was returning "No moderation history found" for users who had messages that were reported and then deleted. For example, user 393999891610861579 had a spam report from 2026-02-16, but /modreport showed no history.

The issue was that all modreport queries filtered by deleted_at IS NULL, excluding any reports where the reported message had been deleted. This is incorrect because:

  • deleted_at indicates the reported message was deleted (a moderation action)
  • These are the most important reports - they represent successful moderation
  • Deleted messages should appear in moderation history, not be hidden

Changes

Removed the .where("deleted_at", "is", null) filter from 15 query locations in app/models/reportedMessages.ts:

  • getUserReportStats (3 queries)
  • getSpamReportCount (1 query)
  • getUserReportSummary (6 queries)
  • getMonthlyReportCounts (1 query)
  • getRecentReportCount (2 queries)
  • getChannelBreakdown (1 query)
  • getStaffBreakdown (1 query)

Test plan

  • All existing tests pass
  • Verified against production database that user 393999891610861579 now appears in queries
  • Test /modreport in production to confirm it shows previously hidden reports

🤖 Generated with Claude Code

vcarl and others added 2 commits February 20, 2026 17:05
When a moderator deletes a message, it's now logged to both the per-user deletion thread and the moderation thread. This provides better visibility of mod actions in the moderation log alongside kicks, bans, and timeouts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The /modreport command was incorrectly filtering out all reports where the
reported message had been deleted (deleted_at IS NOT NULL). This meant users
who had messages reported and then deleted showed no moderation history.

The deleted_at timestamp indicates the reported MESSAGE was deleted (a
moderation action), not that the report should be hidden. These are actually
the most important reports to show since they represent successful moderation.

Removed the deleted_at filter from all modreport-related queries:
- getUserReportStats (3 queries)
- getSpamReportCount (1 query)
- getUserReportSummary (6 queries)
- getMonthlyReportCounts (1 query)
- getRecentReportCount (2 queries)
- getChannelBreakdown (1 query)
- getStaffBreakdown (1 query)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

Smoke Test Results

Metric Value
Image Size unknown
Startup Time 77s

Tested commit: f569844

@vcarl vcarl merged commit a58d8f5 into main Feb 20, 2026
5 checks passed
@vcarl vcarl deleted the fix-modreport-include-deleted-messages branch February 20, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant