forked from farhoodlabs/paperclip
fix(ui): inbox badge should only count unread mine issues
The sidebar inbox badge was counting all "mine" issues (issues created by or assigned to the user) instead of only unread ones. This caused the badge to show a count (e.g. 14) even when the Unread tab was empty. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -319,6 +319,21 @@ describe("inbox helpers", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("excludes read mine issues from the inbox badge count", () => {
|
||||
const result = computeInboxBadgeData({
|
||||
approvals: [],
|
||||
joinRequests: [],
|
||||
dashboard,
|
||||
heartbeatRuns: [],
|
||||
mineIssues: [makeIssue("1", false), makeIssue("2", false), makeIssue("3", true)],
|
||||
dismissed: new Set<string>(),
|
||||
});
|
||||
|
||||
expect(result.mineIssues).toBe(1);
|
||||
// inbox = mineIssues(1) + agent-error alert(1) + budget alert(1)
|
||||
expect(result.inbox).toBe(3);
|
||||
});
|
||||
|
||||
it("keeps read issues in the touched list but excludes them from unread counts", () => {
|
||||
const issues = [makeIssue("1", true), makeIssue("2", false)];
|
||||
|
||||
|
||||
+1
-1
@@ -362,7 +362,7 @@ export function computeInboxBadgeData({
|
||||
const visibleJoinRequests = joinRequests.filter(
|
||||
(jr) => !dismissed.has(`join:${jr.id}`),
|
||||
).length;
|
||||
const visibleMineIssues = mineIssues.length;
|
||||
const visibleMineIssues = mineIssues.filter((issue) => issue.isUnreadForMe).length;
|
||||
const agentErrorCount = dashboard?.agents.error ?? 0;
|
||||
const monthBudgetCents = dashboard?.costs.monthBudgetCents ?? 0;
|
||||
const monthUtilizationPercent = dashboard?.costs.monthUtilizationPercent ?? 0;
|
||||
|
||||
Reference in New Issue
Block a user