[Activity panel 2/3] Add a Mark all as seen action for large backlogs

未关闭
#139 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
42/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
full-stack

调研方向

Start with markTicketSeen and its unseen condition in lib/db/queries/tickets.ts, then markTicketSeenAction in lib/actions/notifications.ts for the access check. The panel is in components/dashboard/activity-panel.tsx, rendered from app/(dashboard)/dashboard/page.tsx. Done means a set-based update limited to the organization and to replies at or before the page load time, with tests for the query, action and confirmation flow. The issue says part 1 (#618) should land first, so check whether that is merged before starting.

由索引模型根据 Issue 内容生成。

描述

backend enhancement frontend help wanted notifications

Copied from DeadantCo/answerLoops#129 · originally opened by sethr07 on 2026-11-20

Copied from https://github.com/answerLoops/answerLoops/issues/619 — originally opened by @NathanTarbert on 2026-11-17

Series

This is part 2 of 3 of the dashboard Activity panel work. Each part is its own pull request. Build part 1 first, because this adds a control to the panel it redesigns.

  1. #618: collapse on load, preview 5, and always show the true count
  2. #619: a "Mark all as seen" action for large backlogs (this issue)
  3. #620: a channel breakdown, with a channel filter on the tickets page

Summary

Add a Mark all as seen action to the Activity panel, so a team can clear a large backlog of customer replies in one step instead of opening tickets one at a time.

How it works today

  • A ticket counts as unseen when it has a customer reply that is newer than its last-seen time, or it has never been seen.
  • Opening a ticket (markTicketSeen in lib/db/queries/tickets.ts) does two things together: it sets the ticket's last-seen time to now, and it marks that ticket's unread notifications as read.
  • "Seen" is stored on the ticket, so it is shared by the whole team. When one person opens a ticket it is seen for everyone.
  • There is no bulk way to do this. With 200 tickets waiting, the only way to clear the panel and the notification badges is to open all 200.

The problem

A backlog that is never cleared makes the Activity count meaningless: people stop trusting it because it never reaches zero, and real new replies hide inside the pile. Teams need a deliberate way to say "I have dealt with all of these, start fresh".

What to build

1. Where it lives
  • A secondary Mark all as seen button inside the expanded Activity panel, next to the footer from part 1. It is not in the collapsed header, so it cannot be clicked by accident.
  • It is shown only while the panel is shown, which means there is at least one unseen ticket.
2. Confirmation first
  • Clicking it opens an inline confirmation, not an immediate action. The text says how many tickets are affected and what it does, for example: "Mark 200 tickets as seen? This clears them for your whole team and removes their unread notifications. Nothing is deleted and the tickets stay open. This cannot be undone."
  • Cancel is focused by default and Escape dismisses it. Only an explicit confirm button runs the action.
3. What the action does
  • It sets the last-seen time to now for every ticket in the person's organization that is unseen as of the moment the dashboard was loaded, and it marks those tickets' unread notifications as read, matching what opening a ticket does.
  • A customer reply that arrives after the page loaded must not be cleared by accident. Pass the page's load time to the action and only touch tickets whose latest customer reply is at or before that time.
  • It runs as one set-based update, not a loop over tickets, so it is safe for thousands of tickets and either fully applies or does not apply.
  • It is scoped to the person's own organization and never touches another workspace's tickets.
4. What the person sees afterwards
  • A confirmation message using the number actually updated, for example "Marked 198 tickets as seen". It can be lower than the number shown, if a teammate opened some in the meantime.
  • The Activity panel, the tickets list and the notification badge all refresh. If nothing is left unseen, the panel renders nothing, as it does today.
  • If the action fails, the person gets an error message and nothing is changed.
5. Access
  • Use the same access check as opening a ticket today (see markTicketSeenAction in lib/actions/notifications.ts).
  • In review, confirm whether a bulk action that affects the whole team should be limited to some roles. Do not widen access beyond what opening a ticket needs.

Out of scope

  • Undo.
  • Marking only a subset, such as one channel or the tickets on screen. That can follow once part 3 exists.
  • Any change to what counts as unseen, per-person seen state, or opening the panel automatically.
  • Any change to the notification system beyond marking the affected tickets' notifications read.
  • An audit log entry for the bulk action.

Where to look

  • lib/db/queries/tickets.ts for markTicketSeen and the unseen condition. The new query should reuse the same condition so the two can never disagree.
  • lib/actions/notifications.ts for the existing server action and its access check.
  • components/dashboard/activity-panel.tsx and app/(dashboard)/dashboard/page.tsx for the panel and where it is rendered.

Acceptance criteria

  • The button appears only in the expanded panel, and needs an explicit confirmation to run.
  • Cancel is focused by default and Escape dismisses the confirmation.
  • Every unseen ticket in the organization as of page load is marked seen, and its unread notifications are marked read.
  • A customer reply that arrived after the page loaded stays unseen.
  • No ticket or notification in another organization changes.
  • The person sees the number actually updated, and the panel and notification badge refresh.
  • On failure the person sees an error and nothing is partly applied.

Tests

Add tests for the query and action: it updates only unseen tickets up to the load time, leaves later replies alone, marks the matching notifications read, stays inside one organization, and returns the updated count. Add component tests for the confirmation flow, focus, Escape, and the success and error messages.

Start here: new to the project? Read CONTRIBUTING.md first. It covers the ground rules, running answerLoops locally, and how to open a pull request.

主要语言
TypeScript
星标
0
派生
0
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

DeadantCo/answerLoopsdev 的其他 Issue

查看 DeadantCo/answerLoopsdev 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。