feat(me): add 30-day mention age cutoff to filter stale @-mentions
Previously, query_mentioned_in returned mentions from any time in the entity's history as long as the entity was still open (or recently closed). This caused noise: a mention from 6 months ago on a still-open issue would appear in the dashboard indefinitely. Now the SQL filters notes by created_at > mention_cutoff_ms, defaulting to 30 days. The recency_cutoff (7 days) still governs closed/merged entity visibility — this new cutoff governs mention note age on open entities. Signature change: query_mentioned_in gains a mention_cutoff_ms parameter. All existing test call sites updated. Two new tests verify the boundary: - mentioned_in_excludes_old_mention_on_open_issue (45-day mention filtered) - mentioned_in_includes_recent_mention_on_open_issue (5-day mention kept)
This commit is contained in:
@@ -27,6 +27,8 @@ const DEFAULT_ACTIVITY_SINCE_DAYS: i64 = 1;
|
||||
const MS_PER_DAY: i64 = 24 * 60 * 60 * 1000;
|
||||
/// Recency window for closed/merged items in the "Mentioned In" section: 7 days.
|
||||
const RECENCY_WINDOW_MS: i64 = 7 * MS_PER_DAY;
|
||||
/// Only show mentions from notes created within this window (30 days).
|
||||
const MENTION_WINDOW_MS: i64 = 30 * MS_PER_DAY;
|
||||
|
||||
/// Resolve the effective username from CLI flag or config.
|
||||
///
|
||||
@@ -151,7 +153,14 @@ pub fn run_me(config: &Config, args: &MeArgs, robot_mode: bool) -> Result<()> {
|
||||
|
||||
let mentioned_in = if want_mentions {
|
||||
let recency_cutoff = crate::core::time::now_ms() - RECENCY_WINDOW_MS;
|
||||
query_mentioned_in(&conn, username, &project_ids, recency_cutoff)?
|
||||
let mention_cutoff = crate::core::time::now_ms() - MENTION_WINDOW_MS;
|
||||
query_mentioned_in(
|
||||
&conn,
|
||||
username,
|
||||
&project_ids,
|
||||
recency_cutoff,
|
||||
mention_cutoff,
|
||||
)?
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user