Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(inbox): archive notifications when an issue is cancelled, not only done (MUL-9329) (#10663)

Jiayuan Zhang9cd9da6c7708
diff --git a/apps/docs/content/docs/inbox.fr.mdx b/apps/docs/content/docs/inbox.fr.mdx
index 90b450015a..fc2c575c23 100644
--- a/apps/docs/content/docs/inbox.fr.mdx
+++ b/apps/docs/content/docs/inbox.fr.mdx
@@ -52,6 +52,8 @@ Sélectionner une notification la marque comme lue. Archivez-la quand vous avez
Dès qu'une tâche atteint un statut qui la rend à une personne, ses notifications « Exécution en échec » sont archivées automatiquement. Ces statuts sont `in_review`, les statuts personnalisés de la catégorie `started` et tous les statuts des catégories `done` et `closed`. `blocked` fait exception : il rend aussi la tâche, mais le travail reste bloqué, donc les échecs précédents méritent encore d'être lus.
+Quand une tâche atteint n'importe quel statut des catégories `done` ou `closed`, toutes ses notifications sont archivées automatiquement pour tout le monde, lues ou non. Une notification ultérieure sur la tâche revient dans la boîte de réception.
+
Faites un clic droit sur une notification pour **Marquer comme lu** / **Marquer comme non lu** et **Archiver** (**Désarchiver** dans la vue Archivées). Marquer comme non lu est l'action « j'ai regardé, mais je n'en ai pas fini » : la notification redevient non lue et fait remonter le compteur de non-lus, et elle reste non lue même tant que vous la gardez ouverte ; la rouvrir plus tard la marque comme lue, comme d'habitude. Les notifications archivées conservent leur état de lecture : en restaurer une la rétablit exactement comme vous l'aviez laissée.
Depuis le menu de la boîte de réception, vous pouvez aussi :
diff --git a/apps/docs/content/docs/inbox.ja.mdx b/apps/docs/content/docs/inbox.ja.mdx
index 056dae5588..f9f63520ec 100644
--- a/apps/docs/content/docs/inbox.ja.mdx
+++ b/apps/docs/content/docs/inbox.ja.mdx
@@ -52,6 +52,8 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
タスクが人に引き継がれるステータスになると、その「実行失敗」の通知は自動的にアーカイブされます。対象は `in_review`、`started` カテゴリのカスタムステータス、`done`・`closed` カテゴリのすべてのステータスです。`blocked` は例外です。人に引き継がれはしますが作業は止まったままなので、それまでの失敗の記録はまだ確認する必要があります。
+タスクが `done` または `closed` カテゴリのいずれかのステータスになると、そのタスクの通知はすべて、既読かどうかにかかわらず全員分が自動的にアーカイブされます。その後に届いた通知は、再びインボックスに入ります。
+
通知を右クリックすると、**既読にする** / **未読にする**と**アーカイブ**(「アーカイブ済み」ビューでは**アーカイブ解除**)を使えます。未読にするは「目は通したが、まだ終わっていない」ための操作です。通知は未読に戻り、未読数も戻ります。開いたままでも未読のままで、あとでもう一度開けば通常どおり既読になります。アーカイブ済みの通知は既読状態を保持するため、復元すると元のまま戻ります。
インボックスのメニューからは次の操作もできます。
diff --git a/apps/docs/content/docs/inbox.ko.mdx b/apps/docs/content/docs/inbox.ko.mdx
index f9831e3208..eb4a264dd7 100644
--- a/apps/docs/content/docs/inbox.ko.mdx
+++ b/apps/docs/content/docs/inbox.ko.mdx
@@ -52,6 +52,8 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
태스크가 사람에게 넘어가는 상태가 되면 그 태스크의 "실행 실패함" 알림은 자동으로 보관됩니다. 해당 상태는 `in_review`, `started` 카테고리의 사용자 지정 상태, `done`·`closed` 카테고리의 모든 상태입니다. `blocked`는 예외입니다. 사람에게 넘어가기는 하지만 작업이 여전히 막혀 있으므로 지난 실패 기록을 계속 확인해야 합니다.
+태스크가 `done` 또는 `closed` 카테고리의 어떤 상태가 되면, 읽었는지와 관계없이 모든 사람의 해당 태스크 알림이 자동으로 보관됩니다. 이후 새 알림이 오면 다시 인박스에 들어옵니다.
+
알림을 오른쪽 클릭하면 **읽음으로 표시** / **읽지 않음으로 표시**와 **보관**("보관됨" 뷰에서는 **보관 해제**)을 쓸 수 있습니다. 읽지 않음으로 표시는 "보긴 했지만 아직 끝내지 않았다"는 뜻입니다. 알림이 다시 읽지 않음이 되고 읽지 않은 개수도 다시 올라가며, 열어둔 상태에서도 읽지 않음으로 유지됩니다. 나중에 다시 열면 평소대로 읽음으로 바뀝니다. 보관된 알림은 읽음 상태를 유지하므로 복원하면 그대로 돌아옵니다.
인박스 메뉴에서는 다음 작업도 할 수 있습니다.
diff --git a/apps/docs/content/docs/inbox.mdx b/apps/docs/content/docs/inbox.mdx
index 7bdacd23b5..30f7b85edb 100644
--- a/apps/docs/content/docs/inbox.mdx
+++ b/apps/docs/content/docs/inbox.mdx
@@ -52,6 +52,8 @@ Selecting a notification marks it as read. Archive it when you're done; archivin
Once an issue reaches a status that hands it back to a person, its **Run failed** notifications archive automatically. Those statuses are `in_review`, custom statuses in the `started` category, and any status in the `done` or `closed` category. `blocked` is the exception: it hands the issue over too, but the work is still stuck, so the earlier failures are still worth reading.
+When an issue reaches any status in the `done` or `closed` category, all of its notifications archive automatically for everyone, read or not. A later notification on the issue lands in the inbox again.
+
Right-click a notification for **Mark as read** / **Mark as unread** and **Archive** (**Unarchive** in the Archived view). Mark as unread is the "I looked, but I'm not done with this" action: the notification goes back to unread and raises the unread count again, and it stays unread even while you keep it open; opening it again later marks it read as usual. Archived notifications keep their read state, so restoring one brings it back exactly as you left it.
From the inbox menu you can also:
diff --git a/apps/docs/content/docs/inbox.zh-Hant.mdx b/apps/docs/content/docs/inbox.zh-Hant.mdx
index d1fb151dbd..d48a568163 100644
--- a/apps/docs/content/docs/inbox.zh-Hant.mdx
+++ b/apps/docs/content/docs/inbox.zh-Hant.mdx
@@ -52,6 +52,8 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
任務進入交回給人的狀態後,它的"執行失敗"通知會自動歸檔。這類狀態包括 `in_review`、`started` 分類下的自定義狀態,以及 `done`、`closed` 分類下的任一狀態。`blocked` 例外:它同樣交回給人,但工作還卡著,之前的失敗記錄還要看。
+任務進入 `done` 或 `closed` 分類下的任一狀態時,它的全部通知會為所有人自動歸檔,無論是否已讀。之後該任務再有新通知,會重新進入收件箱。
+
右鍵點選一條通知,可以使用**標為已讀** / **標為未讀**和**歸檔**(在"已歸檔"檢視中是**取消歸檔**)。標為未讀表達的是"我看過了,但還沒處理完":該通知重新變為未讀,未讀數也會回升;即使它還開著也保持未讀,之後再開啟一次才會照常標為已讀。已歸檔的通知會保留已讀狀態,因此恢復時會原樣回來。
收件箱選單還可以:
diff --git a/apps/docs/content/docs/inbox.zh.mdx b/apps/docs/content/docs/inbox.zh.mdx
index 643d140b07..f9455a4f93 100644
--- a/apps/docs/content/docs/inbox.zh.mdx
+++ b/apps/docs/content/docs/inbox.zh.mdx
@@ -52,6 +52,8 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
任务进入交回给人的状态后,它的"运行失败"通知会自动归档。这类状态包括 `in_review`、`started` 分类下的自定义状态,以及 `done`、`closed` 分类下的任一状态。`blocked` 例外:它同样交回给人,但工作还卡着,之前的失败记录还要看。
+任务进入 `done` 或 `closed` 分类下的任一状态时,它的全部通知会为所有人自动归档,无论是否已读。之后该任务再有新通知,会重新进入收件箱。
+
右键点击一条通知,可以使用**标为已读** / **标为未读**和**归档**(在"已归档"视图中是**取消归档**)。标为未读表达的是"我看过了,但还没处理完":该通知重新变为未读,未读数也会回升;即使它还开着也保持未读,之后再打开一次才会照常标为已读。已归档的通知会保留已读状态,因此恢复时会原样回来。
收件箱菜单还可以:
diff --git a/packages/views/locales/en/settings.json b/packages/views/locales/en/settings.json
index ca5fcfc22e..f86f83ad34 100644
--- a/packages/views/locales/en/settings.json
+++ b/packages/views/locales/en/settings.json
@@ -845,8 +845,8 @@
"manual_label": "Archive by hand",
"manual_description": "From its row in the sidebar, or the top of the notification",
"manual_value": "Anytime",
- "done_label": "Issue done",
- "done_description": "When an issue reaches a Done status, its notifications are archived. Cancelling it doesn't.",
+ "done_label": "Issue done or cancelled",
+ "done_description": "When an issue reaches a Done or Cancelled status, its notifications are archived.",
"done_value": "Automatic",
"archived_label": "Archived notifications",
"archived_description": "Find them again and unarchive them",
diff --git a/packages/views/locales/es/settings.json b/packages/views/locales/es/settings.json
index d000c0a107..cb18ff4f77 100644
--- a/packages/views/locales/es/settings.json
+++ b/packages/views/locales/es/settings.json
@@ -845,8 +845,8 @@
"manual_label": "Archivar a mano",
"manual_description": "Desde su fila en la barra lateral o desde la parte superior de la notificación",
"manual_value": "En cualquier momento",
- "done_label": "Tarea completada",
- "done_description": "Cuando una tarea pasa a un estado Completado, sus notificaciones se archivan. Cancelarla no las archiva.",
+ "done_label": "Tarea completada o cancelada",
+ "done_description": "Cuando una tarea pasa a un estado Completado o Cancelado, sus notificaciones se archivan.",
"done_value": "Automático",
"archived_label": "Notificaciones archivadas",
"archived_description": "Encuéntralas de nuevo y desarchívalas",
diff --git a/packages/views/locales/fr/settings.json b/packages/views/locales/fr/settings.json
index ddd9caea62..d0b3a9c68c 100644
--- a/packages/views/locales/fr/settings.json
+++ b/packages/views/locales/fr/settings.json
@@ -845,8 +845,8 @@
"manual_label": "Archiver à la main",
"manual_description": "Depuis sa ligne dans la barre latérale ou le haut de la notification",
"manual_value": "À tout moment",
- "done_label": "Tâche terminée",
- "done_description": "Quand une tâche passe à un statut Terminé, ses notifications sont archivées. L'annuler ne les archive pas.",
+ "done_label": "Tâche terminée ou annulée",
+ "done_description": "Quand une tâche passe à un statut Terminé ou Annulé, ses notifications sont archivées.",
"done_value": "Automatique",
"archived_label": "Notifications archivées",
"archived_description": "Retrouvez-les et désarchivez-les",
diff --git a/packages/views/locales/ja/settings.json b/packages/views/locales/ja/settings.json
index a477779ec0..394e14014b 100644
--- a/packages/views/locales/ja/settings.json
+++ b/packages/views/locales/ja/settings.json
@@ -836,8 +836,8 @@
"manual_label": "手動でアーカイブ",
"manual_description": "サイドバーの行、または通知の上部から",
"manual_value": "いつでも",
- "done_label": "タスクが完了",
- "done_description": "タスクが完了系のステータスになると、その通知はアーカイブされます。キャンセルではアーカイブされません。",
+ "done_label": "タスクが完了・キャンセル",
+ "done_description": "タスクが完了系またはキャンセル系のステータスになると、その通知はアーカイブされます。",
"done_value": "自動",
"archived_label": "アーカイブ済みの通知",
"archived_description": "ここから見つけてアーカイブを解除できます",
diff --git a/packages/views/locales/ko/settings.json b/packages/views/locales/ko/settings.json
index 038a1e2ac1..ce1379efe5 100644
--- a/packages/views/locales/ko/settings.json
+++ b/packages/views/locales/ko/settings.json
@@ -836,8 +836,8 @@
"manual_label": "직접 보관",
"manual_description": "사이드바의 행이나 알림 상단에서",
"manual_value": "언제든지",
- "done_label": "태스크 완료",
- "done_description": "태스크가 완료 계열 상태가 되면 그 알림은 보관됩니다. 취소는 보관하지 않습니다.",
+ "done_label": "태스크 완료 또는 취소",
+ "done_description": "태스크가 완료 또는 취소 계열 상태가 되면 그 알림은 보관됩니다.",
"done_value": "자동",
"archived_label": "보관된 알림",
"archived_description": "여기서 다시 찾고 보관을 해제할 수 있습니다",
diff --git a/packages/views/locales/ru/settings.json b/packages/views/locales/ru/settings.json
index 46ba08bcff..00be4050b7 100644
--- a/packages/views/locales/ru/settings.json
+++ b/packages/views/locales/ru/settings.json
@@ -862,8 +862,8 @@
"manual_label": "Архивировать вручную",
"manual_description": "Из строки на боковой панели или в верхней части уведомления",
"manual_value": "В любой момент",
- "done_label": "Задача выполнена",
- "done_description": "Когда задача переходит в статус «Выполнено», её уведомления архивируются. Отмена их не архивирует.",
+ "done_label": "Задача выполнена или отменена",
+ "done_description": "Когда задача переходит в статус «Выполнено» или «Отменено», её уведомления архивируются.",
"done_value": "Автоматически",
"archived_label": "Архивные уведомления",
"archived_description": "Здесь их можно найти и вернуть из архива",
diff --git a/packages/views/locales/zh-Hans/settings.json b/packages/views/locales/zh-Hans/settings.json
index aa2cf098d0..535e0d2aba 100644
--- a/packages/views/locales/zh-Hans/settings.json
+++ b/packages/views/locales/zh-Hans/settings.json
@@ -836,8 +836,8 @@
"manual_label": "手动归档",
"manual_description": "在侧栏行上或通知详情顶部点归档",
"manual_value": "随时",
- "done_label": "任务已完成",
- "done_description": "任务进入「已完成」类状态时,它的通知自动归档;取消不会。",
+ "done_label": "任务已完成或已取消",
+ "done_description": "任务进入「已完成」或「已取消」类状态时,它的通知自动归档。",
"done_value": "自动",
"archived_label": "已归档的通知",
"archived_description": "可以在这里找回并取消归档",
diff --git a/packages/views/locales/zh-Hant/settings.json b/packages/views/locales/zh-Hant/settings.json
index e589143dbc..548b43a423 100644
--- a/packages/views/locales/zh-Hant/settings.json
+++ b/packages/views/locales/zh-Hant/settings.json
@@ -836,8 +836,8 @@
"manual_label": "手動歸檔",
"manual_description": "在側欄列上或通知詳情頂部點歸檔",
"manual_value": "隨時",
- "done_label": "任務已完成",
- "done_description": "任務進入「已完成」類狀態時,它的通知自動歸檔;取消不會。",
+ "done_label": "任務已完成或已取消",
+ "done_description": "任務進入「已完成」或「已取消」類狀態時,它的通知自動歸檔。",
"done_value": "自動",
"archived_label": "已歸檔的通知",
"archived_description": "可以在這裡找回並取消歸檔",
diff --git a/packages/views/settings/components/notifications-tab.test.tsx b/packages/views/settings/components/notifications-tab.test.tsx
index 53c2cb95f4..14a27a9c3f 100644
--- a/packages/views/settings/components/notifications-tab.test.tsx
+++ b/packages/views/settings/components/notifications-tab.test.tsx
@@ -68,7 +68,7 @@ describe("Inbox notification settings", () => {
renderTab();
const leaving = screen.getByRole("region", { name: "Leaving the Inbox" });
expect(leaving).toHaveTextContent("Reading a notification doesn't take it out of the Inbox.");
- expect(leaving).toHaveTextContent("Cancelling it doesn't.");
+ expect(leaving).toHaveTextContent("reaches a Done or Cancelled status");
expect(within(leaving).getByRole("link", { name: "View archived" })).toHaveAttribute(
"href",
"/acme/inbox?view=archived",
diff --git a/server/cmd/server/notification_listeners.go b/server/cmd/server/notification_listeners.go
index 1de8eae8ff..4a7e9681d8 100644
--- a/server/cmd/server/notification_listeners.go
+++ b/server/cmd/server/notification_listeners.go
@@ -242,10 +242,11 @@ func archiveStaleTaskFailedInbox(
"row_count", len(rows), "recipient_count", count)
}
-// archiveDoneIssueInbox archives every recipient's notifications for an issue
-// that reached a done status: finished work leaves the inbox whether or not
-// it was read. Cancelled issues keep theirs.
-func archiveDoneIssueInbox(
+// archiveTerminalIssueInbox archives every recipient's notifications for an
+// issue that reached a done or closed status: finished or abandoned work
+// leaves the inbox whether or not it was read, the same set "Archive
+// completed" clears by hand.
+func archiveTerminalIssueInbox(
ctx context.Context,
queries *db.Queries,
bus *events.Bus,
@@ -257,7 +258,7 @@ func archiveDoneIssueInbox(
IssueID: parseUUID(issueID),
})
if err != nil {
- slog.Error("auto-archive done issue inbox: query failed",
+ slog.Error("auto-archive terminal issue inbox: query failed",
"workspace_id", workspaceID, "issue_id", issueID, "error", err)
return
}
@@ -270,7 +271,7 @@ func archiveDoneIssueInbox(
}
count := publishInboxBatchArchived(bus, workspaceID, issueID, recipients)
- slog.Info("auto-archive done issue inbox: archived rows",
+ slog.Info("auto-archive terminal issue inbox: archived rows",
"workspace_id", workspaceID, "issue_id", issueID,
"row_count", len(rows), "recipient_count", count)
}
@@ -1030,10 +1031,10 @@ func registerNotificationListeners(bus *events.Bus, queries *db.Queries) {
category, categoryErr := issuestatus.CategoryWithError(ctx, queries, parseUUID(e.WorkspaceID), issue.Status)
switch {
case categoryErr != nil:
- slog.Warn("resolve issue status category for done-issue inbox archive; keeping rows",
+ slog.Warn("resolve issue status category for terminal-issue inbox archive; keeping rows",
"issue_id", issue.ID, "status", issue.Status, "error", categoryErr)
- case category == issuestatus.CategoryDone:
- archiveDoneIssueInbox(ctx, queries, bus, e.WorkspaceID, issue.ID)
+ case category == issuestatus.CategoryDone, category == issuestatus.CategoryClosed:
+ archiveTerminalIssueInbox(ctx, queries, bus, e.WorkspaceID, issue.ID)
}
}
diff --git a/server/cmd/server/notification_listeners_test.go b/server/cmd/server/notification_listeners_test.go
index 6763aa0269..a5d789635b 100644
--- a/server/cmd/server/notification_listeners_test.go
+++ b/server/cmd/server/notification_listeners_test.go
@@ -1321,30 +1321,41 @@ func TestNotification_StatusChange_DoneArchivesIssueInbox(t *testing.T) {
}
}
-// TestNotification_StatusChange_CancelledKeepsIssueInbox verifies that only a
-// done status clears the inbox; a cancelled issue keeps its notifications.
-func TestNotification_StatusChange_CancelledKeepsIssueInbox(t *testing.T) {
- queries := db.New(testPool)
- bus := newNotificationBus(t, queries)
-
- issueID := createTestIssue(t, testWorkspaceID, testUserID)
- t.Cleanup(func() {
- cleanupInboxForIssue(t, issueID)
- cleanupTestIssue(t, issueID)
- })
- addTestSubscriber(t, issueID, "member", testUserID, "creator")
-
- if _, err := testPool.Exec(context.Background(), `
- INSERT INTO inbox_item (workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, details)
- VALUES ($1, 'member', $2, 'new_comment', 'info', $3, 'cancelled keep test', '{}')
- `, testWorkspaceID, testUserID, issueID); err != nil {
- t.Fatalf("seed notification: %v", err)
- }
-
- publishStatusChange(bus, issueID, "cancelled", "in_progress")
-
- if active := countActiveInboxForIssue(t, testUserID, issueID); active != 1 {
- t.Fatalf("expected the notification to stay on a cancelled issue, got %d active", active)
+// TestNotification_StatusChange_TerminalArchivesIssueInbox verifies that a
+// closed status (cancelled) clears the inbox like done does, while a status
+// that is not done or closed keeps the issue's notifications.
+func TestNotification_StatusChange_TerminalArchivesIssueInbox(t *testing.T) {
+ for _, tc := range []struct {
+ status string
+ wantActive int
+ }{
+ {"cancelled", 0},
+ {"in_review", 1},
+ } {
+ t.Run(tc.status, func(t *testing.T) {
+ queries := db.New(testPool)
+ bus := newNotificationBus(t, queries)
+
+ issueID := createTestIssue(t, testWorkspaceID, testUserID)
+ t.Cleanup(func() {
+ cleanupInboxForIssue(t, issueID)
+ cleanupTestIssue(t, issueID)
+ })
+ addTestSubscriber(t, issueID, "member", testUserID, "creator")
+
+ if _, err := testPool.Exec(context.Background(), `
+ INSERT INTO inbox_item (workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, details)
+ VALUES ($1, 'member', $2, 'new_comment', 'info', $3, 'terminal archive test', '{}')
+ `, testWorkspaceID, testUserID, issueID); err != nil {
+ t.Fatalf("seed notification: %v", err)
+ }
+
+ publishStatusChange(bus, issueID, tc.status, "in_progress")
+
+ if active := countActiveInboxForIssue(t, testUserID, issueID); active != tc.wantActive {
+ t.Fatalf("status %s: expected %d active inbox rows, got %d", tc.status, tc.wantActive, active)
+ }
+ })
}
}