Skip to content

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

Go

MUL-9333: feat(inbox): snooze issues until a time, with a Snoozed view (#10680)

Jiayuan Zhangd5cc22b2762c
diff --git a/apps/docs/content/docs/inbox.fr.mdx b/apps/docs/content/docs/inbox.fr.mdx
index 3605ba949e..3efb652dab 100644
--- a/apps/docs/content/docs/inbox.fr.mdx
+++ b/apps/docs/content/docs/inbox.fr.mdx
@@ -61,7 +61,7 @@ Cliquez sur une ligne pour ouvrir sa tâche au commentaire ou à la demande d'ap
Une tâche ouverte depuis la boîte de réception affiche les actions de la boîte de réception dans son en-tête :
-- **Marquer comme lu** / **Marquer comme non lu**. Marquer comme non lu est l'action « j'ai regardé, mais je n'en ai pas fini » : la ligne redevient non lue et fait remonter le compteur, et elle reste non lue tant que la tâche est ouverte.
+- **Reporter** (`H`) retire la tâche de votre boîte de réception jusqu'à l'heure choisie et ouvre la suivante. Voir « Reporter une tâche » ci-dessous.
- **Marquer comme terminé** passe la tâche en `done`, archive la notification et ouvre la suivante. La notification est archivée même si **Archiver les tâches que vous terminez** est désactivé. L'action est proposée tant que la tâche n'est ni terminée ni annulée.
- **Archiver** (`E`) archive la notification et ouvre la suivante. L'archivage ne modifie ni ne supprime la tâche.
@@ -78,11 +78,25 @@ Le menu ⋯ de la section regroupe **Voir les archivées** et les actions group
**Voir les archivées** ouvre les notifications archivées. D'autres éléments se chargent au fil du défilement, et les filtres s'appliquent à l'ensemble des archives, y compris aux éléments pas encore chargés. Les notifications archivées conservent leur état de lecture : **Désarchiver** (ou `E`) en rétablit une exactement comme vous l'aviez laissée.
+## Reporter une tâche
+
+Reporter retire une tâche de votre boîte de réception jusqu'à l'heure choisie, puis la fait revenir en haut, non lue. Reportez depuis le bouton réveil dans l'en-tête de la tâche (ou avec `H`), depuis le bouton à côté d'Archiver au survol d'une ligne, ou depuis la carte de survol d'une ligne. Choisissez **1 heure**, **3 heures**, **1 jour**, **3 jours** ou **1 semaine**, ou **Choisir une date et une heure…** pour n'importe quel moment dans l'année. Un report d'un jour ou plus garde l'heure actuelle, sauf s'il est fait entre 22:00 et 6:00 : la tâche revient alors à 9:00. La confirmation permet d'annuler ; annuler un changement d'heure rétablit l'heure précédente.
+
+Tant qu'une tâche est reportée :
+
+- ses nouvelles notifications attendent avec elle et ne comptent pas dans le badge non lu. À son retour, la ligne indique **Report terminé** et le nombre de nouveautés arrivées entre-temps ;
+- elle revient plus tôt si quelqu'un vous mentionne nommément, si elle vous est assignée, si une exécution échoue, si une app demande votre action ou si toutes ses sous-tâches sont terminées. Les mentions `@all` et d'escouade ne la réveillent pas ;
+- **Tout marquer comme lu** et les actions d'archivage groupé l'ignorent. L'archiver met fin au report, tout comme terminer vous-même la tâche quand **Archiver les tâches que vous terminez** est activé ;
+- ouvrir la tâche depuis ailleurs ne la marque pas comme lue et ne met pas fin au report. Son en-tête indique quand elle revient ; ouvrez-le pour la faire revenir maintenant (`H`) ou changer l'heure.
+
+Le report est personnel : il ne change que votre boîte de réception. Tout ce que vous avez reporté se trouve dans la vue **Reportés** sous Vues, aussi accessible via **Voir les reportés** dans le menu de la boîte de réception.
+
## Quand une notification quitte la boîte de réception
Lire une notification ne la retire pas. Une ligne quitte la boîte de réception uniquement :
- quand vous l'archivez, depuis sa ligne, la carte de survol, l'en-tête de la tâche ou une action groupée ;
+- quand vous reportez sa tâche. C'est temporaire : la tâche revient à l'heure choisie, ou plus tôt si quelque chose a besoin de vous. Voir « Reporter une tâche » ci-dessus ;
- quand vous passez vous-même sa tâche à n'importe quel statut des catégories `done` ou `closed`, tant que **Archiver les tâches que vous terminez** est activé (c'est le cas par défaut). Seules vos propres notifications sur cette tâche sont archivées, lues ou non. Quand quelqu'un d'autre ou un agent termine une tâche, ses notifications restent dans votre boîte de réception, pour que vous voyiez la nouvelle ;
- quand c'est une notification **Exécution en échec** et que sa tâche passe à un statut qui la rend à une personne : `in_review`, un statut personnalisé de la catégorie `started`, ou n'importe quel statut des catégories `done` ou `closed`. Les notifications Exécution en échec de tout le monde sur cette tâche sont alors archivées, quelle que soit la personne qui a changé le statut, et indépendamment du réglage ci-dessus. `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.
diff --git a/apps/docs/content/docs/inbox.ja.mdx b/apps/docs/content/docs/inbox.ja.mdx
index 505d4eaa70..a416d3bf42 100644
--- a/apps/docs/content/docs/inbox.ja.mdx
+++ b/apps/docs/content/docs/inbox.ja.mdx
@@ -61,7 +61,7 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
インボックスから開いたタスクのヘッダーには、インボックスの操作が並びます。
-- **既読にする** / **未読にする**。未読にするは「目は通したが、まだ終わっていない」ための操作です。行は未読に戻り、未読数も戻ります。タスクを開いたままでも未読のままです。
+- **スヌーズ**(`H`)は、指定した時間までタスクをインボックスから外し、次の通知を開きます。詳しくは下の「タスクをスヌーズする」を参照してください。
- **完了にする** は、タスクを `done` にし、通知をアーカイブして、次の通知を開きます。**自分が完了したタスクをアーカイブ** がオフでも、この通知はアーカイブされます。タスクがまだ完了またはキャンセルされていないときに表示されます。
- **アーカイブ**(`E`)は、通知をアーカイブして次の通知を開きます。アーカイブしてもタスクは変更・削除されません。
@@ -78,11 +78,25 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
**アーカイブ済みを表示** を開くと、アーカイブした通知がスクロールに合わせて読み込まれます。フィルターは、まだ読み込まれていない通知も含め、アーカイブ全体に適用されます。アーカイブ済みの通知は既読状態を保持するため、**アーカイブ解除**(または `E`)すると元のまま戻ります。
+## タスクをスヌーズする
+
+スヌーズすると、タスクは指定した時間までインボックスから外れ、その時間になると未読のまま一番上に戻ります。タスクのヘッダーの目覚まし時計ボタン(または `H`)、行にカーソルを合わせたときにアーカイブの横に出るボタン、または行のホバーカードからスヌーズできます。**1 時間**、**3 時間**、**1 日**、**3 日**、**1 週間** のほか、**日時を選択…** で 1 年以内の任意の日時を選べます。1 日以上のスヌーズは今の時刻のまま戻りますが、22:00〜6:00 にスヌーズした場合は朝 9:00 に戻ります。確認メッセージから元に戻せます。時間を変更した場合は、元の時間に戻ります。
+
+スヌーズ中のタスクは次のように扱われます。
+
+- 新しい通知も一緒に待機し、未読バッジには数えられません。戻ってきた行には **スヌーズ終了** と、その間に届いた更新の数が表示されます。
+- 名指しでメンションされたとき、自分に割り当てられたとき、実行が失敗したとき、アプリが操作を求めたとき、すべてのサブタスクが完了したときは早めに戻ります。`@all` とスクワッドへのメンションでは戻りません。
+- **すべて既読にする** や一括アーカイブはスヌーズ中のタスクをスキップします。アーカイブするとスヌーズは終了します。**自分が完了したタスクをアーカイブ** がオンのときに自分でタスクを完了した場合も同じです。
+- ほかの場所からタスクを開いても既読にはならず、スヌーズも終了しません。ヘッダーに戻る時間が表示され、そこから今すぐ戻す(`H`)か時間を変更できます。
+
+スヌーズは自分のインボックスだけに影響します。スヌーズ中のタスクは Views の **スヌーズ中** ビュー、またはインボックスメニューの **スヌーズ中を表示** から確認できます。
+
## 通知がインボックスから外れるとき
既読にしても通知はインボックスから消えません。行が外れるのは次の場合だけです。
- 行、ホバーカード、タスクのヘッダー、または一括操作から、あなたがアーカイブしたとき
+- タスクをスヌーズしたとき。これは一時的で、指定した時間になるか、対応が必要な通知が届くと戻ります。上の「タスクをスヌーズする」を参照してください。
- **自分が完了したタスクをアーカイブ** がオン(既定でオン)の状態で、あなた自身がタスクを `done` または `closed` カテゴリのいずれかのステータスにしたとき。アーカイブされるのは、そのタスクに届いたあなた自身の通知だけで、既読かどうかは問いません。ほかの人やエージェントがタスクを完了した場合、その通知はあなたのインボックスに残るので、変化を見逃しません。
- 「実行失敗」の通知で、タスクが人に引き継がれるステータスになったとき。対象は `in_review`、`started` カテゴリのカスタムステータス、`done`・`closed` カテゴリのすべてのステータスです。誰がステータスを変えたかにかかわらず、そのタスクの全員分の「実行失敗」の通知がアーカイブされ、上の設定には左右されません。`blocked` は例外です。人に引き継がれはしますが作業は止まったままなので、それまでの失敗の記録はまだ確認する必要があります。
diff --git a/apps/docs/content/docs/inbox.ko.mdx b/apps/docs/content/docs/inbox.ko.mdx
index 61e4782385..f5e9b6a86c 100644
--- a/apps/docs/content/docs/inbox.ko.mdx
+++ b/apps/docs/content/docs/inbox.ko.mdx
@@ -61,7 +61,7 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
인박스에서 연 태스크의 헤더에는 인박스 작업이 표시됩니다.
-- **읽음으로 표시** / **읽지 않음으로 표시**. 읽지 않음으로 표시는 "보긴 했지만 아직 끝내지 않았다"는 뜻입니다. 행이 다시 읽지 않음이 되고 읽지 않은 수도 다시 올라가며, 태스크를 열어 둔 동안에도 읽지 않음으로 유지됩니다.
+- **다시 알림**(`H`)은 지정한 시간까지 태스크를 인박스에서 빼고 다음 알림을 엽니다. 자세한 내용은 아래 '태스크 미루기'를 참고하세요.
- **완료로 표시**는 태스크를 `done`으로 바꾸고, 알림을 보관한 뒤 다음 알림을 엽니다. **내가 완료한 태스크 보관**이 꺼져 있어도 이 알림은 보관됩니다. 태스크가 아직 완료되거나 취소되지 않았을 때만 표시됩니다.
- **보관**(`E`)은 알림을 보관하고 다음 알림을 엽니다. 보관해도 태스크는 변경되거나 삭제되지 않습니다.
@@ -78,11 +78,25 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
**보관된 알림 보기**를 열고 아래로 스크롤하면 이전 기록이 계속 불러와집니다. 필터는 아직 불러오지 않은 기록을 포함한 전체 보관 기록에 적용됩니다. 보관된 알림은 읽음 상태를 유지하므로 **보관 해제**(또는 `E`)하면 그대로 돌아옵니다.
+## 태스크 미루기
+
+미루기를 하면 태스크가 지정한 시간까지 인박스에서 빠졌다가, 그 시간이 되면 읽지 않은 상태로 맨 위에 돌아옵니다. 태스크 헤더의 알람 시계 버튼(또는 `H`), 행에 마우스를 올렸을 때 보관 버튼 옆에 나타나는 버튼, 또는 행의 호버 카드에서 미룰 수 있습니다. **1시간**, **3시간**, **1일**, **3일**, **1주** 중에서 고르거나, **날짜와 시간 선택…** 메뉴에서 1년 이내의 원하는 시간을 고를 수 있습니다. 하루 이상 미루면 지금 시각 그대로 돌아오지만, 22:00~6:00 사이에 미루면 아침 9:00에 돌아옵니다. 확인 알림에서 실행 취소할 수 있으며, 시간을 바꾼 경우에는 이전 시간으로 되돌아갑니다.
+
+태스크를 미뤄둔 동안에는:
+
+- 새 알림도 함께 기다리며 읽지 않음 배지에 포함되지 않습니다. 돌아온 행에는 **다시 알림 종료**와 그동안 쌓인 업데이트 수가 표시됩니다.
+- 누군가 이름으로 멘션하거나, 나에게 할당되거나, 실행이 실패하거나, 앱이 작업을 요청하거나, 모든 하위 태스크가 끝나면 일찍 돌아옵니다. `@all`과 스쿼드 멘션으로는 돌아오지 않습니다.
+- **모두 읽음으로 표시**와 일괄 보관은 미뤄둔 태스크를 건너뜁니다. 보관하면 미루기가 끝나며, **내가 완료한 태스크 보관**이 켜진 상태에서 직접 태스크를 완료한 경우도 마찬가지입니다.
+- 다른 곳에서 태스크를 열어도 읽음으로 바뀌지 않고 미루기도 끝나지 않습니다. 헤더에 돌아올 시간이 표시되며, 거기서 지금 되돌리거나(`H`) 시간을 바꿀 수 있습니다.
+
+미루기는 내 인박스에만 영향을 줍니다. 미뤄둔 태스크는 Views의 **미뤄둔 항목** 뷰나 인박스 메뉴의 **미뤄둔 항목 보기**에서 볼 수 있습니다.
+
## 알림이 인박스에서 빠지는 경우
읽어도 알림은 인박스에서 사라지지 않습니다. 행이 빠지는 경우는 다음뿐입니다.
- 행, 마우스 오버 카드, 태스크 헤더, 일괄 작업에서 직접 보관할 때
+- 태스크를 미룰 때. 이 경우는 일시적이며, 지정한 시간이 되거나 내가 처리해야 할 알림이 오면 다시 돌아옵니다. 위의 '태스크 미루기'를 참고하세요.
- **내가 완료한 태스크 보관**이 켜져 있는 상태(기본값)에서 내가 직접 태스크를 `done` 또는 `closed` 카테고리의 어떤 상태로 바꿀 때. 그 태스크에 온 내 알림만 읽음 여부와 관계없이 보관됩니다. 다른 사람이나 에이전트가 태스크를 완료하면 그 알림은 내 인박스에 남으므로 변화를 놓치지 않습니다.
- "실행 실패함" 알림이고, 태스크가 사람에게 넘어가는 상태가 될 때. 해당 상태는 `in_review`, `started` 카테고리의 사용자 지정 상태, `done`·`closed` 카테고리의 모든 상태입니다. 누가 상태를 바꿨는지와 관계없이 그 태스크의 모든 사람의 "실행 실패함" 알림이 보관되며, 위 설정의 영향을 받지 않습니다. `blocked`는 예외입니다. 사람에게 넘어가기는 하지만 작업이 여전히 막혀 있으므로 지난 실패 기록을 계속 확인해야 합니다.
diff --git a/apps/docs/content/docs/inbox.mdx b/apps/docs/content/docs/inbox.mdx
index 03332b0d18..9dc69340c4 100644
--- a/apps/docs/content/docs/inbox.mdx
+++ b/apps/docs/content/docs/inbox.mdx
@@ -61,7 +61,7 @@ Click a row to open its issue at the comment or app request the notification is
An issue opened from the inbox carries the inbox's actions in its header:
-- **Mark as read** / **Mark as unread**. Mark as unread is the "I looked, but I'm not done with this" action: the row goes back to unread and raises the count again, and it stays unread while you keep the issue open.
+- **Snooze** (`H`) takes the issue out of your inbox until a time you pick, and opens the next one. See [Snooze an issue](#snooze-an-issue) below.
- **Mark as done** sets the issue to `done`, archives the notification, and opens the next one. It archives the notification even when **Archive issues you complete** is off. It's offered while the issue isn't done or cancelled yet.
- **Archive** (`E`) archives the notification and opens the next one. Archiving doesn't modify or delete the issue.
@@ -78,11 +78,25 @@ The section's ⋯ menu holds **View archived** and the bulk actions:
**View archived** opens the archived notifications. More records load as you scroll, and filters apply to the entire archive, including records that have not loaded yet. Archived notifications keep their read state, so **Unarchive** (or `E`) brings one back exactly as you left it.
+## Snooze an issue
+
+Snooze takes an issue out of your inbox until a time you pick, then brings it back on top, unread. Snooze from the alarm-clock button in the issue header (or press `H`), from the button beside Archive when you hover a row, or from a row's hover card. Pick **1 hour**, **3 hours**, **1 day**, **3 days** or **1 week**, or **Pick a date and time…** for any time within a year. A day or more keeps the current time of day, except that one chosen between 22:00 and 6:00 comes back at 9:00. The confirmation lets you undo; undoing a change of time puts back the previous one.
+
+While an issue is snoozed:
+
+- new notifications on it wait with it and don't count toward the unread badge. When it comes back, the row says **Snooze ended** and how many updates arrived meanwhile;
+- it comes back early when someone mentions you by name, it is assigned to you, a run fails, an app asks for your action, or all its sub-issues finish. `@all` and squad mentions don't wake it;
+- **Mark all as read** and the archive-all actions leave it alone. Archiving it ends the snooze, and so does completing the issue yourself while **Archive issues you complete** is on;
+- opening the issue from anywhere else doesn't read it or end the snooze. Its header shows when it comes back; open that to bring it back now (`H`) or change the time.
+
+Snooze is personal: it only changes your own inbox. Everything you've snoozed is in the **Snoozed** view under Views, also reachable from **View snoozed** in the inbox menu.
+
## When a notification leaves the inbox
Reading a notification doesn't remove it. A row leaves the inbox only when:
- you archive it, from its row, the hover card, the issue header, or a bulk action;
+- you snooze its issue. This one is temporary: the issue comes back at the time you picked, or earlier when something needs you. See [Snooze an issue](#snooze-an-issue);
- you move its issue to any status in the `done` or `closed` category yourself, while **Archive issues you complete** is on (it is by default). Only your own notifications on that issue are archived, read or not. When someone else or an agent completes an issue, its notifications stay in your inbox, so you still see the news;
- it's a **Run failed** notification and its issue moves to a status that hands it back to a person: `in_review`, a custom status in the `started` category, or any status in the `done` or `closed` category. This archives everyone's Run failed notifications on the issue, whoever moved it, and doesn't depend on the setting above. `blocked` is the exception: it hands the issue over too, but the work is still stuck, so the earlier failures are still worth reading.
diff --git a/apps/docs/content/docs/inbox.zh-Hant.mdx b/apps/docs/content/docs/inbox.zh-Hant.mdx
index e98f8e1c9f..20c5382a26 100644
--- a/apps/docs/content/docs/inbox.zh-Hant.mdx
+++ b/apps/docs/content/docs/inbox.zh-Hant.mdx
@@ -61,7 +61,7 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
從收件箱開啟的任務,頁首會帶上收件箱的操作:
-- **標為已讀** / **標為未讀**。標為未讀表達的是"我看過了,但還沒處理完":這一列重新變為未讀,未讀數也會回升;任務一直開著時它也保持未讀。
+- **延後**(`H`)把任務移出收件箱,到你選的時間再回來,並開啟下一條。詳見下方的「延後任務」。
- **標記為已完成**會把任務設為 `done`,歸檔這條通知,並開啟下一條。即使關閉了**自動歸檔我完成的任務**,它也會歸檔這條通知。任務尚未完成或取消時才會出現。
- **歸檔**(`E`)會歸檔這條通知並開啟下一條。歸檔不會修改或刪除任務。
@@ -78,11 +78,25 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
**查看已歸檔**會開啟已歸檔的通知,向下捲動可繼續載入更早的記錄。篩選覆蓋全部歸檔記錄,包括尚未載入的記錄。已歸檔的通知會保留已讀狀態,因此**取消歸檔**(或按 `E`)時會原樣回來。
+## 延後任務
+
+延後會把一個任務暫時移出你的收件箱,到你選的時間再回到最上面,並標為未讀。可以在任務頁首點鬧鐘按鈕(或按 `H`),也可以在懸停收件箱列時點歸檔旁邊的按鈕,或在懸停卡片裡點 **延後**。可選 **1 小時**、**3 小時**、**1 天**、**3 天**、**1 週**,或點 **選擇日期和時間…** 選一年內的任意時間。按天延後時保留目前的鐘點;在 22:00 到 6:00 之間延後的,會在早上 9:00 回來。延後後的提示裡可以復原;如果是改了時間,復原會恢復原本的時間。
+
+任務延後期間:
+
+- 它的新通知會跟著一起等,不計入未讀角標。回來時,這一列會顯示 **延後到期** 以及期間有多少則動態;
+- 有人點名 @ 你、它被指派給你、執行失敗、應用程式請求你操作,或全部子任務完成時,它會提前回來。`@all` 和小隊提及不會喚醒它;
+- **全部標為已讀** 和各種全部歸檔操作會跳過它。歸檔它會結束延後;開著 **自動歸檔我完成的任務** 時你自己完成這個任務,也一樣;
+- 從別處開啟這個任務不會把它標為已讀,也不會結束延後。任務頁首會顯示它何時回來,點開可以讓它現在回來(`H`)或修改時間。
+
+延後只影響你自己的收件箱。所有延後的任務都在檢視裡的 **已延後** 中,也可以從收件箱選單的 **查看已延後** 進入。
+
## 通知何時離開收件箱
通知不會因為已讀而離開收件箱。只有以下幾種情況,一列才會移出:
- 你手動歸檔它:在它所在的列、懸停卡片、任務頁首,或透過批次操作;
+- 你延後了它的任務。這是暫時的:到你選的時間,或有需要你處理的通知時,它會回來。見上方的「延後任務」;
- 你親自把它的任務改為 `done` 或 `closed` 分類下的任一狀態,且**自動歸檔我完成的任務**處於開啟狀態(預設開啟)。只歸檔你自己在該任務上的通知,無論是否已讀。別人或 AI 代理完成的任務,通知會留在你的收件箱裡,你仍能看到這個變化;
- 它是"執行失敗"通知,且任務進入交回給人的狀態:`in_review`、`started` 分類下的自定義狀態,或 `done`、`closed` 分類下的任一狀態。這會歸檔所有人在該任務上的"執行失敗"通知,不論是誰改的狀態,也不受上面的開關影響。`blocked` 例外:它同樣交回給人,但工作還卡著,之前的失敗記錄還要看。
diff --git a/apps/docs/content/docs/inbox.zh.mdx b/apps/docs/content/docs/inbox.zh.mdx
index 455d94c268..2f56d784c6 100644
--- a/apps/docs/content/docs/inbox.zh.mdx
+++ b/apps/docs/content/docs/inbox.zh.mdx
@@ -61,7 +61,7 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
从收件箱打开的任务,页头会带上收件箱的操作:
-- **标为已读** / **标为未读**。标为未读表达的是"我看过了,但还没处理完":这一行重新变为未读,未读数也会回升;任务一直开着时它也保持未读。
+- **延后**(`H`)把任务移出收件箱,到你选的时间再回来,并打开下一条。详见下方的「延后任务」。
- **标记为已完成**会把任务设为 `done`,归档这条通知,并打开下一条。即使关闭了**自动归档我完成的任务**,它也会归档这条通知。任务尚未完成或取消时才会出现。
- **归档**(`E`)会归档这条通知并打开下一条。归档不会修改或删除任务。
@@ -78,11 +78,25 @@ import { InboxDemo } from "@/components/demos/inbox-demo";
**查看已归档**会打开已归档的通知,向下滚动可继续加载更早的记录。筛选覆盖全部归档记录,包括尚未加载的记录。已归档的通知会保留已读状态,因此**取消归档**(或按 `E`)时会原样回来。
+## 延后任务
+
+延后会把一个任务暂时移出你的收件箱,到你选的时间再回到最上面,并标为未读。可以在任务页头点闹钟按钮(或按 `H`),也可以在悬停收件箱行时点归档旁边的按钮,或在悬停卡片里点 **延后**。可选 **1 小时**、**3 小时**、**1 天**、**3 天**、**1 周**,或点 **选择日期和时间…** 选一年内的任意时间。按天延后时保留当前的钟点;在 22:00 到 6:00 之间延后的,会在早上 9:00 回来。延后后的提示里可以撤销;如果是改了时间,撤销会恢复原来的时间。
+
+任务延后期间:
+
+- 它的新通知会跟着一起等,不计入未读角标。回来时,这一行会显示 **延后到期** 以及期间有多少条动态;
+- 有人点名 @ 你、它被指派给你、运行失败、应用请求你操作,或全部子任务完成时,它会提前回来。`@all` 和小队提及不会唤醒它;
+- **全部标为已读** 和各种全部归档操作会跳过它。归档它会结束延后;开着 **自动归档我完成的任务** 时你自己完成这个任务,也一样;
+- 从别处打开这个任务不会把它标为已读,也不会结束延后。任务页头会显示它何时回来,点开可以让它现在回来(`H`)或修改时间。
+
+延后只影响你自己的收件箱。所有延后的任务都在视图里的 **已延后** 中,也可以从收件箱菜单的 **查看已延后** 进入。
+
## 通知何时离开收件箱
通知不会因为已读而离开收件箱。只有以下几种情况,一行才会移出:
- 你手动归档它:在它所在的行、悬停卡片、任务页头,或通过批量操作;
+- 你延后了它的任务。这是暂时的:到你选的时间,或有需要你处理的通知时,它会回来。见上方的「延后任务」;
- 你亲自把它的任务改为 `done` 或 `closed` 分类下的任一状态,且**自动归档我完成的任务**处于开启状态(默认开启)。只归档你自己在该任务上的通知,无论是否已读。别人或智能体完成的任务,通知会留在你的收件箱里,你仍能看到这个变化;
- 它是"运行失败"通知,且任务进入交回给人的状态:`in_review`、`started` 分类下的自定义状态,或 `done`、`closed` 分类下的任一状态。这会归档所有人在该任务上的"运行失败"通知,不论是谁改的状态,也不受上面的开关影响。`blocked` 例外:它同样交回给人,但工作还卡着,之前的失败记录还要看。
diff --git a/apps/docs/content/docs/shortcuts.fr.mdx b/apps/docs/content/docs/shortcuts.fr.mdx
index 88e1782b85..010c699f73 100644
--- a/apps/docs/content/docs/shortcuts.fr.mdx
+++ b/apps/docs/content/docs/shortcuts.fr.mdx
@@ -36,12 +36,13 @@ Choisir un résultat l'ouvre. Maintenez `⌘` (`Ctrl` sous Windows et Linux) en
| Demander à Multica | `⇧⌘J` | `Ctrl+Maj+J` | Démarre une nouvelle discussion dans la fenêtre flottante. |
| Rechercher dans la tâche | `⌘F` | `Ctrl+F` | Voir plus bas. |
| Archiver la notification | `E` | `E` | Sur une tâche ouverte depuis la boîte de réception, archive sa notification et ouvre la suivante. Dans les notifications archivées, restaure celle qui est ouverte. Voir [Boîte de réception](/inbox#traiter-les-notifications). |
+| Reporter la notification | `H` | `H` | Sur une tâche ouverte depuis la boîte de réception, la reporte et ouvre la suivante. Sur une tâche reportée, la fait revenir maintenant. |
| Envoyer | `⌘↵` | `Ctrl+Enter` | Envoie commentaires et messages de discussion, et sert aussi à créer des tâches. |
| Saisie vocale | Non défini | Non défini | Desktop uniquement ; activez-la d’abord dans Paramètres → Saisie vocale. Voir [Saisie vocale](/desktop-app#saisie-vocale). |
| Revenir en arrière | `⌘[` | `Ctrl+[` | |
| Avancer | `⌘]` | `Ctrl+]` | |
-Les raccourcis à une seule touche (`C`, `E`) et Revenir en arrière / Avancer ne réagissent pas pendant que vous tapez dans un champ.
+Les raccourcis à une seule touche (`C`, `E`, `H`) et Revenir en arrière / Avancer ne réagissent pas pendant que vous tapez dans un champ.
Le groupe **Navigation** propose aussi d'aller à la boîte de réception, aux discussions, à Mes tâches, aux tâches, aux projets, aux automatisations, aux agents, aux squads, aux statistiques, aux runtimes, aux skills et aux paramètres. Aucune de ces actions n'a de touche par défaut : attribuez-en à celles que vous utilisez. Aller à la boîte de réception ouvre la page Boîte de réception ; la liste des notifications elle-même est la première section du panneau Travail. Aller à Mes tâches ouvre la page Mes tâches, qui n'est pas la vue **Mon travail** du panneau Travail.
diff --git a/apps/docs/content/docs/shortcuts.ja.mdx b/apps/docs/content/docs/shortcuts.ja.mdx
index 397f7363b9..49432528fd 100644
--- a/apps/docs/content/docs/shortcuts.ja.mdx
+++ b/apps/docs/content/docs/shortcuts.ja.mdx
@@ -36,12 +36,13 @@ import { Step, Steps } from "fumadocs-ui/components/steps";
| Multica に質問 | `⇧⌘J` | `Ctrl+Shift+J` | フローティングチャットで新しいチャットを始めます。 |
| タスク内を検索 | `⌘F` | `Ctrl+F` | 後述。 |
| 通知をアーカイブ | `E` | `E` | インボックスから開いたタスクで、その通知をアーカイブして次の通知を開きます。アーカイブ済みの通知を表示中は、開いている通知のアーカイブを解除します。[インボックス](/inbox#通知の処理)を参照してください。 |
+| 通知をスヌーズ | `H` | `H` | インボックスから開いたタスクをスヌーズして、次の通知を開きます。スヌーズ中のタスクでは今すぐ戻します。 |
| 送信 | `⌘↵` | `Ctrl+Enter` | コメントやチャットのメッセージを送信します。新しいタスクの作成にも使います。 |
| 音声入力 | 未設定 | 未設定 | Desktop のみ。先に設定 → 音声入力でオンにしてください。[音声入力](/desktop-app#音声入力)を参照。 |
| 戻る | `⌘[` | `Ctrl+[` | |
| 進む | `⌘]` | `Ctrl+]` | |
-1 キーだけのショートカット(`C`、`E`)と「戻る」「進む」は、入力欄で文字を打っている間は反応しません。
+1 キーだけのショートカット(`C`、`E`、`H`)と「戻る」「進む」は、入力欄で文字を打っている間は反応しません。
**ナビゲーション**には、インボックス、チャット、自分のタスク、タスク、プロジェクト、自動化、エージェント、Squads、使用量、ランタイム、Skills、設定へ移動する操作もあります。どれも既定ではキーが割り当てられていないので、よく使うものに設定してください。インボックスへの移動で開くのはインボックスページで、通知のリスト自体は作業パネルの最初のセクションにあります。自分のタスクへの移動で開くのはマイタスクのページで、作業パネルの **自分の作業** ビューとは別のものです。
diff --git a/apps/docs/content/docs/shortcuts.ko.mdx b/apps/docs/content/docs/shortcuts.ko.mdx
index cf07c73d9d..594fda3c0b 100644
--- a/apps/docs/content/docs/shortcuts.ko.mdx
+++ b/apps/docs/content/docs/shortcuts.ko.mdx
@@ -36,12 +36,13 @@ import { Step, Steps } from "fumadocs-ui/components/steps";
| Multica에 묻기 | `⇧⌘J` | `Ctrl+Shift+J` | 플로팅 채팅 창에서 새 채팅을 시작합니다. |
| 태스크에서 찾기 | `⌘F` | `Ctrl+F` | 아래 설명 참고. |
| 알림 보관 | `E` | `E` | 인박스에서 연 태스크에서 그 알림을 보관하고 다음 알림을 엽니다. 보관된 알림을 보는 중에는 열어 둔 알림의 보관을 해제합니다. [인박스](/inbox#알림-처리)를 참고하세요. |
+| 알림 미루기 | `H` | `H` | 인박스에서 연 태스크를 미루고 다음 알림을 엽니다. 미뤄둔 태스크에서는 지금 되돌립니다. |
| 보내기 | `⌘↵` | `Ctrl+Enter` | 댓글과 채팅 메시지를 보내고, 새 태스크를 만들 때도 씁니다. |
| 음성 입력 | 지정 안 됨 | 지정 안 됨 | Desktop 전용. 먼저 설정 → 음성 입력에서 켜세요. [음성 입력](/desktop-app#음성-입력)을 참고하세요. |
| 뒤로 가기 | `⌘[` | `Ctrl+[` | |
| 앞으로 가기 | `⌘]` | `Ctrl+]` | |
-키 하나짜리 단축키(`C`, `E`)와 뒤로 가기·앞으로 가기는 입력란에서 글을 쓰는 동안에는 동작하지 않습니다.
+키 하나짜리 단축키(`C`, `E`, `H`)와 뒤로 가기·앞으로 가기는 입력란에서 글을 쓰는 동안에는 동작하지 않습니다.
**탐색** 그룹에는 인박스, 채팅, 내 태스크, 태스크, 프로젝트, 자동화, 에이전트, 스쿼드, 사용량, 런타임, Skills, 설정으로 이동하는 동작도 있습니다. 모두 기본 키가 없으니 자주 쓰는 것에 직접 지정하세요. 인박스로 이동하면 인박스 페이지가 열리며, 알림 목록 자체는 작업 패널의 첫 번째 섹션에 있습니다. 내 태스크로 이동하면 내 태스크 페이지가 열리며, 작업 패널의 **내 작업** 뷰와는 다릅니다.
diff --git a/apps/docs/content/docs/shortcuts.mdx b/apps/docs/content/docs/shortcuts.mdx
index 0f8ae66c58..915f369045 100644
--- a/apps/docs/content/docs/shortcuts.mdx
+++ b/apps/docs/content/docs/shortcuts.mdx
@@ -36,12 +36,13 @@ Selecting a result opens it. Hold `⌘` (`Ctrl` on Windows and Linux) while clic
| Ask Multica | `⇧⌘J` | `Ctrl+Shift+J` | Starts a new chat in the floating window. |
| Find in issue | `⌘F` | `Ctrl+F` | See below. |
| Archive notification | `E` | `E` | On an issue opened from the inbox, archives its notification and opens the next one. In archived notifications, restores the open one. See [Inbox](/inbox#handle-notifications). |
+| Snooze notification | `H` | `H` | On an issue opened from the inbox, snoozes it and opens the next one. On a snoozed issue, brings it back now. See [Inbox](/inbox#snooze-an-issue). |
| Send | `⌘↵` | `Ctrl+Enter` | Sends comments and chat messages, and also submits new issues. |
| Voice input | Unassigned | Unassigned | Desktop only; turn it on first under Settings → Voice input. See [Voice input](/desktop-app#voice-input). |
| Go back | `⌘[` | `Ctrl+[` | |
| Go forward | `⌘]` | `Ctrl+]` | |
-Single-key shortcuts (`C`, `E`) and Go back / Go forward don't fire while you're typing in an input.
+Single-key shortcuts (`C`, `E`, `H`) and Go back / Go forward don't fire while you're typing in an input.
The **Navigation** group also has Go to Inbox, Chat, My Issues, Issues, Projects, Autopilot, Agents, Squads, Usage, Runtimes, Skills, and Settings. None of them has a key by default; bind the ones you use. Go to Inbox opens the Inbox page; the notification list itself is the first section of the Work panel. Go to My Issues opens the My Issues page, which is not the same as the **My work** view in the Work panel.
diff --git a/apps/docs/content/docs/shortcuts.zh-Hant.mdx b/apps/docs/content/docs/shortcuts.zh-Hant.mdx
index 76ce031679..cb188dd5f5 100644
--- a/apps/docs/content/docs/shortcuts.zh-Hant.mdx
+++ b/apps/docs/content/docs/shortcuts.zh-Hant.mdx
@@ -36,12 +36,13 @@ import { Step, Steps } from "fumadocs-ui/components/steps";
| 問 Multica | `⇧⌘J` | `Ctrl+Shift+J` | 在懸浮聊天窗裡開始新對話。 |
| 在任務中查詢 | `⌘F` | `Ctrl+F` | 見下文。 |
| 歸檔通知 | `E` | `E` | 在從收件箱開啟的任務上,歸檔它的通知並開啟下一條;檢視已歸檔時則取消歸檔當前開啟的通知。見[收件箱](/inbox#處理通知)。 |
+| 延後通知 | `H` | `H` | 在從收件箱開啟的任務上,延後它並開啟下一條;已延後的任務則讓它現在回來。 |
| 傳送 | `⌘↵` | `Ctrl+Enter` | 傳送評論和聊天訊息,也用於提交新任務。 |
| 語音輸入 | 未設定 | 未設定 | 僅 Desktop;先在設定 → 語音輸入中啟用。見[語音輸入](/desktop-app#語音輸入)。 |
| 後退 | `⌘[` | `Ctrl+[` | |
| 前進 | `⌘]` | `Ctrl+]` | |
-單鍵快捷鍵(`C`、`E`)和後退、前進在輸入框裡不起作用,避免打字時誤觸。
+單鍵快捷鍵(`C`、`E`、`H`)和後退、前進在輸入框裡不起作用,避免打字時誤觸。
**導航**類操作還有前往收件箱、聊天、我的任務、任務、專案、自動化、AI 代理、小隊、統計、執行時、Skills 和設定,預設都沒有設定按鍵,需要時自己繫結。前往收件箱開啟的是收件箱頁面,通知列表本身是工作面板的第一個分區。前往我的任務開啟的是"我的任務"頁面,和工作面板裡的**我的工作**檢視不是一回事。
diff --git a/apps/docs/content/docs/shortcuts.zh.mdx b/apps/docs/content/docs/shortcuts.zh.mdx
index a90a57d374..f97ace73d1 100644
--- a/apps/docs/content/docs/shortcuts.zh.mdx
+++ b/apps/docs/content/docs/shortcuts.zh.mdx
@@ -36,12 +36,13 @@ import { Step, Steps } from "fumadocs-ui/components/steps";
| 问 Multica | `⇧⌘J` | `Ctrl+Shift+J` | 在悬浮聊天窗里开始新对话。 |
| 在任务中查找 | `⌘F` | `Ctrl+F` | 见下文。 |
| 归档通知 | `E` | `E` | 在从收件箱打开的任务上,归档它的通知并打开下一条;查看已归档时则取消归档当前打开的通知。见[收件箱](/inbox#处理通知)。 |
+| 延后通知 | `H` | `H` | 在从收件箱打开的任务上,延后它并打开下一条;已延后的任务则让它现在回来。 |
| 发送 | `⌘↵` | `Ctrl+Enter` | 发送评论和聊天消息,也用于提交新任务。 |
| 语音输入 | 未设置 | 未设置 | 仅 Desktop;先在设置 → 语音输入中开启。见[语音输入](/desktop-app#语音输入)。 |
| 后退 | `⌘[` | `Ctrl+[` | |
| 前进 | `⌘]` | `Ctrl+]` | |
-单键快捷键(`C`、`E`)和后退、前进在输入框里不起作用,避免打字时误触。
+单键快捷键(`C`、`E`、`H`)和后退、前进在输入框里不起作用,避免打字时误触。
**导航**类操作还有前往收件箱、聊天、我的任务、任务、项目、自动化、智能体、小队、统计、运行时、Skills 和设置,默认都没有设置按键,需要时自己绑定。前往收件箱打开的是收件箱页面,通知列表本身是工作面板的第一个分区。前往我的任务打开的是"我的任务"页面,和工作面板里的**我的工作**视图不是一回事。
diff --git a/packages/core/api/client.ts b/packages/core/api/client.ts
index f7bf5f7812..b4740996bb 100644
--- a/packages/core/api/client.ts
+++ b/packages/core/api/client.ts
@@ -57,6 +57,7 @@ import type {
UpdateRuntimeProfileRequest,
InboxItem,
InboxWorkspaceUnread,
+ SnoozedInboxIssue,
IssueSubscriber,
IssueUnread,
Comment,
@@ -483,9 +484,11 @@ import {
IssueInboxReadSchema,
InboxDeleteSchema,
InboxItemListSchema,
+ SnoozedInboxListSchema,
ArchivedInboxPageSchema,
ArchivedInboxFacetsSchema,
EMPTY_INBOX_ITEMS,
+ EMPTY_SNOOZED_INBOX,
NotificationPreferenceResponseSchema,
EMPTY_NOTIFICATION_PREFERENCE_RESPONSE,
LabelSchema,
@@ -3219,6 +3222,26 @@ export class ApiClient {
return this.fetch(`/api/inbox/${id}/unarchive`, { method: "POST" });
}
+ // The viewer's snoozed issues, soonest back first (MUL-9333).
+ async listSnoozedInbox(): Promise<SnoozedInboxIssue[]> {
+ const raw = await this.fetch<unknown>("/api/inbox/snoozed");
+ return parseWithFallback(raw, SnoozedInboxListSchema, EMPTY_SNOOZED_INBOX, {
+ endpoint: "GET /api/inbox/snoozed",
+ });
+ }
+
+ // Snooze the item's issue until `until` (an ISO time). Snoozing a snoozed
+ // issue changes its time.
+ async snoozeInbox(id: string, until: string): Promise<{ issue_id: string; snoozed_until: string }> {
+ return this.fetch(`/api/inbox/${id}/snooze`, { method: "POST", body: JSON.stringify({ until }) });
+ }
+
+ // End the snooze on the item's issue. `read` restores it as read: undoing a
+ // snooze puts back the state it had.
+ async unsnoozeInbox(id: string, options: { read?: boolean } = {}): Promise<{ issue_id: string }> {
+ return this.fetch(`/api/inbox/${id}/unsnooze`, { method: "POST", body: JSON.stringify({ read: options.read ?? false }) });
+ }
+
// Cross-workspace unread summary: one entry per workspace the user belongs
// to that has unread inbox items. Backs the workspace-switcher dot for
// OTHER workspaces. Schema-guarded so a contract drift hides the dot rather
diff --git a/packages/core/api/schemas.ts b/packages/core/api/schemas.ts
index 068df9964c..092595a49c 100644
--- a/packages/core/api/schemas.ts
+++ b/packages/core/api/schemas.ts
@@ -64,6 +64,7 @@ import type {
IssueEnvironmentsResponse,
IssuePullRequestSummariesResponse,
InboxItem,
+ SnoozedInboxIssue,
InboxWorkspaceUnread,
IssueUnread,
Label,
@@ -3218,6 +3219,22 @@ export const InboxItemListSchema = z.array(
read: z.boolean(),
archived: z.boolean(),
created_at: z.string(),
+ snoozed_until: z.string().nullish(),
+ snoozed_at: z.string().nullish(),
+ })
+ .loose(),
+);
+
+// The viewer's snoozed issues (`/api/inbox/snoozed` GET). A malformed body
+// reads as nothing snoozed.
+export const SnoozedInboxListSchema = z.array(
+ z
+ .object({
+ issue_id: z.string(),
+ item_id: z.string(),
+ snoozed_until: z.string(),
+ snoozed_at: z.string(),
+ updates: z.number().int().nonnegative(),
})
.loose(),
);
@@ -3251,6 +3268,7 @@ export const ArchivedInboxFacetsSchema = z.object({
}));
export const EMPTY_INBOX_ITEMS: InboxItem[] = [];
+export const EMPTY_SNOOZED_INBOX: SnoozedInboxIssue[] = [];
// Billing schemas (cloud-billing proxy surface)
//
diff --git a/packages/core/inbox/filters.ts b/packages/core/inbox/filters.ts
index 55af93497c..1d6f3ec169 100644
--- a/packages/core/inbox/filters.ts
+++ b/packages/core/inbox/filters.ts
@@ -7,6 +7,7 @@ import {
} from "../issues/stores/filter-tree";
import type { InboxItem, InboxItemType, IssuePriority, IssueStatus } from "../types";
import { groupInboxRows, sortInboxNewestFirst, withCommentAnchor } from "./group";
+import { isInboxItemSnoozed } from "./snooze";
/**
* Notification kinds, grouped the way a reader thinks about them. Mirrored by
@@ -565,6 +566,8 @@ export function filterInboxItems(
const tests = compile(filters, now);
const out: InboxItem[] = [];
for (const group of groupInboxRows(items)) {
+ // Snoozed since the list loaded; the server leaves the rest out.
+ if (group[0] && isInboxItemSnoozed(group[0], now.getTime())) continue;
const row = group.find((item) => passes(tests.notification, item));
if (!row || !passes(tests.issue, row)) continue;
const key = row.issue_id ?? row.id;
diff --git a/packages/core/inbox/group.ts b/packages/core/inbox/group.ts
index 0deced7111..46803f4106 100644
--- a/packages/core/inbox/group.ts
+++ b/packages/core/inbox/group.ts
@@ -1,4 +1,5 @@
import type { InboxItem } from "../types";
+import { inboxRowTime } from "./snooze";
function byNewest(a: InboxItem, b: InboxItem): number {
return new Date(b.created_at).getTime() - new Date(a.created_at).getTime();
@@ -62,16 +63,22 @@ export function withCommentAnchor(
return { ...row, details: target ? { ...details, comment_id: target } : details };
}
-/** One row per issue: its newest notification. Newest group first. */
+/**
+ * One row per issue: its newest notification. Newest group first, where an
+ * issue back from a snooze counts from when it came back.
+ */
export function groupInboxItemsByIssue(
items: readonly InboxItem[],
options?: InboxAnchorOptions,
): InboxItem[] {
+ const now = Date.now();
return groupInboxRows(items)
.flatMap((group) => (group[0] ? [withCommentAnchor(group[0], group, options)] : []))
- .sort(byNewest);
+ .sort((a, b) => inboxRowTime(b, now) - inboxRowTime(a, now));
}
+/** Newest first, where an issue back from a snooze counts from when it came back. */
export function sortInboxNewestFirst(items: InboxItem[]): InboxItem[] {
- return items.sort(byNewest);
+ const now = Date.now();
+ return items.sort((a, b) => inboxRowTime(b, now) - inboxRowTime(a, now));
}
diff --git a/packages/core/inbox/index.ts b/packages/core/inbox/index.ts
index 870d3e34b7..bffe60d4c3 100644
--- a/packages/core/inbox/index.ts
+++ b/packages/core/inbox/index.ts
@@ -1,3 +1,4 @@
export * from "./queries";
export * from "./mutations";
export * from "./ws-updaters";
+export * from "./snooze";
diff --git a/packages/core/inbox/mutations.ts b/packages/core/inbox/mutations.ts
index 72d3d3160e..c9756a16b4 100644
--- a/packages/core/inbox/mutations.ts
+++ b/packages/core/inbox/mutations.ts
@@ -4,7 +4,7 @@ import { api } from "../api";
import { inboxKeys, mapArchivedInboxCache, patchArchivedInboxCaches, type ArchivedInboxCache } from "./queries";
import { onInboxInvalidate, onInboxSummaryInvalidate } from "./ws-updaters";
import { useWorkspaceId } from "../hooks";
-import type { InboxItem } from "../types";
+import type { InboxItem, SnoozedInboxIssue } from "../types";
/**
* Refresh workspace inbox lists and the account-level unread summary after a
@@ -279,3 +279,117 @@ export function useArchiveCompletedInbox() {
},
});
}
+
+/**
+ * When the issue of an inbox item is snoozed until, as far as the cache knows;
+ * null when it isn't snoozed or its time has passed.
+ */
+export function cachedInboxSnoozedUntil(qc: QueryClient, wsId: string, id: string): Date | null {
+ const snoozed = qc.getQueryData<SnoozedInboxIssue[]>(inboxKeys.snoozed(wsId));
+ const issueId = cachedInboxIssueId(qc, wsId, id) ?? snoozed?.find((entry) => entry.item_id === id)?.issue_id;
+ if (!issueId) return null;
+ const until =
+ snoozed?.find((entry) => entry.issue_id === issueId)?.snoozed_until ??
+ qc
+ .getQueryData<InboxItem[]>(inboxKeys.list(wsId))
+ ?.find((item) => item.issue_id === issueId && !item.archived && item.snoozed_until)?.snoozed_until;
+ if (!until) return null;
+ const date = new Date(until);
+ return date.getTime() > Date.now() ? date : null;
+}
+
+export interface SnoozeInboxInput {
+ /** Any notification on the issue; the snooze covers the whole issue. */
+ id: string;
+ until: Date;
+}
+
+/**
+ * Snooze an issue in the inbox until a time (MUL-9333). Optimistic: the
+ * issue's rows carry the time at once, which takes the issue out of the list
+ * (`deduplicateInboxItems`), and the Snoozed view gains or moves the entry.
+ */
+export function useSnoozeInbox() {
+ const qc = useQueryClient();
+ const wsId = useWorkspaceId();
+ return useMutation({
+ mutationFn: ({ id, until }: SnoozeInboxInput) => api.snoozeInbox(id, until.toISOString()),
+ onMutate: async ({ id, until }) => {
+ await qc.cancelQueries({ queryKey: inboxKeys.all(wsId) });
+ const prev = qc.getQueryData<InboxItem[]>(inboxKeys.list(wsId));
+ const prevSnoozed = qc.getQueryData<SnoozedInboxIssue[]>(inboxKeys.snoozed(wsId));
+ const snoozedUntil = until.toISOString();
+ const issueId =
+ cachedInboxIssueId(qc, wsId, id) ?? prevSnoozed?.find((entry) => entry.item_id === id)?.issue_id ?? null;
+ if (issueId) {
+ qc.setQueryData<InboxItem[]>(inboxKeys.list(wsId), (old) =>
+ old?.map((item) => (item.issue_id === issueId && !item.archived ? { ...item, snoozed_until: snoozedUntil } : item)),
+ );
+ qc.setQueryData<SnoozedInboxIssue[]>(inboxKeys.snoozed(wsId), (old) => {
+ if (!old) return old;
+ const existing = old.find((entry) => entry.issue_id === issueId);
+ const entry: SnoozedInboxIssue = existing
+ ? { ...existing, snoozed_until: snoozedUntil }
+ : { issue_id: issueId, item_id: id, snoozed_until: snoozedUntil, snoozed_at: new Date().toISOString(), updates: 0 };
+ return [...old.filter((other) => other.issue_id !== issueId), entry].sort(
+ (a, b) => new Date(a.snoozed_until).getTime() - new Date(b.snoozed_until).getTime(),
+ );
+ });
+ }
+ return { prev, prevSnoozed };
+ },
+ onError: (_err, _input, ctx) => {
+ if (ctx?.prev) qc.setQueryData(inboxKeys.list(wsId), ctx.prev);
+ if (ctx?.prevSnoozed) qc.setQueryData(inboxKeys.snoozed(wsId), ctx.prevSnoozed);
+ },
+ onSettled: () => {
+ refreshInboxAfterWrite(qc, wsId);
+ },
+ });
+}
+
+export interface UnsnoozeInboxInput {
+ id: string;
+ /** Restore the issue as read, for undoing a snooze on an issue that was read. */
+ read?: boolean;
+}
+
+/**
+ * End a snooze now: the issue is back in the inbox. Optimistic on the
+ * Snoozed view and on rows still in the list cache (an undo right after
+ * snoozing); the rest of the list follows the server.
+ */
+export function useUnsnoozeInbox() {
+ const qc = useQueryClient();
+ const wsId = useWorkspaceId();
+ return useMutation({
+ mutationFn: ({ id, read }: UnsnoozeInboxInput) => api.unsnoozeInbox(id, { read }),
+ onMutate: async ({ id, read }) => {
+ await qc.cancelQueries({ queryKey: inboxKeys.all(wsId) });
+ const prev = qc.getQueryData<InboxItem[]>(inboxKeys.list(wsId));
+ const prevSnoozed = qc.getQueryData<SnoozedInboxIssue[]>(inboxKeys.snoozed(wsId));
+ const issueId =
+ prevSnoozed?.find((entry) => entry.item_id === id)?.issue_id ?? cachedInboxIssueId(qc, wsId, id);
+ if (issueId) {
+ qc.setQueryData<SnoozedInboxIssue[]>(inboxKeys.snoozed(wsId), (old) =>
+ old?.filter((entry) => entry.issue_id !== issueId),
+ );
+ qc.setQueryData<InboxItem[]>(inboxKeys.list(wsId), (old) =>
+ old?.map((item) =>
+ item.issue_id === issueId && !item.archived
+ ? { ...item, snoozed_until: null, ...(read !== undefined ? { read } : {}) }
+ : item,
+ ),
+ );
+ }
+ return { prev, prevSnoozed };
+ },
+ onError: (_err, _input, ctx) => {
+ if (ctx?.prev) qc.setQueryData(inboxKeys.list(wsId), ctx.prev);
+ if (ctx?.prevSnoozed) qc.setQueryData(inboxKeys.snoozed(wsId), ctx.prevSnoozed);
+ },
+ onSettled: () => {
+ refreshInboxAfterWrite(qc, wsId);
+ },
+ });
+}
diff --git a/packages/core/inbox/queries.ts b/packages/core/inbox/queries.ts
index e1f8562f40..8465a251ec 100644
--- a/packages/core/inbox/queries.ts
+++ b/packages/core/inbox/queries.ts
@@ -2,9 +2,10 @@ import type { InfiniteData, QueryClient } from "@tanstack/react-query";
import type { ArchivedInboxPage } from "../types/inbox";
import { EMPTY_INBOX_FILTERS, archivedInboxQuery, type ArchivedInboxFilters } from "./filters";
import { groupInboxItemsByIssue } from "./group";
+import { isInboxItemSnoozed } from "./snooze";
import { infiniteQueryOptions, keepPreviousData, queryOptions, useQuery } from "@tanstack/react-query";
import { api } from "../api";
-import type { InboxItem, InboxWorkspaceUnread } from "../types";
+import type { InboxItem, InboxWorkspaceUnread, SnoozedInboxIssue } from "../types";
import { focusManager } from "@tanstack/react-query";
export const inboxKeys = {
@@ -14,6 +15,7 @@ export const inboxKeys = {
pages: (wsId: string) => [...inboxKeys.archived(wsId), "pages"] as const,
lookup: (wsId: string) => [...inboxKeys.archived(wsId), "lookup"] as const,
facets: (wsId: string) => [...inboxKeys.all(wsId), "archived-facets"] as const,
+ snoozed: (wsId: string) => [...inboxKeys.all(wsId), "snoozed"] as const,
// Account-level (not workspace-scoped): a single shared cache entry that
// holds unread counts for every workspace the user belongs to.
unreadSummary: () => ["inbox", "unread-summary"] as const,
@@ -26,6 +28,27 @@ export function inboxListOptions(wsId: string) {
});
}
+/**
+ * The viewer's snoozed issues, soonest back first. Under `inboxKeys.all`, so
+ * every inbox event refreshes it with the lists.
+ */
+export function snoozedInboxOptions(wsId: string) {
+ return queryOptions({
+ queryKey: inboxKeys.snoozed(wsId),
+ queryFn: () => api.listSnoozedInbox(),
+ });
+}
+
+/** The snoozed entry for one issue, or undefined when it is not snoozed. */
+export function findSnoozedInboxIssue(
+ snoozed: readonly SnoozedInboxIssue[] | undefined,
+ issueId: string | null | undefined,
+ now = Date.now(),
+): SnoozedInboxIssue | undefined {
+ if (!issueId) return undefined;
+ return snoozed?.find((entry) => entry.issue_id === issueId && new Date(entry.snoozed_until).getTime() > now);
+}
+
// Keyed by the request parameters themselves: an `agent` selection carried in
// from the active inbox never changes the key, and the relative windows
// (received, due date) re-key when the day turns.
@@ -203,7 +226,10 @@ export function useInboxUnreadCount(
* (to avoid new array references on every cache update).
*/
export function deduplicateInboxItems(items: InboxItem[]): InboxItem[] {
- return groupInboxItemsByIssue(items.filter((i) => !i.archived));
+ // The server leaves snoozed issues out; this drops the ones snoozed since the
+ // list loaded, optimistically or by a row that joined a snooze.
+ const now = Date.now();
+ return groupInboxItemsByIssue(items.filter((i) => !i.archived && !isInboxItemSnoozed(i, now)));
}
/**
diff --git a/packages/core/inbox/snooze.test.ts b/packages/core/inbox/snooze.test.ts
new file mode 100644
index 0000000000..28fc0237a0
--- /dev/null
+++ b/packages/core/inbox/snooze.test.ts
@@ -0,0 +1,87 @@
+// @vitest-environment node
+import { describe, expect, it } from "vitest";
+import {
+ inboxRowTime,
+ inboxSnoozeOptions,
+ inboxSnoozeReturnedAt,
+ inboxSnoozePickedTime,
+ isInboxItemSnoozed,
+} from "./snooze";
+
+// Local-time constructors on purpose: the choices are in the viewer's zone.
+const at = (y: number, m: number, d: number, h: number, min = 0) => new Date(y, m - 1, d, h, min);
+
+describe("inboxSnoozeOptions", () => {
+ it("offers one and three hours, then one day, three days and a week at the same time", () => {
+ // A Monday.
+ expect(inboxSnoozeOptions(at(2026, 11, 16, 14, 20))).toEqual([
+ { preset: "hours_1", until: at(2026, 11, 16, 15, 20) },
+ { preset: "hours_3", until: at(2026, 11, 16, 17, 20) },
+ { preset: "days_1", until: at(2026, 11, 17, 14, 20) },
+ { preset: "days_3", until: at(2026, 11, 19, 14, 20) },
+ { preset: "weeks_1", until: at(2026, 11, 23, 14, 20) },
+ ]);
+ });
+
+ it("brings days back in the morning when snoozed at night", () => {
+ expect(inboxSnoozeOptions(at(2026, 11, 16, 23, 40))).toEqual([
+ { preset: "hours_1", until: at(2026, 11, 17, 0, 40) },
+ { preset: "hours_3", until: at(2026, 11, 17, 2, 40) },
+ { preset: "days_1", until: at(2026, 11, 17, 9) },
+ { preset: "days_3", until: at(2026, 11, 19, 9) },
+ { preset: "weeks_1", until: at(2026, 11, 23, 9) },
+ ]);
+ // After midnight a day is still counted from today.
+ expect(inboxSnoozeOptions(at(2026, 11, 17, 1, 30))[2]?.until).toEqual(at(2026, 11, 18, 9));
+ });
+
+ it("keeps the clock time across the end of daylight saving", () => {
+ // Calendar days, not 24-hour steps: 9:30 stays 9:30 whatever the zone does.
+ expect(inboxSnoozeOptions(at(2026, 10, 31, 9, 30))[4]?.until).toEqual(at(2026, 11, 7, 9, 30));
+ });
+});
+
+describe("inboxSnoozePickedTime", () => {
+ const now = at(2026, 11, 16, 14, 20);
+
+ it("joins the picked day and time", () => {
+ expect(inboxSnoozePickedTime(at(2026, 11, 20, 0), "09:00", now)).toEqual(at(2026, 11, 20, 9));
+ expect(inboxSnoozePickedTime(at(2026, 11, 16, 0), "16:45", now)).toEqual(at(2026, 11, 16, 16, 45));
+ });
+
+ it("refuses a time that is not in the future", () => {
+ expect(inboxSnoozePickedTime(at(2026, 11, 16, 0), "14:20", now)).toBeNull();
+ expect(inboxSnoozePickedTime(at(2026, 11, 16, 0), "09:00", now)).toBeNull();
+ });
+
+ it("refuses a time past the server's limit, and a time it cannot read", () => {
+ expect(inboxSnoozePickedTime(at(2027, 12, 1, 0), "09:00", now)).toBeNull();
+ expect(inboxSnoozePickedTime(at(2026, 11, 20, 0), "", now)).toBeNull();
+ });
+});
+
+describe("snooze state of a row", () => {
+ const now = at(2026, 6, 17, 9, 2).getTime();
+ const row = (created: Date, snoozedUntil: Date | null) => ({
+ created_at: created.toISOString(),
+ snoozed_until: snoozedUntil ? snoozedUntil.toISOString() : null,
+ });
+
+ it("is snoozed only until its time", () => {
+ expect(isInboxItemSnoozed(row(at(2026, 6, 16, 10), at(2026, 6, 17, 10)), now)).toBe(true);
+ expect(isInboxItemSnoozed(row(at(2026, 6, 16, 10), at(2026, 6, 17, 9)), now)).toBe(false);
+ expect(isInboxItemSnoozed(row(at(2026, 6, 16, 10), null), now)).toBe(false);
+ });
+
+ it("sorts a row back from a snooze by when it came back", () => {
+ const back = row(at(2026, 6, 16, 10), at(2026, 6, 17, 9));
+ expect(inboxSnoozeReturnedAt(back, now)).toBe(at(2026, 6, 17, 9).getTime());
+ expect(inboxRowTime(back, now)).toBe(at(2026, 6, 17, 9).getTime());
+ });
+
+ it("reads a row written after the snooze ran out as itself", () => {
+ const later = row(at(2026, 6, 17, 9, 1), at(2026, 6, 17, 9));
+ expect(inboxSnoozeReturnedAt(later, now)).toBeNull();
+ expect(inboxRowTime(later, now)).toBe(at(2026, 6, 17, 9, 1).getTime());
+ });
+});
diff --git a/packages/core/inbox/snooze.ts b/packages/core/inbox/snooze.ts
new file mode 100644
index 0000000000..a81834bd32
--- /dev/null
+++ b/packages/core/inbox/snooze.ts
@@ -0,0 +1,96 @@
+import type { InboxItem } from "../types";
+
+/** How long the Inbox offers to snooze an issue for. */
+export type InboxSnoozePreset = "hours_1" | "hours_3" | "days_1" | "days_3" | "weeks_1";
+
+export interface InboxSnoozeOption {
+ preset: InboxSnoozePreset;
+ until: Date;
+}
+
+/** The server refuses a snooze further out than this. */
+export const INBOX_SNOOZE_MAX_DAYS = 366;
+
+/** Where the date picker's time starts, and where a day-long snooze made at night lands. */
+export const INBOX_SNOOZE_MORNING = "09:00";
+
+const MORNING_HOUR = 9;
+// A snooze of a day or more made between these hours comes back in the morning.
+const NIGHT_START_HOUR = 22;
+const NIGHT_END_HOUR = 6;
+const HOUR_MS = 60 * 60 * 1000;
+
+const PRESETS: { preset: InboxSnoozePreset; hours?: number; days?: number }[] = [
+ { preset: "hours_1", hours: 1 },
+ { preset: "hours_3", hours: 3 },
+ { preset: "days_1", days: 1 },
+ { preset: "days_3", days: 3 },
+ { preset: "weeks_1", days: 7 },
+];
+
+/**
+ * Snooze choices for `now`, in the viewer's own time zone, soonest first.
+ *
+ * Hours are added as they are. Days keep the clock time, counted in calendar
+ * days so a daylight-saving change does not shift it, except at night, when
+ * the same time days later would be the middle of a night too: then they land
+ * at 9:00.
+ */
+export function inboxSnoozeOptions(now: Date): InboxSnoozeOption[] {
+ const hour = now.getHours();
+ const night = hour >= NIGHT_START_HOUR || hour < NIGHT_END_HOUR;
+ return PRESETS.map(({ preset, hours, days }) => {
+ if (hours) return { preset, until: new Date(now.getTime() + hours * HOUR_MS) };
+ const until = new Date(now);
+ until.setDate(until.getDate() + (days ?? 0));
+ if (night) until.setHours(MORNING_HOUR, 0, 0, 0);
+ return { preset, until };
+ });
+}
+
+/**
+ * The time a day picked on the calendar and an "HH:MM" make, or null when it
+ * cannot be snoozed until: not in the future, or past the server's limit.
+ */
+export function inboxSnoozePickedTime(day: Date, time: string, now: Date): Date | null {
+ const [hours, minutes] = time.split(":").map(Number);
+ if (!Number.isInteger(hours) || !Number.isInteger(minutes)) return null;
+ const until = new Date(day.getFullYear(), day.getMonth(), day.getDate(), hours, minutes);
+ const at = until.getTime();
+ if (at <= now.getTime()) return null;
+ if (at > now.getTime() + INBOX_SNOOZE_MAX_DAYS * 24 * HOUR_MS) return null;
+ return until;
+}
+
+function snoozeTime(item: Pick<InboxItem, "snoozed_until">): number | null {
+ if (!item.snoozed_until) return null;
+ const at = new Date(item.snoozed_until).getTime();
+ return Number.isNaN(at) ? null : at;
+}
+
+/** Whether the row is out of the inbox at `now`: snoozed until later. */
+export function isInboxItemSnoozed(item: Pick<InboxItem, "snoozed_until">, now = Date.now()): boolean {
+ const at = snoozeTime(item);
+ return at !== null && at > now;
+}
+
+/**
+ * When the row came back from a snooze on its own, or null. A row written
+ * after the snooze ran out is newer than that and reads as itself.
+ */
+export function inboxSnoozeReturnedAt(
+ item: Pick<InboxItem, "snoozed_until" | "created_at">,
+ now = Date.now(),
+): number | null {
+ const at = snoozeTime(item);
+ if (at === null || at > now) return null;
+ return at > new Date(item.created_at).getTime() ? at : null;
+}
+
+/**
+ * Where a row sorts in the inbox: when it arrived, or when it came back from a
+ * snooze, whichever is later. An issue back from a snooze is on top.
+ */
+export function inboxRowTime(item: Pick<InboxItem, "snoozed_until" | "created_at">, now = Date.now()): number {
+ return inboxSnoozeReturnedAt(item, now) ?? new Date(item.created_at).getTime();
+}
diff --git a/packages/core/inbox/use-snooze-wake.ts b/packages/core/inbox/use-snooze-wake.ts
new file mode 100644
index 0000000000..9982b9dcf6
--- /dev/null
+++ b/packages/core/inbox/use-snooze-wake.ts
@@ -0,0 +1,50 @@
+import { useEffect, useState } from "react";
+import { focusManager, useQuery, useQueryClient } from "@tanstack/react-query";
+import { snoozedInboxOptions } from "./queries";
+import { onInboxInvalidate, onInboxSummaryInvalidate } from "./ws-updaters";
+
+// setTimeout overflows past 2^31 - 1 ms (~24.8 days); a longer wait re-arms.
+const MAX_TIMER_MS = 24 * 60 * 60 * 1000;
+// The server compares against its own clock; give it a moment past the time.
+const WAKE_SLACK_MS = 1500;
+
+/**
+ * Brings a snoozed issue back when its time comes (MUL-9333). Nothing on the
+ * server announces it, so this refreshes the inbox lists and the unread
+ * summary at the earliest snooze time, and again when the page is shown after
+ * that time passed unseen (a sleeping laptop holds timers back).
+ *
+ * Mount once per workspace, where it stays mounted with the badge.
+ */
+export function useInboxSnoozeWake(wsId: string | null | undefined) {
+ const qc = useQueryClient();
+ const { data: snoozed } = useQuery({ ...snoozedInboxOptions(wsId ?? ""), enabled: !!wsId });
+ const [tick, setTick] = useState(0);
+
+ const nextWake = snoozed?.reduce<number | null>((min, entry) => {
+ const at = new Date(entry.snoozed_until).getTime();
+ if (Number.isNaN(at)) return min;
+ return min === null || at < min ? at : min;
+ }, null) ?? null;
+
+ useEffect(() => {
+ if (!wsId || nextWake === null) return;
+ const wake = () => {
+ void onInboxInvalidate(qc, wsId);
+ void onInboxSummaryInvalidate(qc);
+ };
+ const delay = nextWake - Date.now() + WAKE_SLACK_MS;
+ if (delay <= 0) {
+ wake();
+ return;
+ }
+ const timer = setTimeout(delay > MAX_TIMER_MS ? () => setTick((n) => n + 1) : wake, Math.min(delay, MAX_TIMER_MS));
+ const unsubscribe = focusManager.subscribe((focused) => {
+ if (focused && Date.now() >= nextWake) wake();
+ });
+ return () => {
+ clearTimeout(timer);
+ unsubscribe();
+ };
+ }, [qc, wsId, nextWake, tick]);
+}
diff --git a/packages/core/issue-views/sidebar-views.hook.test.tsx b/packages/core/issue-views/sidebar-views.hook.test.tsx
index 2d80d44500..dba3f530cc 100644
--- a/packages/core/issue-views/sidebar-views.hook.test.tsx
+++ b/packages/core/issue-views/sidebar-views.hook.test.tsx
@@ -58,10 +58,25 @@ describe("useSidebarViews writes", () => {
expect(putIssueViewPreference.mock.calls[0]![0].prefs.order).toEqual([
"builtin:my_work",
"view:a",
+ "builtin:snoozed",
"view:b",
]);
});
+ it("remembers a removed Snoozed so it is not added back", async () => {
+ const { result } = setup(preference(["builtin:subscribed", "view:a"]));
+ await waitFor(() => expect(result.current.isStarred("view:a")).toBe(true));
+ expect(result.current.isStarred("builtin:snoozed")).toBe(true);
+
+ act(() => result.current.unstar("builtin:snoozed"));
+
+ await waitFor(() => expect(putIssueViewPreference).toHaveBeenCalledTimes(1));
+ expect(putIssueViewPreference.mock.calls[0]![0].prefs).toEqual({
+ hidden: ["builtin:snoozed"],
+ order: ["builtin:subscribed", "view:a"],
+ });
+ });
+
it("does not write a default order before the views behind it have loaded", async () => {
const { result } = setup(preference([], ""));
await waitFor(() => expect(result.current.isStarred("builtin:all_issues")).toBe(true));
diff --git a/packages/core/issue-views/sidebar-views.test.ts b/packages/core/issue-views/sidebar-views.test.ts
index bf7baf6cdd..88365fa8cc 100644
--- a/packages/core/issue-views/sidebar-views.test.ts
+++ b/packages/core/issue-views/sidebar-views.test.ts
@@ -5,6 +5,7 @@ import {
migrateSidebarViewOrder,
reorderSidebarViewOrder,
resolveSidebarViewItems,
+ withLaterBuiltins,
} from "./sidebar-views";
const view = (id: string, owner_id: string): IssueView => ({
@@ -32,6 +33,7 @@ describe("defaultSidebarViewOrder", () => {
"builtin:my_work",
"builtin:working",
"builtin:subscribed",
+ "builtin:snoozed",
"view:a",
"view:c",
]);
@@ -82,6 +84,31 @@ describe("migrateSidebarViewOrder", () => {
});
});
+describe("withLaterBuiltins", () => {
+ it("adds Snoozed after Subscribed to an order saved before it existed", () => {
+ expect(withLaterBuiltins(["builtin:subscribed", "view:a"], [])).toEqual([
+ "builtin:subscribed",
+ "builtin:snoozed",
+ "view:a",
+ ]);
+ });
+
+ it("puts it after the last built-in when Subscribed was removed", () => {
+ expect(withLaterBuiltins(["view:a", "builtin:my_work", "view:b"], [])).toEqual([
+ "view:a",
+ "builtin:my_work",
+ "builtin:snoozed",
+ "view:b",
+ ]);
+ });
+
+ it("leaves an order that holds it, or hid it, alone", () => {
+ const moved = ["builtin:snoozed", "builtin:subscribed"];
+ expect(withLaterBuiltins(moved, [])).toEqual(moved);
+ expect(withLaterBuiltins(["builtin:subscribed"], ["builtin:snoozed"])).toEqual(["builtin:subscribed"]);
+ });
+});
+
describe("reorderSidebarViewOrder", () => {
it("moves visible ids and keeps unresolved ones in their slots", () => {
expect(
diff --git a/packages/core/issue-views/sidebar-views.ts b/packages/core/issue-views/sidebar-views.ts
index de5133a038..d4230c5acf 100644
--- a/packages/core/issue-views/sidebar-views.ts
+++ b/packages/core/issue-views/sidebar-views.ts
@@ -9,8 +9,8 @@ import { issueViewEverywhereOptions } from "./queries";
import { issueViewPreferenceOptions, useUpdateIssueViewPreference } from "./preferences";
/** The views every workspace has without saving anything. */
-export type BuiltinViewKey = "all_issues" | "my_work" | "working" | "subscribed";
-export const BUILTIN_VIEW_KEYS: readonly BuiltinViewKey[] = ["all_issues", "my_work", "working", "subscribed"];
+export type BuiltinViewKey = "all_issues" | "my_work" | "working" | "subscribed" | "snoozed";
+export const BUILTIN_VIEW_KEYS: readonly BuiltinViewKey[] = ["all_issues", "my_work", "working", "subscribed", "snoozed"];
export const builtinViewItemId = (key: BuiltinViewKey) => `builtin:${key}`;
export const savedViewItemId = (viewId: string) => `view:${viewId}`;
@@ -40,6 +40,35 @@ export function migrateSidebarViewOrder(order: readonly string[]): string[] {
return [...new Set(next)];
}
+/**
+ * Built-ins added after users began arranging the list. A saved order that
+ * has never held one gets it after the built-in it follows by default; once
+ * removed it is remembered as hidden and stays out.
+ */
+const LATER_BUILTINS: readonly { id: string; after: string }[] = [
+ { id: builtinViewItemId("snoozed"), after: builtinViewItemId("subscribed") },
+];
+
+export function withLaterBuiltins(order: readonly string[], hidden: readonly string[]): string[] {
+ const next = [...order];
+ for (const { id, after } of LATER_BUILTINS) {
+ if (next.includes(id) || hidden.includes(id)) continue;
+ const at = next.indexOf(after);
+ if (at >= 0) {
+ next.splice(at + 1, 0, id);
+ continue;
+ }
+ const lastBuiltin = next.findLastIndex((other) => other.startsWith("builtin:"));
+ next.splice(lastBuiltin + 1, 0, id);
+ }
+ return next;
+}
+
+/** The later built-ins an order leaves out, so they are not added back. */
+function hiddenLaterBuiltins(order: readonly string[]): string[] {
+ return LATER_BUILTINS.map(({ id }) => id).filter((id) => !order.includes(id));
+}
+
export const SIDEBAR_VIEWS_SCOPE = { scope_type: "sidebar" } as const;
export type SidebarViewItem =
@@ -122,7 +151,11 @@ export function useSidebarViews(wsId: string, userId: string | undefined) {
const preference = preferenceQuery.data;
const storedOrder = preference && preference.updated_at !== "" ? preference.prefs.order : null;
- const savedOrder = useMemo(() => (storedOrder ? migrateSidebarViewOrder(storedOrder) : null), [storedOrder]);
+ const storedHidden = preference && preference.updated_at !== "" ? preference.prefs.hidden : null;
+ const savedOrder = useMemo(
+ () => (storedOrder ? withLaterBuiltins(migrateSidebarViewOrder(storedOrder), storedHidden ?? []) : null),
+ [storedOrder, storedHidden],
+ );
const order = useMemo(
() =>
savedOrder ??
@@ -142,7 +175,7 @@ export function useSidebarViews(wsId: string, userId: string | undefined) {
(savedOrder !== null || (viewsQuery.isSuccess && (!userId || pinsQuery.isSuccess)));
const write = useCallback(
(next: string[]) => {
- if (ready) save({ hidden: [], order: next });
+ if (ready) save({ hidden: hiddenLaterBuiltins(next), order: next });
},
[ready, save],
);
diff --git a/packages/core/issues/sidebar-list.ts b/packages/core/issues/sidebar-list.ts
index ef6dc9e54b..cea7adbbd0 100644
--- a/packages/core/issues/sidebar-list.ts
+++ b/packages/core/issues/sidebar-list.ts
@@ -245,7 +245,7 @@ export function viewSidebarRequest(
}
/** What each built-in adds to All issues, as the issues page applies it. */
-const BUILTIN_FILTERS: Record<Exclude<BuiltinViewKey, "working">, IssueTableQuerySpec["filters"]> = {
+const BUILTIN_FILTERS: Record<Exclude<BuiltinViewKey, "working" | "snoozed">, IssueTableQuerySpec["filters"]> = {
all_issues: {},
my_work: { relations: ASSIGNEE_RELATIONS.me_and_my_agents },
subscribed: { relations: ["subscribed"] },
@@ -255,14 +255,15 @@ const BUILTIN_FILTERS: Record<Exclude<BuiltinViewKey, "working">, IssueTableQuer
* The request for an expanded built-in view: its filter, listed with the same
* status, sub-issue and ordering settings as an expanded project. The
* assignee setting is for projects only: a built-in already says whose
- * issues it lists. Working lists `workingIssueIds`, the issues agents are
- * running on, as the page does. `null` when the settings leave nothing to list.
+ * issues it lists. Working and Snoozed list `issueIds`: the issues agents are
+ * running on, as the page does, and the issues the viewer snoozed. `null` when
+ * the settings leave nothing to list.
*/
export function builtinSidebarRequest(
builtin: BuiltinViewKey,
settings: SidebarIssueSettings,
statuses: readonly StatusRef[],
- workingIssueIds: readonly string[] = [],
+ issueIds: readonly string[] = [],
): SidebarIssuesRequest | null {
const shown = shownSidebarStatuses(settings, statuses);
if (shown.length === 0) return null;
@@ -270,8 +271,8 @@ export function builtinSidebarRequest(
table: {
scope: { kind: "workspace" },
filters: {
- ...(builtin === "working"
- ? { working_issue_ids: [...workingIssueIds].sort() }
+ ...(builtin === "working" || builtin === "snoozed"
+ ? { working_issue_ids: [...issueIds].sort() }
: BUILTIN_FILTERS[builtin]),
...(shown.length < statuses.length ? { statuses: shown } : {}),
include_sub_issues: settings.showSubIssues,
diff --git a/packages/core/package.json b/packages/core/package.json
index def71e2494..ac2ed1f0bd 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -74,6 +74,8 @@
"./inbox/filter-store": "./inbox/filter-store.ts",
"./inbox/selection-store": "./inbox/selection-store.ts",
"./inbox/ws-updaters": "./inbox/ws-updaters.ts",
+ "./inbox/snooze": "./inbox/snooze.ts",
+ "./inbox/use-snooze-wake": "./inbox/use-snooze-wake.ts",
"./notification-preferences": "./notification-preferences/index.ts",
"./notification-preferences/queries": "./notification-preferences/queries.ts",
"./notification-preferences/mutations": "./notification-preferences/mutations.ts",
diff --git a/packages/core/shortcuts/definitions.ts b/packages/core/shortcuts/definitions.ts
index 2f042d1f8d..cb43ba41c7 100644
--- a/packages/core/shortcuts/definitions.ts
+++ b/packages/core/shortcuts/definitions.ts
@@ -14,6 +14,7 @@ export type ShortcutActionId =
| "newChat"
| "findInIssue"
| "archiveInboxItem"
+ | "snoozeInboxItem"
| "send"
| "voiceInput"
| "goBack"
@@ -110,6 +111,12 @@ export const SHORTCUT_ACTIONS: readonly ShortcutActionDefinition[] = [
defaultShortcut: createShortcutChord("E"),
allowInEditable: false,
},
+ {
+ id: "snoozeInboxItem",
+ category: "general",
+ defaultShortcut: createShortcutChord("H"),
+ allowInEditable: false,
+ },
{ id: "send", category: "general", defaultShortcut: primary("Enter"), allowInEditable: true },
// Voice input works where the caret is, so it must fire inside editors. It
// is matched on keydown AND keyup (holding it is push-to-talk), so the voice
diff --git a/packages/core/types/inbox.ts b/packages/core/types/inbox.ts
index a4f472d55f..4e08535863 100644
--- a/packages/core/types/inbox.ts
+++ b/packages/core/types/inbox.ts
@@ -91,6 +91,25 @@ export interface InboxItem {
archived: boolean;
created_at: string;
details: Record<string, string> | null;
+ /**
+ * When the issue came back from a snooze. A listed row only carries a time
+ * that has passed: a snoozed issue is left out of the list until then.
+ * Absent on servers that predate snooze.
+ */
+ snoozed_until?: string | null;
+ /** When that snooze began. */
+ snoozed_at?: string | null;
+}
+
+/** One snoozed issue in the viewer's inbox (`GET /api/inbox/snoozed`). */
+export interface SnoozedInboxIssue {
+ issue_id: string;
+ /** The issue's newest notification: the id the snooze endpoints take. */
+ item_id: string;
+ snoozed_until: string;
+ snoozed_at: string;
+ /** Notifications that arrived on the issue while it was snoozed. */
+ updates: number;
}
diff --git a/packages/core/types/index.ts b/packages/core/types/index.ts
index 71577748f3..f011eb983d 100644
--- a/packages/core/types/index.ts
+++ b/packages/core/types/index.ts
@@ -142,7 +142,7 @@ export type {
PluginMCPTool,
PluginTokenIssue,
} from "./plugin";
-export type { InboxItem, InboxSeverity, InboxItemType, InboxWorkspaceUnread, ArchivedInboxPage, ArchivedInboxFacets } from "./inbox";
+export type { InboxItem, InboxSeverity, InboxItemType, InboxWorkspaceUnread, ArchivedInboxPage, ArchivedInboxFacets, SnoozedInboxIssue } from "./inbox";
export type { NotificationGroupKey, NotificationGroupValue, NotificationPreferences, NotificationPreferenceResponse } from "./notification-preference";
export type { Comment, CommentType, CommentAuthorType, CommentSupplementReceipt, CommentSupplementStatus, CommentTriggerPreview, CommentTriggerPreviewAgent, CommentTriggerSource, CommentTriggerOutcome, CommentTriggerStatus, Reaction } from "./comment";
export type { Label, LabelResourceType, CreateLabelRequest, UpdateLabelRequest, ListLabelsResponse, IssueLabelsResponse, ResourceLabelsResponse } from "./label";
diff --git a/packages/views/inbox/components/inbox-snooze-menu.test.tsx b/packages/views/inbox/components/inbox-snooze-menu.test.tsx
new file mode 100644
index 0000000000..fb21208cf1
--- /dev/null
+++ b/packages/views/inbox/components/inbox-snooze-menu.test.tsx
@@ -0,0 +1,107 @@
+import { useState } from "react";
+import { fireEvent, screen } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { renderWithI18n } from "../../test/i18n";
+import { InboxSnoozeMenu } from "./inbox-snooze-menu";
+
+const onSnooze = vi.fn();
+
+async function findDay(date: Date): Promise<HTMLElement> {
+ await screen.findByText("Pick a date and time");
+ // The calendar loads lazily, which can take a while on a busy test run.
+ return vi.waitUntil(
+ () => document.querySelector<HTMLElement>(`button[data-day="${date.toLocaleDateString()}"]`),
+ { timeout: 10_000 },
+ );
+}
+
+function Harness({ initialOpen = true }: { initialOpen?: boolean }) {
+ const [open, setOpen] = useState(initialOpen);
+ return (
+ <>
+ <button type="button" onClick={() => setOpen(true)}>
+ Open from outside
+ </button>
+ <InboxSnoozeMenu
+ open={open}
+ onOpenChange={setOpen}
+ onSnooze={onSnooze}
+ trigger={<button type="button">Snooze</button>}
+ />
+ </>
+ );
+}
+
+describe("InboxSnoozeMenu", () => {
+ beforeEach(() => {
+ // Monday, November 16, 14:20 local. Only the clock is faked, so the lazy
+ // calendar still loads.
+ vi.useFakeTimers({ toFake: ["Date"] });
+ vi.setSystemTime(new Date(2026, 10, 16, 14, 20));
+ onSnooze.mockReset();
+ });
+ afterEach(() => vi.useRealTimers());
+
+ it("offers five durations, each with the time it ends", async () => {
+ renderWithI18n(<Harness />);
+ const items = await screen.findAllByRole("menuitem");
+ expect(items.map((item) => item.textContent)).toEqual([
+ "1 hour3:20 PM",
+ "3 hours5:20 PM",
+ "1 daytomorrow 2:20 PM",
+ "3 daysThu 2:20 PM",
+ "1 weekNov 23, 2:20 PM",
+ "Pick a date and time…",
+ ]);
+ });
+
+ it("snoozes until a day and time picked in place of the list", async () => {
+ renderWithI18n(<Harness />);
+ fireEvent.click(await screen.findByRole("menuitem", { name: /Pick a date and time/ }));
+
+ expect(await screen.findByText("Pick a date and time")).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "Snooze until tomorrow 9:00 AM" })).toBeEnabled();
+
+ fireEvent.click(await findDay(new Date(2026, 10, 20)));
+ const hour = screen.getByRole("textbox", { name: "Hour" });
+ fireEvent.keyDown(hour, { key: "1" });
+ fireEvent.keyDown(hour, { key: "5" });
+ fireEvent.click(screen.getByRole("button", { name: "Snooze until Fri 3:00 PM" }));
+
+ expect(onSnooze).toHaveBeenCalledWith(new Date(2026, 10, 20, 15, 0));
+ expect(screen.queryByText("Pick a date and time")).toBeNull();
+ });
+
+ it("refuses a time that has already passed", async () => {
+ renderWithI18n(<Harness />);
+ fireEvent.click(await screen.findByRole("menuitem", { name: /Pick a date and time/ }));
+ fireEvent.click(await findDay(new Date(2026, 10, 16)));
+
+ expect(screen.getByRole("button", { name: "Pick a time in the future, within a year." })).toBeDisabled();
+ });
+
+ it("goes back to the durations", async () => {
+ renderWithI18n(<Harness />);
+ fireEvent.click(await screen.findByRole("menuitem", { name: /Pick a date and time/ }));
+ fireEvent.click(await screen.findByRole("button", { name: "Back" }));
+ expect(await screen.findByRole("menuitem", { name: /^1 hour/ })).toBeInTheDocument();
+ });
+
+ it("reads the clock when the parent opens it, as H and the hover card do", async () => {
+ renderWithI18n(<Harness initialOpen={false} />);
+ vi.setSystemTime(new Date(2026, 10, 16, 16, 20));
+ fireEvent.click(screen.getByText("Open from outside"));
+ fireEvent.click(await screen.findByRole("menuitem", { name: /^1 hour/ }));
+ expect(onSnooze).toHaveBeenCalledWith(new Date(2026, 10, 16, 17, 20));
+ });
+
+ it("opens on the durations again after closing from the picker", async () => {
+ renderWithI18n(<Harness />);
+ fireEvent.click(await screen.findByRole("menuitem", { name: /Pick a date and time/ }));
+ await screen.findByText("Pick a date and time");
+ fireEvent.keyDown(screen.getByRole("button", { name: "Back" }), { key: "Escape" });
+ await vi.waitUntil(() => !screen.queryByText("Pick a date and time"));
+ fireEvent.click(screen.getByText("Open from outside"));
+ expect(await screen.findByRole("menuitem", { name: /^1 hour/ })).toBeInTheDocument();
+ });
+});
diff --git a/packages/views/inbox/components/inbox-snooze-menu.tsx b/packages/views/inbox/components/inbox-snooze-menu.tsx
new file mode 100644
index 0000000000..03aceadf2a
--- /dev/null
+++ b/packages/views/inbox/components/inbox-snooze-menu.tsx
@@ -0,0 +1,208 @@
+"use client";
+
+import { useState, type ReactElement } from "react";
+import {
+ INBOX_SNOOZE_MAX_DAYS,
+ INBOX_SNOOZE_MORNING,
+ inboxSnoozeOptions,
+ inboxSnoozePickedTime,
+ type InboxSnoozePreset,
+} from "@multica/core/inbox/snooze";
+import { AlarmClock, ArrowLeft, CalendarDays, ChevronRight, Clock, Undo2 } from "@multica/ui/icons";
+import { Button } from "@multica/ui/components/ui/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuShortcut,
+ DropdownMenuTrigger,
+} from "@multica/ui/components/ui/dropdown-menu";
+import { LazyCalendar } from "@multica/ui/components/ui/lazy-calendar";
+import { TimeInput } from "@multica/ui/components/ui/time-input";
+import { useLocale, useT } from "../../i18n";
+import { formatSnoozeTime } from "./inbox-snooze-time";
+
+function useSnoozePresetLabel(): (preset: InboxSnoozePreset) => string {
+ const { t } = useT("inbox");
+ return (preset) => {
+ switch (preset) {
+ case "hours_1":
+ return t(($) => $.snooze.hours_1);
+ case "hours_3":
+ return t(($) => $.snooze.hours_3);
+ case "days_1":
+ return t(($) => $.snooze.days_1);
+ case "days_3":
+ return t(($) => $.snooze.days_3);
+ case "weeks_1":
+ return t(($) => $.snooze.weeks_1);
+ }
+ };
+}
+
+/**
+ * The snooze choices behind a trigger: a few durations worth one click, and a
+ * date and time picker for any other time, which takes the menu's place.
+ *
+ * Controlled, so a shortcut can open it. `snoozed` adds the way back for an
+ * issue that is already snoozed.
+ */
+export function InboxSnoozeMenu({
+ open,
+ onOpenChange,
+ trigger,
+ snoozed = false,
+ onSnooze,
+ onUnsnooze,
+ side = "bottom",
+ align = "end",
+}: {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ trigger: ReactElement;
+ snoozed?: boolean;
+ onSnooze: (until: Date) => void;
+ onUnsnooze?: () => void;
+ side?: "bottom" | "right";
+ align?: "start" | "end";
+}) {
+ const { t } = useT("inbox");
+ const locale = useLocale();
+ const presetLabel = useSnoozePresetLabel();
+ const [picking, setPicking] = useState(false);
+ // Read whenever the menu opens, from its trigger or from the parent (`H`, a
+ // hover card), so the times it lists are the ones it snoozes to.
+ const [now, setNow] = useState(() => new Date());
+ const [wasOpen, setWasOpen] = useState(open);
+ if (open !== wasOpen) {
+ setWasOpen(open);
+ if (open) {
+ setNow(new Date());
+ setPicking(false);
+ }
+ }
+
+ return (
+ <DropdownMenu open={open} onOpenChange={onOpenChange}>
+ <DropdownMenuTrigger render={trigger} />
+ <DropdownMenuContent side={side} align={align} className={picking ? "w-auto" : "w-64"}>
+ {picking ? (
+ <SnoozeTimePicker
+ now={now}
+ onBack={() => setPicking(false)}
+ onSnooze={(until) => {
+ onSnooze(until);
+ onOpenChange(false);
+ }}
+ />
+ ) : (
+ <>
+ {snoozed && onUnsnooze && (
+ <>
+ <DropdownMenuItem onClick={onUnsnooze}>
+ <Undo2 className="size-4" />
+ {t(($) => $.snooze.unsnooze)}
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ </>
+ )}
+ <DropdownMenuGroup>
+ <DropdownMenuLabel>
+ {snoozed ? t(($) => $.snooze.change_time) : t(($) => $.snooze.menu_title)}
+ </DropdownMenuLabel>
+ {inboxSnoozeOptions(now).map((option) => (
+ <DropdownMenuItem key={option.preset} onClick={() => onSnooze(option.until)}>
+ <Clock className="size-4" />
+ {presetLabel(option.preset)}
+ <DropdownMenuShortcut className="tracking-normal tabular-nums">
+ {formatSnoozeTime(option.until, now, locale)}
+ </DropdownMenuShortcut>
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuGroup>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem closeOnClick={false} onClick={() => setPicking(true)}>
+ <CalendarDays className="size-4" />
+ {t(($) => $.snooze.pick_time)}
+ <ChevronRight className="ml-auto size-4 text-muted-foreground" />
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <p className="px-2 py-1 text-caption text-muted-foreground">{t(($) => $.snooze.hint)}</p>
+ </>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
+}
+
+function startOfDay(date: Date): Date {
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
+}
+
+function SnoozeTimePicker({
+ now,
+ onBack,
+ onSnooze,
+}: {
+ now: Date;
+ onBack: () => void;
+ onSnooze: (until: Date) => void;
+}) {
+ const { t } = useT("inbox");
+ const locale = useLocale();
+ const today = startOfDay(now);
+ const lastDay = new Date(today.getFullYear(), today.getMonth(), today.getDate() + INBOX_SNOOZE_MAX_DAYS - 1);
+ const [day, setDay] = useState(() => new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1));
+ const [time, setTime] = useState(INBOX_SNOOZE_MORNING);
+ const until = inboxSnoozePickedTime(day, time, now);
+
+ return (
+ // The menu navigates and type-selects from the keys pressed inside it, and
+ // would take the calendar's arrows and the time's digits for its own.
+ <div
+ className="flex flex-col"
+ onKeyDown={(event) => {
+ if (event.key !== "Escape") event.stopPropagation();
+ }}
+ >
+ <div className="flex items-center gap-1 px-1 pt-1">
+ <Button size="icon-xs" variant="ghost" aria-label={t(($) => $.snooze.picker_back)} onClick={onBack}>
+ <ArrowLeft />
+ </Button>
+ <span className="text-label font-medium">{t(($) => $.snooze.picker_title)}</span>
+ </div>
+ <LazyCalendar
+ mode="single"
+ required
+ autoFocus
+ selected={day}
+ defaultMonth={day}
+ onSelect={(next: Date) => setDay(next)}
+ startMonth={today}
+ endMonth={lastDay}
+ disabled={[{ before: today }, { after: lastDay }]}
+ className="bg-transparent"
+ />
+ <div className="flex items-center justify-between gap-3 border-t px-2 py-2">
+ <span className="text-label text-muted-foreground">{t(($) => $.snooze.picker_time)}</span>
+ <TimeInput
+ value={time}
+ onChange={setTime}
+ hourLabel={t(($) => $.snooze.picker_hour)}
+ minuteLabel={t(($) => $.snooze.picker_minute)}
+ />
+ </div>
+ <div className="px-1 pb-1">
+ <Button className="w-full" disabled={!until} onClick={() => until && onSnooze(until)}>
+ <AlarmClock />
+ {until
+ ? t(($) => $.snooze.picker_submit, { time: formatSnoozeTime(until, now, locale) })
+ : t(($) => $.snooze.custom_invalid)}
+ </Button>
+ </div>
+ </div>
+ );
+}
diff --git a/packages/views/inbox/components/inbox-snooze-time.test.ts b/packages/views/inbox/components/inbox-snooze-time.test.ts
new file mode 100644
index 0000000000..5825b9217f
--- /dev/null
+++ b/packages/views/inbox/components/inbox-snooze-time.test.ts
@@ -0,0 +1,27 @@
+// @vitest-environment node
+import { describe, expect, it } from "vitest";
+import { formatSnoozeTime } from "./inbox-snooze-time";
+
+const at = (y: number, m: number, d: number, h: number, min = 0) => new Date(y, m - 1, d, h, min);
+// A Wednesday afternoon.
+const now = at(2026, 6, 17, 14, 20);
+
+describe("formatSnoozeTime", () => {
+ it("shows the time alone for later today", () => {
+ expect(formatSnoozeTime(at(2026, 6, 17, 18), now, "en-GB")).toBe("18:00");
+ });
+
+ it("names tomorrow", () => {
+ expect(formatSnoozeTime(at(2026, 6, 18, 9), now, "en-GB")).toMatch(/^tomorrow 0?9:00$/);
+ expect(formatSnoozeTime(at(2026, 6, 18, 9), now, "zh-Hans")).toMatch(/^明天 /);
+ });
+
+ it("names the weekday within the week", () => {
+ expect(formatSnoozeTime(at(2026, 6, 22, 9), now, "en-GB")).toMatch(/^Mon 0?9:00$/);
+ });
+
+ it("shows the date further out, and the year once it differs", () => {
+ expect(formatSnoozeTime(at(2026, 7, 3, 9), now, "en-GB")).toMatch(/^3 Jul,? 0?9:00$/);
+ expect(formatSnoozeTime(at(2027, 1, 4, 9), now, "en-GB")).toMatch(/^4 Jan 2027,? 0?9:00$/);
+ });
+});
diff --git a/packages/views/inbox/components/inbox-snooze-time.ts b/packages/views/inbox/components/inbox-snooze-time.ts
new file mode 100644
index 0000000000..d9772c70be
--- /dev/null
+++ b/packages/views/inbox/components/inbox-snooze-time.ts
@@ -0,0 +1,31 @@
+const DAY_MS = 24 * 60 * 60 * 1000;
+
+function startOfDay(date: Date): number {
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
+}
+
+/**
+ * When a snooze ends, as short as the distance allows: the time alone today,
+ * "tomorrow" and the time, a weekday within the week, a date after that. In
+ * the viewer's own time zone, which is the one they picked the time in.
+ */
+export function formatSnoozeTime(until: Date, now: Date, locale: string): string {
+ const time = new Intl.DateTimeFormat(locale, { hour: "numeric", minute: "2-digit" }).format(until);
+ const days = Math.round((startOfDay(until) - startOfDay(now)) / DAY_MS);
+ if (days <= 0) return time;
+ if (days === 1) {
+ const tomorrow = new Intl.RelativeTimeFormat(locale, { numeric: "auto" }).format(1, "day");
+ return `${tomorrow} ${time}`;
+ }
+ if (days < 7) {
+ const weekday = new Intl.DateTimeFormat(locale, { weekday: "short" }).format(until);
+ return `${weekday} ${time}`;
+ }
+ return new Intl.DateTimeFormat(locale, {
+ month: "short",
+ day: "numeric",
+ hour: "numeric",
+ minute: "2-digit",
+ ...(until.getFullYear() === now.getFullYear() ? {} : { year: "numeric" as const }),
+ }).format(until);
+}
diff --git a/packages/views/inbox/components/snoozed-inbox-page.test.tsx b/packages/views/inbox/components/snoozed-inbox-page.test.tsx
new file mode 100644
index 0000000000..e761ec182d
--- /dev/null
+++ b/packages/views/inbox/components/snoozed-inbox-page.test.tsx
@@ -0,0 +1,98 @@
+import { fireEvent, screen } from "@testing-library/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { snoozedInboxOptions } from "@multica/core/inbox/queries";
+import { issueDetailOptions } from "@multica/core/issues/queries";
+import type { Issue, SnoozedInboxIssue } from "@multica/core/types";
+import { renderWithI18n } from "../../test/i18n";
+import { NavigationProvider, type NavigationAdapter } from "../../navigation";
+import { SnoozedInboxPage } from "./snoozed-inbox-page";
+
+const state = vi.hoisted(() => ({
+ snooze: vi.fn(() => Promise.resolve()),
+ unsnooze: vi.fn(() => Promise.resolve()),
+}));
+
+vi.mock("sonner", () => ({ toast: { success: vi.fn(), error: vi.fn() } }));
+vi.mock("@multica/core/hooks", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("@multica/core/hooks")>()),
+ useWorkspaceId: () => "ws-1",
+}));
+vi.mock("@multica/core/paths", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("@multica/core/paths")>();
+ return { ...actual, useWorkspacePaths: () => actual.paths.workspace("acme") };
+});
+vi.mock("@multica/core/inbox/mutations", () => ({
+ useSnoozeInbox: () => ({ mutateAsync: state.snooze }),
+ useUnsnoozeInbox: () => ({ mutateAsync: state.unsnooze }),
+ cachedInboxSnoozedUntil: () => null,
+}));
+
+const HOUR = 60 * 60 * 1000;
+
+function entry(issueId: string, until: Date, updates = 0): SnoozedInboxIssue {
+ return {
+ issue_id: issueId,
+ item_id: `item-${issueId}`,
+ snoozed_until: until.toISOString(),
+ snoozed_at: new Date(Date.now() - HOUR).toISOString(),
+ updates,
+ };
+}
+
+function renderPage(snoozed: SnoozedInboxIssue[]) {
+ const client = new QueryClient({ defaultOptions: { queries: { retry: false, staleTime: Infinity } } });
+ client.setQueryData(snoozedInboxOptions("ws-1").queryKey, snoozed);
+ for (const { issue_id } of snoozed) {
+ client.setQueryData(issueDetailOptions("ws-1", issue_id).queryKey, {
+ id: issue_id,
+ identifier: `MUL-${issue_id.slice(-1)}`,
+ title: `Issue ${issue_id}`,
+ status: "todo",
+ } as Issue);
+ }
+ const nav: NavigationAdapter = {
+ push: vi.fn(),
+ replace: vi.fn(),
+ back: vi.fn(),
+ pathname: "/acme/issues",
+ searchParams: new URLSearchParams("view=snoozed"),
+ hash: "",
+ getShareableUrl: (path) => path,
+ };
+ return renderWithI18n(
+ <QueryClientProvider client={client}>
+ <NavigationProvider value={nav}>
+ <SnoozedInboxPage />
+ </NavigationProvider>
+ </QueryClientProvider>,
+ );
+}
+
+beforeEach(() => {
+ state.snooze.mockClear();
+ state.unsnooze.mockClear();
+});
+
+describe("SnoozedInboxPage", () => {
+ it("lists snoozed issues by the day they come back, with what arrived meanwhile", () => {
+ const now = Date.now();
+ renderPage([entry("issue-1", new Date(now + HOUR), 3), entry("issue-2", new Date(now + 3 * 24 * HOUR))]);
+
+ expect(screen.getByRole("heading", { level: 1, name: "Snoozed" })).toBeInTheDocument();
+ expect(screen.getByText("Issue issue-1")).toBeInTheDocument();
+ expect(screen.getByText("Issue issue-2")).toBeInTheDocument();
+ expect(screen.getByText("3 updates while snoozed")).toBeInTheDocument();
+ });
+
+ it("brings an issue back now", () => {
+ renderPage([entry("issue-1", new Date(Date.now() + HOUR))]);
+ fireEvent.click(screen.getByRole("button", { name: /Bring back now/ }));
+ expect(state.unsnooze).toHaveBeenCalledWith({ id: "item-issue-1" });
+ });
+
+ it("says when nothing is snoozed", () => {
+ renderPage([]);
+ expect(screen.getByText("Nothing snoozed")).toBeInTheDocument();
+ });
+});
diff --git a/packages/views/inbox/components/snoozed-inbox-page.tsx b/packages/views/inbox/components/snoozed-inbox-page.tsx
new file mode 100644
index 0000000000..63dbc6755e
--- /dev/null
+++ b/packages/views/inbox/components/snoozed-inbox-page.tsx
@@ -0,0 +1,204 @@
+"use client";
+
+import { useMemo, useState } from "react";
+import { useQuery } from "@tanstack/react-query";
+import { AlarmClock, Undo2 } from "@multica/ui/icons";
+import { Button } from "@multica/ui/components/ui/button";
+import { Skeleton } from "@multica/ui/components/ui/skeleton";
+import { useWorkspaceId } from "@multica/core/hooks";
+import { useWorkspacePaths } from "@multica/core/paths";
+import { snoozedInboxOptions } from "@multica/core/inbox/queries";
+import { issueDetailOptions } from "@multica/core/issues/queries";
+import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
+import type { SnoozedInboxIssue } from "@multica/core/types";
+import { CollectionPageHeader, CollectionPageState } from "../../layout/collection-page";
+import {
+ CollectionEmptyValue,
+ CollectionList,
+ CollectionNameCell,
+ type CollectionColumn,
+ type CollectionGroup,
+} from "../../layout/collection-list";
+import { StatusIcon } from "../../issues/components";
+import { useBuiltinViewLabel } from "../../issue-views/builtin-views";
+import { useLocale, useT } from "../../i18n";
+import { InboxSnoozeMenu } from "./inbox-snooze-menu";
+import { formatSnoozeTime } from "./inbox-snooze-time";
+import { useInboxSnooze } from "./use-inbox-snooze";
+
+const DAY_MS = 24 * 60 * 60 * 1000;
+
+function startOfDay(date: Date): number {
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
+}
+
+/** The day an issue comes back on: today, tomorrow, then the weekday and date. */
+function returnDayLabel(day: Date, now: Date, locale: string): string {
+ const days = Math.round((startOfDay(day) - startOfDay(now)) / DAY_MS);
+ const label =
+ days <= 1
+ ? new Intl.RelativeTimeFormat(locale, { numeric: "auto" }).format(Math.max(days, 0), "day")
+ : new Intl.DateTimeFormat(locale, {
+ weekday: "long",
+ month: "short",
+ day: "numeric",
+ ...(day.getFullYear() === now.getFullYear() ? {} : { year: "numeric" as const }),
+ }).format(day);
+ return label.charAt(0).toLocaleUpperCase(locale) + label.slice(1);
+}
+
+/**
+ * The issues the viewer snoozed in the Inbox, soonest back first and grouped
+ * by the day they come back. Opening one leaves it snoozed and unread.
+ */
+export function SnoozedInboxPage() {
+ const { t } = useT("inbox");
+ const wsId = useWorkspaceId();
+ const p = useWorkspacePaths();
+ const locale = useLocale();
+ const title = useBuiltinViewLabel()("snoozed");
+ const { data: snoozed, isLoading } = useQuery(snoozedInboxOptions(wsId));
+ const { snooze, unsnooze } = useInboxSnooze();
+
+ const groups = useMemo<CollectionGroup<SnoozedInboxIssue>[]>(() => {
+ const now = new Date();
+ const byDay = new Map<number, SnoozedInboxIssue[]>();
+ for (const entry of snoozed ?? []) {
+ const until = new Date(entry.snoozed_until);
+ if (until.getTime() <= now.getTime()) continue;
+ const day = startOfDay(until);
+ const rows = byDay.get(day);
+ if (rows) rows.push(entry);
+ else byDay.set(day, [entry]);
+ }
+ return [...byDay.entries()]
+ .sort(([a], [b]) => a - b)
+ .map(([day, rows]) => ({
+ key: String(day),
+ label: returnDayLabel(new Date(day), now, locale),
+ count: rows.length,
+ rows,
+ }));
+ }, [snoozed, locale]);
+
+ const columns: CollectionColumn<SnoozedInboxIssue>[] = [
+ {
+ key: "issue",
+ cell: (row) => <SnoozedIssueName wsId={wsId} issueId={row.issue_id} />,
+ },
+ {
+ key: "updates",
+ header: t(($) => $.snooze.col_updates),
+ width: 160,
+ cell: (row) =>
+ row.updates > 0 ? (
+ <span className="truncate">{t(($) => $.snooze.updates, { count: row.updates })}</span>
+ ) : (
+ <CollectionEmptyValue />
+ ),
+ },
+ {
+ key: "back",
+ header: t(($) => $.snooze.col_back),
+ width: 136,
+ align: "end",
+ core: true,
+ className: "tabular-nums",
+ cell: (row) => formatSnoozeTime(new Date(row.snoozed_until), new Date(), locale),
+ },
+ {
+ key: "actions",
+ width: 128,
+ align: "end",
+ core: true,
+ interactive: true,
+ cell: (row) => (
+ <SnoozedRowActions
+ onUnsnooze={() => unsnooze(row.item_id)}
+ onSnooze={(until) => snooze({ id: row.item_id }, until)}
+ />
+ ),
+ },
+ ];
+
+ return (
+ <div className="flex flex-1 min-h-0 flex-col">
+ <CollectionPageHeader icon={AlarmClock} title={title} />
+ {isLoading ? (
+ <div className="space-y-2 p-4">
+ {Array.from({ length: 4 }).map((_, i) => (
+ <Skeleton key={i} className="h-8 w-full" />
+ ))}
+ </div>
+ ) : (
+ <CollectionList
+ label={title}
+ columns={columns}
+ groups={groups}
+ getRowId={(row) => row.issue_id}
+ getRowHref={(row) => p.issueDetail(row.issue_id)}
+ empty={
+ <CollectionPageState
+ icon={AlarmClock}
+ title={t(($) => $.snooze.view_empty)}
+ description={t(($) => $.snooze.view_empty_description)}
+ />
+ }
+ />
+ )}
+ </div>
+ );
+}
+
+function SnoozedIssueName({ wsId, issueId }: { wsId: string; issueId: string }) {
+ const { data: issue } = useQuery(issueDetailOptions(wsId, issueId));
+ const { categoryOf, colorOf, iconOf } = useIssueStatuses(wsId);
+ if (!issue) return <Skeleton className="h-4 w-48" />;
+ return (
+ <CollectionNameCell
+ icon={
+ <StatusIcon
+ status={issue.status}
+ category={categoryOf(issue.status)}
+ color={colorOf(issue.status)}
+ icon={iconOf(issue.status)}
+ className="size-3.5 shrink-0"
+ />
+ }
+ title={issue.title}
+ badges={<span className="shrink-0 text-caption text-muted-foreground tabular-nums">{issue.identifier}</span>}
+ />
+ );
+}
+
+/** Bring back now, or snooze until another time; shown while the row is hovered. */
+function SnoozedRowActions({
+ onUnsnooze,
+ onSnooze,
+}: {
+ onUnsnooze: () => void;
+ onSnooze: (until: Date) => void;
+}) {
+ const { t } = useT("inbox");
+ const [open, setOpen] = useState(false);
+ return (
+ <span
+ className="flex items-center gap-1 opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 has-data-popup-open:opacity-100 [@media(pointer:coarse)]:opacity-100"
+ >
+ <Button size="xs" variant="ghost" className="text-muted-foreground" onClick={onUnsnooze}>
+ <Undo2 />
+ {t(($) => $.snooze.unsnooze)}
+ </Button>
+ <InboxSnoozeMenu
+ open={open}
+ onOpenChange={setOpen}
+ onSnooze={onSnooze}
+ trigger={
+ <Button size="icon-xs" variant="ghost" className="text-muted-foreground" aria-label={t(($) => $.snooze.change_time)}>
+ <AlarmClock />
+ </Button>
+ }
+ />
+ </span>
+ );
+}
diff --git a/packages/views/inbox/components/use-inbox-snooze.test.tsx b/packages/views/inbox/components/use-inbox-snooze.test.tsx
new file mode 100644
index 0000000000..0ea9dd4656
--- /dev/null
+++ b/packages/views/inbox/components/use-inbox-snooze.test.tsx
@@ -0,0 +1,130 @@
+import { useState } from "react";
+import { act, fireEvent, screen, waitFor } from "@testing-library/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { toast } from "sonner";
+import { api } from "@multica/core/api";
+import { inboxKeys } from "@multica/core/inbox/queries";
+import type { SnoozedInboxIssue } from "@multica/core/types";
+import { renderWithI18n } from "../../test/i18n";
+import { useInboxSnooze } from "./use-inbox-snooze";
+
+vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "ws" }));
+vi.mock("@multica/core/api", () => ({ api: { snoozeInbox: vi.fn(), unsnoozeInbox: vi.fn() } }));
+vi.mock("sonner", () => ({ toast: { success: vi.fn(), error: vi.fn() } }));
+
+const earlier = new Date("2026-11-20T09:00:00Z");
+const later = new Date("2026-11-21T09:00:00Z");
+
+function queryClient(snoozed: SnoozedInboxIssue[] = []) {
+ const qc = new QueryClient({
+ defaultOptions: { queries: { retry: false, staleTime: Infinity }, mutations: { retry: false } },
+ });
+ qc.setQueryData(inboxKeys.snoozed("ws"), snoozed);
+ return qc;
+}
+
+const snoozedEntry: SnoozedInboxIssue = {
+ issue_id: "i1",
+ item_id: "n1",
+ snoozed_until: earlier.toISOString(),
+ snoozed_at: "2026-11-16T00:00:00Z",
+ updates: 2,
+};
+
+function Snoozer({ read, onSnoozed }: { read?: boolean; onSnoozed?: () => void }) {
+ const { snooze } = useInboxSnooze();
+ return (
+ <button
+ type="button"
+ onClick={() => {
+ snooze({ id: "n1", read }, later);
+ onSnoozed?.();
+ }}
+ >
+ Snooze
+ </button>
+ );
+}
+
+/** The snoozing component goes away right after, as the issue header does when it opens the next issue. */
+function Leaving() {
+ const [here, setHere] = useState(true);
+ return here ? <Snoozer onSnoozed={() => setHere(false)} /> : <span>Next issue</span>;
+}
+
+function undoFromToast() {
+ const action = vi.mocked(toast.success).mock.calls[0]![1]!.action as unknown as { onClick: () => void };
+ return act(async () => action.onClick());
+}
+
+describe("useInboxSnooze", () => {
+ beforeEach(() => {
+ // Only the clock is faked, so promises and waitFor still run.
+ vi.useFakeTimers({ toFake: ["Date"] });
+ vi.setSystemTime(new Date("2026-11-16T06:20:00Z"));
+ vi.clearAllMocks();
+ vi.mocked(api.snoozeInbox).mockResolvedValue({ issue_id: "i1", snoozed_until: later.toISOString() });
+ vi.mocked(api.unsnoozeInbox).mockResolvedValue({ issue_id: "i1" });
+ });
+ afterEach(() => vi.useRealTimers());
+
+ it("still shows the toast with Undo after the snoozing component unmounts", async () => {
+ let finish!: (value: { issue_id: string; snoozed_until: string }) => void;
+ vi.mocked(api.snoozeInbox).mockImplementation(() => new Promise((resolve) => (finish = resolve)));
+ renderWithI18n(
+ <QueryClientProvider client={queryClient()}>
+ <Leaving />
+ </QueryClientProvider>,
+ );
+ fireEvent.click(screen.getByText("Snooze"));
+ expect(screen.getByText("Next issue")).toBeInTheDocument();
+ await waitFor(() => expect(api.snoozeInbox).toHaveBeenCalled());
+ await act(async () => finish({ issue_id: "i1", snoozed_until: later.toISOString() }));
+
+ expect(toast.success).toHaveBeenCalledWith(
+ expect.any(String),
+ expect.objectContaining({ action: expect.objectContaining({ label: "Undo" }) }),
+ );
+ });
+
+ it("still reports a failure after the snoozing component unmounts", async () => {
+ vi.mocked(api.snoozeInbox).mockRejectedValue(new Error("Snooze rejected"));
+ renderWithI18n(
+ <QueryClientProvider client={queryClient()}>
+ <Leaving />
+ </QueryClientProvider>,
+ );
+ fireEvent.click(screen.getByText("Snooze"));
+ await waitFor(() => expect(toast.error).toHaveBeenCalledWith("Snooze rejected"));
+ expect(toast.success).not.toHaveBeenCalled();
+ });
+
+ it("undoes a first snooze by bringing the issue back as it was", async () => {
+ renderWithI18n(
+ <QueryClientProvider client={queryClient()}>
+ <Snoozer read />
+ </QueryClientProvider>,
+ );
+ fireEvent.click(screen.getByText("Snooze"));
+ await waitFor(() => expect(toast.success).toHaveBeenCalled());
+ await undoFromToast();
+
+ expect(api.unsnoozeInbox).toHaveBeenCalledWith("n1", { read: true });
+ expect(api.snoozeInbox).toHaveBeenCalledTimes(1);
+ });
+
+ it("undoes a change of time by putting back the previous time", async () => {
+ renderWithI18n(
+ <QueryClientProvider client={queryClient([snoozedEntry])}>
+ <Snoozer />
+ </QueryClientProvider>,
+ );
+ fireEvent.click(screen.getByText("Snooze"));
+ await waitFor(() => expect(toast.success).toHaveBeenCalled());
+ await undoFromToast();
+
+ expect(api.snoozeInbox).toHaveBeenLastCalledWith("n1", earlier.toISOString());
+ expect(api.unsnoozeInbox).not.toHaveBeenCalled();
+ });
+});
diff --git a/packages/views/inbox/components/use-inbox-snooze.ts b/packages/views/inbox/components/use-inbox-snooze.ts
new file mode 100644
index 0000000000..cfcbd15592
--- /dev/null
+++ b/packages/views/inbox/components/use-inbox-snooze.ts
@@ -0,0 +1,68 @@
+"use client";
+
+import { useCallback } from "react";
+import { useQueryClient } from "@tanstack/react-query";
+import { toast } from "sonner";
+import { useWorkspaceId } from "@multica/core/hooks";
+import { cachedInboxSnoozedUntil, useSnoozeInbox, useUnsnoozeInbox } from "@multica/core/inbox/mutations";
+import { useLocale, useT } from "../../i18n";
+import { formatSnoozeTime } from "./inbox-snooze-time";
+
+/**
+ * Snooze and bring back, with the toasts every surface shows alike. A snooze
+ * can be undone from its toast: a first snooze returns the issue as read or
+ * unread as it was before, a change of time puts back the previous time.
+ *
+ * The toasts follow the request's promise rather than per-call mutation
+ * callbacks, which React Query drops once the calling component unmounts, as
+ * it does when snoozing opens the next issue.
+ */
+export function useInboxSnooze() {
+ const { t } = useT("inbox");
+ const locale = useLocale();
+ const qc = useQueryClient();
+ const wsId = useWorkspaceId();
+ const { mutateAsync: snoozeAsync } = useSnoozeInbox();
+ const { mutateAsync: unsnoozeAsync } = useUnsnoozeInbox();
+
+ const failed = useCallback(
+ (fallback: string) => (err: unknown) => {
+ toast.error(err instanceof Error && err.message ? err.message : fallback);
+ },
+ [],
+ );
+
+ const snooze = useCallback(
+ (item: { id: string; read?: boolean }, until: Date) => {
+ const wasRead = item.read === true;
+ const previous = cachedInboxSnoozedUntil(qc, wsId, item.id);
+ const undo = () => {
+ if (previous && previous.getTime() > Date.now()) {
+ snoozeAsync({ id: item.id, until: previous }).catch(failed(t(($) => $.snooze.failed)));
+ } else {
+ unsnoozeAsync({ id: item.id, read: wasRead }).catch(failed(t(($) => $.snooze.unsnooze_failed)));
+ }
+ };
+ snoozeAsync({ id: item.id, until }).then(
+ () =>
+ toast.success(t(($) => $.snooze.toast_snoozed, { time: formatSnoozeTime(until, new Date(), locale) }), {
+ action: { label: t(($) => $.snooze.undo), onClick: undo },
+ }),
+ failed(t(($) => $.snooze.failed)),
+ );
+ },
+ [qc, wsId, snoozeAsync, unsnoozeAsync, failed, t, locale],
+ );
+
+ const unsnooze = useCallback(
+ (itemId: string) => {
+ unsnoozeAsync({ id: itemId }).then(
+ () => toast.success(t(($) => $.snooze.toast_unsnoozed)),
+ failed(t(($) => $.snooze.unsnooze_failed)),
+ );
+ },
+ [unsnoozeAsync, failed, t],
+ );
+
+ return { snooze, unsnooze };
+}
diff --git a/packages/views/issue-views/all-views-page.test.tsx b/packages/views/issue-views/all-views-page.test.tsx
index 114fb38fc0..c3cce06e12 100644
--- a/packages/views/issue-views/all-views-page.test.tsx
+++ b/packages/views/issue-views/all-views-page.test.tsx
@@ -128,8 +128,8 @@ describe("AllViewsPage", () => {
expect(screen.getByRole("heading", { level: 1, name: "All views" })).toBeInTheDocument();
await user.click(screen.getByRole("button", { name: "All views" }));
- expect(await screen.findByRole("menuitemradio", { name: /^All views/ })).toHaveTextContent("6");
- expect(screen.getByRole("menuitemradio", { name: /^Built-in/ })).toHaveTextContent("4");
+ expect(await screen.findByRole("menuitemradio", { name: /^All views/ })).toHaveTextContent("7");
+ expect(screen.getByRole("menuitemradio", { name: /^Built-in/ })).toHaveTextContent("5");
expect(screen.getByRole("menuitemradio", { name: /^Created by me/ })).toHaveTextContent("1");
await user.click(screen.getByRole("menuitemradio", { name: /^Shared/ }));
diff --git a/packages/views/issue-views/builtin-views.tsx b/packages/views/issue-views/builtin-views.tsx
index dff8fd5e17..29687c4340 100644
--- a/packages/views/issue-views/builtin-views.tsx
+++ b/packages/views/issue-views/builtin-views.tsx
@@ -1,7 +1,7 @@
"use client";
import { useCallback } from "react";
-import { Bell, Bot, CircleUser, ListTodo } from "@multica/ui/icons";
+import { AlarmClock, Bell, Bot, CircleUser, ListTodo } from "@multica/ui/icons";
import { useWorkspaceId } from "@multica/core/hooks";
import { useWorkspacePaths } from "@multica/core/paths";
import { issueViewContainerKey, useActiveIssueViewStore } from "@multica/core/issue-views/active-view-store";
@@ -17,8 +17,12 @@ export const BUILTIN_VIEW_ICON: Record<BuiltinViewKey, React.ReactNode> = {
my_work: <CircleUser className="size-4 shrink-0" />,
working: <Bot className="size-4 shrink-0" />,
subscribed: <Bell className="size-4 shrink-0" />,
+ snoozed: <AlarmClock className="size-4 shrink-0" />,
};
+/** The `?view=` id of the issues page's Snoozed list, which is not a filter of All issues. */
+export const SNOOZED_VIEW_ID = "snoozed";
+
export function useBuiltinViewLabel() {
const { t } = useT("issues");
return useCallback((key: BuiltinViewKey) => t(($) => $.views.builtin[key]), [t]);
@@ -27,7 +31,8 @@ export function useBuiltinViewLabel() {
/**
* Where a built-in view lives, and the store write that makes its page show
* it rather than whichever saved view was left open. Every built-in is the
- * workspace issues page; all but All issues open it under their filter.
+ * workspace issues page; all but All issues open it under their filter, and
+ * Snoozed in place of the table.
*/
export function useBuiltinViewNavigation() {
const wsId = useWorkspaceId();
@@ -36,7 +41,11 @@ export function useBuiltinViewNavigation() {
const hrefFor = useCallback(
(key: BuiltinViewKey) =>
- key === "all_issues" ? p.issues() : issueViewTarget(wsId, FILTERED_BUILTIN_VIEWS[key], p).href,
+ key === "all_issues"
+ ? p.issues()
+ : key === "snoozed"
+ ? `${p.issues()}?view=${SNOOZED_VIEW_ID}`
+ : issueViewTarget(wsId, FILTERED_BUILTIN_VIEWS[key], p).href,
[p, wsId],
);
diff --git a/packages/views/issues/actions/__tests__/issue-inbox-actions.test.tsx b/packages/views/issues/actions/__tests__/issue-inbox-actions.test.tsx
index 42bcebef00..3fd9c6c017 100644
--- a/packages/views/issues/actions/__tests__/issue-inbox-actions.test.tsx
+++ b/packages/views/issues/actions/__tests__/issue-inbox-actions.test.tsx
@@ -3,17 +3,17 @@ import { cleanup, fireEvent, screen } from "@testing-library/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { agentTaskSnapshotOptions } from "@multica/core/agents";
import { useInboxFilterStore } from "@multica/core/inbox/filter-store";
-import { inboxListOptions } from "@multica/core/inbox/queries";
+import { inboxListOptions, snoozedInboxOptions } from "@multica/core/inbox/queries";
import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";
-import type { InboxItem } from "@multica/core/types";
+import type { InboxItem, SnoozedInboxIssue } from "@multica/core/types";
import { renderWithI18n } from "../../../test/i18n";
import { NavigationProvider, type NavigationAdapter } from "../../../navigation";
import { IssueInboxActions } from "../issue-inbox-actions";
const state = vi.hoisted(() => ({
- markRead: vi.fn(),
- markUnread: vi.fn(),
archive: vi.fn(),
+ snooze: vi.fn(() => Promise.resolve()),
+ unsnooze: vi.fn(() => Promise.resolve()),
}));
vi.mock("sonner", () => ({ toast: { success: vi.fn(), error: vi.fn() } }));
@@ -23,9 +23,10 @@ vi.mock("@multica/core/paths", async (importOriginal) => {
return { ...actual, useWorkspacePaths: () => actual.paths.workspace("acme") };
});
vi.mock("@multica/core/inbox/mutations", () => ({
- useMarkInboxRead: () => ({ mutate: state.markRead }),
- useMarkInboxUnread: () => ({ mutate: state.markUnread }),
useArchiveInbox: () => ({ mutate: state.archive }),
+ useSnoozeInbox: () => ({ mutateAsync: state.snooze }),
+ useUnsnoozeInbox: () => ({ mutateAsync: state.unsnooze }),
+ cachedInboxSnoozedUntil: () => null,
}));
function item(overrides: Partial<InboxItem> & { id: string }): InboxItem {
@@ -50,6 +51,8 @@ function item(overrides: Partial<InboxItem> & { id: string }): InboxItem {
};
}
+const SNOOZED_AT = "2026-11-12T09:00:00Z";
+
const ROWS = [
item({ id: "n-1", issue_id: "issue-1", created_at: "2026-11-12T08:00:00Z" }),
item({ id: "n-2", issue_id: "issue-2", created_at: "2026-11-11T08:00:00Z", details: { comment_id: "c-9" } }),
@@ -59,7 +62,13 @@ function setup({
rows = ROWS,
issueId = "issue-1",
onMarkDone,
-}: { rows?: InboxItem[]; issueId?: string; onMarkDone?: (onSaved: () => void) => void } = {}) {
+ snoozed = [],
+}: {
+ rows?: InboxItem[];
+ issueId?: string;
+ onMarkDone?: (onSaved: () => void) => void;
+ snoozed?: SnoozedInboxIssue[];
+} = {}) {
const nav: NavigationAdapter = {
push: vi.fn(),
replace: vi.fn(),
@@ -71,6 +80,7 @@ function setup({
};
const qc = new QueryClient({ defaultOptions: { queries: { retry: false, staleTime: Infinity } } });
qc.setQueryData(inboxListOptions("ws").queryKey, rows);
+ qc.setQueryData(snoozedInboxOptions("ws").queryKey, snoozed);
qc.setQueryData(agentTaskSnapshotOptions("ws").queryKey, []);
renderWithI18n(
<QueryClientProvider client={qc}>
@@ -101,15 +111,33 @@ describe("IssueInboxActions", () => {
expect(screen.queryByRole("button", { name: "Archive" })).toBeNull();
});
- it("toggles the read state of the issue's notification", () => {
+ it("offers snooze in place of a read toggle", () => {
setup();
- fireEvent.click(screen.getByRole("button", { name: "Mark as unread" }));
- expect(state.markUnread).toHaveBeenCalledWith("n-1", expect.anything());
- cleanup();
+ expect(screen.queryByRole("button", { name: "Mark as unread" })).toBeNull();
+ expect(screen.queryByRole("button", { name: "Mark as read" })).toBeNull();
+ expect(screen.getByRole("button", { name: "Snooze" })).toBeInTheDocument();
+ });
+
+ it("snoozes and moves on to the next notification", async () => {
+ const nav = setup();
+ fireEvent.keyDown(document, { key: "h", code: "KeyH" });
+ fireEvent.click(await screen.findByRole("menuitem", { name: /^1 hour/ }));
+ expect(state.snooze).toHaveBeenCalledWith({ id: "n-1", until: expect.any(Date) });
+ expect(nav.push).toHaveBeenCalledWith("/acme/issues/issue-2#comment-c-9");
+ });
+
+ it("shows when a snoozed issue comes back, and brings it back with the shortcut", () => {
+ useInboxSelectionStore.setState({ sidebarIssueByWorkspace: {} });
+ const until = new Date(Date.now() + 60 * 60 * 1000).toISOString();
+ setup({
+ rows: [ROWS[1]!],
+ snoozed: [{ issue_id: "issue-1", item_id: "n-1", snoozed_until: until, snoozed_at: SNOOZED_AT, updates: 0 }],
+ });
+ expect(screen.getByTitle(/^Back /)).toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: "Archive" })).toBeNull();
- setup({ rows: [{ ...ROWS[0]!, read: false }, ROWS[1]!] });
- fireEvent.click(screen.getByRole("button", { name: "Mark as read" }));
- expect(state.markRead).toHaveBeenCalledWith("n-1", expect.anything());
+ fireEvent.keyDown(document, { key: "h", code: "KeyH" });
+ expect(state.unsnooze).toHaveBeenCalledWith({ id: "n-1" });
});
it("archives and moves on to the next notification", () => {
diff --git a/packages/views/issues/actions/issue-inbox-actions.tsx b/packages/views/issues/actions/issue-inbox-actions.tsx
index 3dc2b5f9ad..1be1956810 100644
--- a/packages/views/issues/actions/issue-inbox-actions.tsx
+++ b/packages/views/issues/actions/issue-inbox-actions.tsx
@@ -1,13 +1,16 @@
"use client";
-import { useEffect, useRef } from "react";
+import { useEffect, useRef, useState } from "react";
+import { useQuery } from "@tanstack/react-query";
import { toast } from "sonner";
-import { Archive, Check, CircleCheck, CircleDot } from "@multica/ui/icons";
+import { AlarmClock, Archive, ChevronDown, CircleCheck } from "@multica/ui/icons";
import { IconButton } from "@multica/ui/components/common/icon-button";
+import { cn } from "@multica/ui/lib/utils";
import { useWorkspaceId } from "@multica/core/hooks";
import { useWorkspacePaths } from "@multica/core/paths";
import { useModalStore } from "@multica/core/modals";
-import { useArchiveInbox, useMarkInboxRead, useMarkInboxUnread } from "@multica/core/inbox/mutations";
+import { useArchiveInbox } from "@multica/core/inbox/mutations";
+import { findSnoozedInboxIssue, snoozedInboxOptions } from "@multica/core/inbox/queries";
import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";
import {
getShortcut,
@@ -18,15 +21,21 @@ import {
import { isImeComposing } from "@multica/core/utils";
import { ActionShortcutKeycaps } from "../../common/shortcut-keycaps";
import { inboxRowHref } from "../../inbox/components/inbox-display";
+import { InboxSnoozeMenu } from "../../inbox/components/inbox-snooze-menu";
+import { formatSnoozeTime } from "../../inbox/components/inbox-snooze-time";
+import { useInboxSnooze } from "../../inbox/components/use-inbox-snooze";
import { useFilteredInboxRows } from "../../inbox/components/use-filtered-inbox-rows";
import { useNavigation } from "../../navigation";
-import { useT } from "../../i18n";
+import { useLocale, useT } from "../../i18n";
/**
* The Inbox's actions in the header of an issue opened from the Work panel's
- * Inbox section, while the section still lists it. Marking it done or
- * archiving opens the next notification the section lists, so the Inbox can
- * be worked through without leaving the page.
+ * Inbox section, while the section still lists it. Marking it done,
+ * snoozing or archiving opens the next notification the section lists, so
+ * the Inbox can be worked through without leaving the page.
+ *
+ * A snoozed issue shows when it comes back instead, wherever it is opened,
+ * with the way to bring it back now or change the time.
*
* `onMarkDone` sets the issue done and calls back once that is saved; it is
* offered while the issue is not done or closed.
@@ -48,9 +57,11 @@ export function IssueInboxActions({
const { rows } = useFilteredInboxRows(wsId, issueId, fromInbox);
const index = fromInbox ? rows.findIndex((row) => row.issue_id === issueId) : -1;
const item = index >= 0 ? rows[index]! : null;
- const markRead = useMarkInboxRead();
- const markUnread = useMarkInboxUnread();
const archive = useArchiveInbox();
+ const { snooze, unsnooze } = useInboxSnooze();
+ const { data: snoozedList } = useQuery(snoozedInboxOptions(wsId));
+ const snoozed = item ? undefined : findSnoozedInboxIssue(snoozedList, issueId);
+ const [snoozeOpen, setSnoozeOpen] = useState(false);
const failed = (fallback: string) => (err: unknown) =>
toast.error(err instanceof Error && err.message ? err.message : fallback);
@@ -72,6 +83,13 @@ export function IssueInboxActions({
openNext(next);
};
+ const snoozeItem = (until: Date) => {
+ if (!item) return;
+ const next = rows[index + 1] ?? rows[index - 1] ?? null;
+ snooze(item, until);
+ openNext(next);
+ };
+
// Done archives the issue's notifications on the server; archiving here as
// well takes the row out at once instead of when that event arrives.
const markDone = () => {
@@ -84,8 +102,14 @@ export function IssueInboxActions({
};
const archiveRef = useRef<(() => void) | null>(null);
+ const snoozeRef = useRef<(() => void) | null>(null);
useEffect(() => {
archiveRef.current = item ? archiveItem : null;
+ snoozeRef.current = item
+ ? () => setSnoozeOpen(true)
+ : snoozed
+ ? () => unsnooze(snoozed.item_id)
+ : null;
});
useEffect(() => {
const onKeyDown = (event: KeyboardEvent) => {
@@ -93,8 +117,11 @@ export function IssueInboxActions({
if (isEditableShortcutTarget(event.target)) return;
if (isPortalLayerShortcutTarget(event.target)) return;
if (useModalStore.getState().modal) return;
- if (!shortcutMatchesEvent(getShortcut("archiveInboxItem"), event)) return;
- const run = archiveRef.current;
+ const run = shortcutMatchesEvent(getShortcut("archiveInboxItem"), event)
+ ? archiveRef.current
+ : shortcutMatchesEvent(getShortcut("snoozeInboxItem"), event)
+ ? snoozeRef.current
+ : null;
if (!run) return;
event.preventDefault();
run();
@@ -103,30 +130,21 @@ export function IssueInboxActions({
return () => document.removeEventListener("keydown", onKeyDown);
}, []);
- if (!item) return null;
- const unread = item.read !== true;
+ if (!item) {
+ if (!snoozed) return null;
+ return (
+ <SnoozedChip
+ until={new Date(snoozed.snoozed_until)}
+ open={snoozeOpen}
+ onOpenChange={setSnoozeOpen}
+ onSnooze={(until) => snooze({ id: snoozed.item_id }, until)}
+ onUnsnooze={() => unsnooze(snoozed.item_id)}
+ />
+ );
+ }
return (
<>
- {unread ? (
- <IconButton
- label={t(($) => $.context_menu.mark_read)}
- tooltipSide="bottom"
- className="text-muted-foreground"
- onClick={() => markRead.mutate(item.id, { onError: failed(t(($) => $.errors.mark_read_failed)) })}
- >
- <Check />
- </IconButton>
- ) : (
- <IconButton
- label={t(($) => $.context_menu.mark_unread)}
- tooltipSide="bottom"
- className="text-muted-foreground"
- onClick={() => markUnread.mutate(item.id, { onError: failed(t(($) => $.errors.mark_unread_failed)) })}
- >
- <CircleDot />
- </IconButton>
- )}
{onMarkDone && (
<IconButton
label={tIssues(($) => $.detail.mark_done_tooltip)}
@@ -137,6 +155,21 @@ export function IssueInboxActions({
<CircleCheck />
</IconButton>
)}
+ <InboxSnoozeMenu
+ open={snoozeOpen}
+ onOpenChange={setSnoozeOpen}
+ onSnooze={snoozeItem}
+ trigger={
+ <IconButton
+ label={t(($) => $.snooze.action)}
+ shortcut={<ActionShortcutKeycaps action="snoozeInboxItem" />}
+ tooltipSide="bottom"
+ className="text-muted-foreground"
+ >
+ <AlarmClock />
+ </IconButton>
+ }
+ />
<IconButton
label={t(($) => $.context_menu.archive)}
shortcut={<ActionShortcutKeycaps action="archiveInboxItem" />}
@@ -150,3 +183,48 @@ export function IssueInboxActions({
</>
);
}
+
+/** When a snoozed issue comes back, with the way to bring it back now or later. */
+function SnoozedChip({
+ until,
+ open,
+ onOpenChange,
+ onSnooze,
+ onUnsnooze,
+}: {
+ until: Date;
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ onSnooze: (until: Date) => void;
+ onUnsnooze: () => void;
+}) {
+ const { t } = useT("inbox");
+ const locale = useLocale();
+ const label = t(($) => $.snooze.back_at, { time: formatSnoozeTime(until, new Date(), locale) });
+ return (
+ <>
+ <InboxSnoozeMenu
+ open={open}
+ onOpenChange={onOpenChange}
+ snoozed
+ onSnooze={onSnooze}
+ onUnsnooze={onUnsnooze}
+ trigger={
+ <button
+ type="button"
+ title={label}
+ className={cn(
+ "inline-flex h-7 max-w-72 min-w-0 items-center gap-1.5 rounded-md border border-border px-2.5 text-caption text-foreground",
+ "hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring data-popup-open:bg-accent",
+ )}
+ >
+ <AlarmClock className="size-3.5 shrink-0" aria-hidden="true" />
+ <span className="min-w-0 truncate max-sm:hidden">{label}</span>
+ <ChevronDown className="size-3 shrink-0 text-muted-foreground" aria-hidden="true" />
+ </button>
+ }
+ />
+ <span aria-hidden className="mx-1 h-4 w-px shrink-0 bg-border" />
+ </>
+ );
+}
diff --git a/packages/views/issues/components/issues-page.tsx b/packages/views/issues/components/issues-page.tsx
index 1b2f930b1c..32f90e2523 100644
--- a/packages/views/issues/components/issues-page.tsx
+++ b/packages/views/issues/components/issues-page.tsx
@@ -2,16 +2,29 @@
import { ListTodo, MessageSquare, Plus } from "@multica/ui/icons";
import { Button } from "@multica/ui/components/ui/button";
+import { useWorkspaceId } from "@multica/core/hooks";
+import { issueViewContainerKey, useActiveIssueViewStore } from "@multica/core/issue-views/active-view-store";
import { useIssuesScope } from "@multica/core/issues/stores/issues-scope-store";
import { useStartChatWithDraft } from "../../chat/use-start-chat-with-draft";
import { useT } from "../../i18n";
import { CollectionPageState } from "../../layout/collection-page";
import { IssueSurface } from "../surface/issue-surface";
import { IssueViewHeader } from "../../issue-views/view-header";
+import { SNOOZED_VIEW_ID } from "../../issue-views/builtin-views";
+import { SnoozedInboxPage } from "../../inbox/components/snoozed-inbox-page";
const WORKSPACE_BASE = { kind: "workspace" } as const;
+const WORKSPACE_SCOPE = { scope_type: "workspace" } as const;
export function IssuesPage() {
+ const wsId = useWorkspaceId();
+ const activeViewId = useActiveIssueViewStore((s) => s.active[issueViewContainerKey(wsId, WORKSPACE_SCOPE)] ?? null);
+ // Snoozed is the Inbox's, listed by when each issue comes back, not a filter of the table.
+ if (activeViewId === SNOOZED_VIEW_ID) return <SnoozedInboxPage />;
+ return <IssuesSurfacePage />;
+}
+
+function IssuesSurfacePage() {
const { t } = useT("issues");
const scope = useIssuesScope("issues");
const startChat = useStartChatWithDraft();
diff --git a/packages/views/layout/app-rail.test.tsx b/packages/views/layout/app-rail.test.tsx
index c7388db5a7..b52e1d7328 100644
--- a/packages/views/layout/app-rail.test.tsx
+++ b/packages/views/layout/app-rail.test.tsx
@@ -57,6 +57,7 @@ vi.mock("@multica/core/inbox/queries", async (importOriginal) => {
useInboxUnreadCount: () => state.inboxUnread,
};
});
+vi.mock("@multica/core/inbox/use-snooze-wake", () => ({ useInboxSnoozeWake: () => {} }));
vi.mock("@multica/core/chat/queries", () => ({
chatSessionsOptions: (wsId: string) => ({
queryKey: ["chat", wsId, "sessions"],
diff --git a/packages/views/layout/app-rail.tsx b/packages/views/layout/app-rail.tsx
index fb7a44e0ae..642ed7d00d 100644
--- a/packages/views/layout/app-rail.tsx
+++ b/packages/views/layout/app-rail.tsx
@@ -24,6 +24,7 @@ import {
useInboxUnreadCount,
} from "@multica/core/inbox/queries";
import { useMarkAllInboxRead } from "@multica/core/inbox/mutations";
+import { useInboxSnoozeWake } from "@multica/core/inbox/use-snooze-wake";
import { useSidebarTreeStore } from "@multica/core/issues/stores/sidebar-tree-store";
import { resolveRailOrder, useRailOrderStore } from "@multica/core/navigation";
import {
@@ -75,6 +76,7 @@ function useRailBadges(): Partial<Record<RailSpaceId, RailBadge>> {
const p = useWorkspacePaths();
const { pathname } = useNavigation();
const inboxUnread = useInboxUnreadCount(wsId);
+ useInboxSnoozeWake(wsId);
const inboxBadge = useSidebarTreeStore((s) => s.inboxSettings.railBadge);
const { data: chatSessions = [] } = useQuery({
diff --git a/packages/views/layout/issue-page-refresh.test.tsx b/packages/views/layout/issue-page-refresh.test.tsx
index 7a9ea7ed43..aa0430a169 100644
--- a/packages/views/layout/issue-page-refresh.test.tsx
+++ b/packages/views/layout/issue-page-refresh.test.tsx
@@ -5,6 +5,7 @@ import { IssuesPage } from "../issues/components/issues-page";
import { MyIssuesPage } from "../my-issues/components/my-issues-page";
const state = vi.hoisted(() => ({ refreshing: false, user: { id: "user-1" } as { id: string } | null }));
+vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "ws-1" }));
vi.mock("@multica/core/auth", () => ({
useAuthStore: (select: (s: typeof state) => unknown) => select(state),
}));
diff --git a/packages/views/layout/panels/inbox-section.test.tsx b/packages/views/layout/panels/inbox-section.test.tsx
index 50aee7bfb8..bb70b7a64f 100644
--- a/packages/views/layout/panels/inbox-section.test.tsx
+++ b/packages/views/layout/panels/inbox-section.test.tsx
@@ -9,7 +9,8 @@ import {
import { useInboxFilterStore } from "@multica/core/inbox/filter-store";
import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";
import { agentTaskSnapshotOptions } from "@multica/core/agents";
-import type { AgentTask, InboxItem } from "@multica/core/types";
+import type { AgentTask, InboxItem, SnoozedInboxIssue } from "@multica/core/types";
+import { snoozedInboxOptions } from "@multica/core/inbox/queries";
import { renderWithI18n } from "../../test/i18n";
import { NavigationProvider, type NavigationAdapter } from "../../navigation";
import { InboxSection, useInboxSectionRows } from "./inbox-section";
@@ -24,6 +25,8 @@ const state = vi.hoisted(() => ({
archiveCompleted: vi.fn(),
markRead: vi.fn(),
markUnread: vi.fn(),
+ snooze: vi.fn(() => Promise.resolve()),
+ unsnooze: vi.fn(() => Promise.resolve()),
}));
vi.mock("@multica/core/paths", async (importOriginal) => {
@@ -42,6 +45,9 @@ vi.mock("@multica/core/inbox/mutations", () => ({
useArchiveCompletedInbox: () => ({ mutate: state.archiveCompleted }),
useMarkInboxRead: () => ({ mutate: state.markRead }),
useMarkInboxUnread: () => ({ mutate: state.markUnread }),
+ useSnoozeInbox: () => ({ mutateAsync: state.snooze }),
+ useUnsnoozeInbox: () => ({ mutateAsync: state.unsnooze }),
+ cachedInboxSnoozedUntil: () => null,
}));
vi.mock("@multica/core/hooks", async (importOriginal) => ({
...(await importOriginal<typeof import("@multica/core/hooks")>()),
@@ -107,9 +113,11 @@ function renderSection(
activeIssueId: string | null = null,
url = "/acme/issues",
tasks: Partial<AgentTask>[] = [],
+ snoozed: SnoozedInboxIssue[] = [],
) {
const client = new QueryClient({ defaultOptions: { queries: { retry: false, staleTime: Infinity } } });
client.setQueryData(["inbox", "ws-1", "list"], items);
+ client.setQueryData(snoozedInboxOptions("ws-1").queryKey, snoozed);
client.setQueryData(agentTaskSnapshotOptions("ws-1").queryKey, tasks as AgentTask[]);
const nav = adapter(url);
// As the Work panel keys it: the issue opened from the section, or the Inbox page's notification.
@@ -453,6 +461,44 @@ describe("InboxSection", () => {
expect(state.archiveAll).toHaveBeenCalledTimes(1);
});
+ it("says a row is back from a snooze, with what arrived meanwhile, until it is read", () => {
+ const snooze = { snoozed_until: "2026-11-12T09:00:00Z", snoozed_at: "2026-11-10T09:00:00Z" };
+ const items = [
+ item({ id: "n3", issue_id: "issue-a", created_at: "2026-11-11T10:00:00Z", ...snooze }),
+ item({ id: "n2", issue_id: "issue-a", created_at: "2026-11-11T08:00:00Z", ...snooze }),
+ item({ id: "n1", issue_id: "issue-a", created_at: "2026-11-10T08:00:00Z", ...snooze }),
+ item({ id: "n4", issue_id: "issue-b", title: "Newer", created_at: "2026-11-11T12:00:00Z" }),
+ ];
+ const { unmount } = renderSection(items);
+ // Back at 09:00 on the 12th, so it sorts above the newer notification.
+ expect(rows()[0]).toHaveTextContent("Snooze ended · 2 updates while snoozed");
+ expect(rows()[1]).toHaveTextContent("Newer");
+ unmount();
+
+ renderSection(items.map((row) => ({ ...row, read: true })));
+ expect(rows()[0]).not.toHaveTextContent("Snooze ended");
+ });
+
+ it("snoozes a row from its hover button", async () => {
+ renderSection([item({ id: "n1", issue_id: "issue-a" })]);
+ fireEvent.click(screen.getByRole("button", { name: "Snooze" }));
+ fireEvent.click(await screen.findByRole("menuitem", { name: /^1 day/ }));
+ expect(state.snooze).toHaveBeenCalledWith({ id: "n1", until: expect.any(Date) });
+ });
+
+ it("opens the snoozed list from the section header, with its count", async () => {
+ const until = "2099-01-01T09:00:00Z";
+ const { nav } = renderSection([item({ id: "n1", issue_id: "issue-a" })], null, "/acme/issues", [], [
+ { issue_id: "issue-z", item_id: "z1", snoozed_until: until, snoozed_at: "2026-11-10T09:00:00Z", updates: 0 },
+ ]);
+
+ fireEvent.click(screen.getByRole("button", { name: "Inbox actions" }));
+ const entry = within(await screen.findByRole("menu")).getByRole("menuitem", { name: /View snoozed/ });
+ expect(entry).toHaveTextContent("1");
+ fireEvent.click(entry);
+ expect(nav.push).toHaveBeenCalledWith("/acme/issues?view=snoozed");
+ });
+
it("opens the archive from the section header", async () => {
const { nav } = renderSection([item({ id: "n1", issue_id: "issue-a" })]);
diff --git a/packages/views/layout/panels/inbox-section.tsx b/packages/views/layout/panels/inbox-section.tsx
index 49c93f2e81..cbe8131f2b 100644
--- a/packages/views/layout/panels/inbox-section.tsx
+++ b/packages/views/layout/panels/inbox-section.tsx
@@ -3,7 +3,7 @@
import { type ReactNode, useMemo, useState } from "react";
import { useQuery } from "@tanstack/react-query";
import { toast } from "sonner";
-import { Archive, BookCheck, CheckCheck, History, ListChecks, MoreHorizontal } from "@multica/ui/icons";
+import { AlarmClock, Archive, BookCheck, CheckCheck, History, ListChecks, MoreHorizontal } from "@multica/ui/icons";
import { cn } from "@multica/ui/lib/utils";
import { useIsCompact } from "@multica/ui/hooks/use-mobile";
import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
@@ -15,6 +15,7 @@ import {
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
+ DropdownMenuShortcut,
DropdownMenuTrigger,
} from "@multica/ui/components/ui/dropdown-menu";
import { inboxTypeGroup, useInboxFilterStore } from "@multica/core/inbox/filter-store";
@@ -25,9 +26,9 @@ import {
useArchiveInbox,
useMarkAllInboxRead,
useMarkInboxRead,
- useMarkInboxUnread,
} from "@multica/core/inbox/mutations";
-import { useInboxUnreadCount } from "@multica/core/inbox/queries";
+import { snoozedInboxOptions, useInboxUnreadCount } from "@multica/core/inbox/queries";
+import { inboxRowTime, inboxSnoozeReturnedAt } from "@multica/core/inbox/snooze";
import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
import { issueDetailOptions } from "@multica/core/issues/queries";
import { useSidebarTreeStore } from "@multica/core/issues/stores/sidebar-tree-store";
@@ -45,6 +46,9 @@ import { ARCHIVED_VIEW_PARAM } from "../../inbox/components/inbox-view";
import { ActorAvatar } from "../../common/actor-avatar";
import { InboxDetailLabel, useTypeLabels } from "../../inbox/components/inbox-detail-label";
import { InboxFilterMenu } from "../../inbox/components/inbox-filter-menu";
+import { InboxSnoozeMenu } from "../../inbox/components/inbox-snooze-menu";
+import { useInboxSnooze } from "../../inbox/components/use-inbox-snooze";
+import { useBuiltinViewNavigation } from "../../issue-views/builtin-views";
import { useFilteredInboxRows } from "../../inbox/components/use-filtered-inbox-rows";
import { useTimeAgo } from "../../inbox/components/inbox-list-item";
import { StatusIcon } from "../../issues/components";
@@ -142,12 +146,23 @@ export function InboxSection({
const compact = useSidebarTreeStore((s) => s.inboxSettings.compact);
const unread = useInboxUnreadCount(wsId);
const archive = useArchiveInbox();
+ const { snooze } = useInboxSnooze();
const { searchParams } = useNavigation();
const isCompact = useIsCompact();
const { list, rows: all, displayed, expanded, limit, setExpanded } = rows;
const clearFilters = useInboxFilterStore((state) => state.clearFilters);
// The notification the Inbox page has open, keyed as it groups rows.
const openKey = pathname === p.inbox() ? searchParams.get("issue") : null;
+ // What arrived on each issue while it was snoozed, for the rows back from one.
+ const updatesWhileSnoozed = useMemo(() => {
+ const counts = new Map<string, number>();
+ for (const item of list.notifications) {
+ if (!item.issue_id || !item.snoozed_at) continue;
+ if (new Date(item.created_at).getTime() <= new Date(item.snoozed_at).getTime()) continue;
+ counts.set(item.issue_id, (counts.get(item.issue_id) ?? 0) + 1);
+ }
+ return counts;
+ }, [list.notifications]);
return (
<PanelSection
@@ -170,7 +185,7 @@ export function InboxSection({
}}
/>
<InboxSectionSettings className={SECTION_SETTINGS_REVEAL_CLASS} />
- <InboxSectionActions className={SECTION_SETTINGS_REVEAL_CLASS} />
+ <InboxSectionActions wsId={wsId} className={SECTION_SETTINGS_REVEAL_CLASS} />
</div>
}
>
@@ -186,7 +201,9 @@ export function InboxSection({
(!!openKey && (item.issue_id ?? item.id) === openKey)
}
compact={compact}
+ updatesWhileSnoozed={item.issue_id ? (updatesWhileSnoozed.get(item.issue_id) ?? 0) : 0}
onArchive={() => archive.mutate(item.id)}
+ onSnooze={(until) => snooze(item, until)}
/>
))}
</PanelList>
@@ -236,7 +253,7 @@ export function InboxSection({
);
}
-function InboxSectionActions({ className }: { className?: string }) {
+function InboxSectionActions({ wsId, className }: { wsId: string; className?: string }) {
const { t } = useT("layout");
const { t: tInbox } = useT("inbox");
const markAllRead = useMarkAllInboxRead();
@@ -245,6 +262,8 @@ function InboxSectionActions({ className }: { className?: string }) {
const archiveCompleted = useArchiveCompletedInbox();
const { push } = useNavigation();
const p = useWorkspacePaths();
+ const builtinNav = useBuiltinViewNavigation();
+ const { data: snoozed } = useQuery(snoozedInboxOptions(wsId));
const label = t(($) => $.panels.work.inbox_actions);
const onError = (fallback: string) => (err: unknown) =>
toast.error(err instanceof Error && err.message ? err.message : fallback);
@@ -269,6 +288,18 @@ function InboxSectionActions({ className }: { className?: string }) {
<MoreHorizontal className="size-3.5" />
</DropdownMenuTrigger>
<DropdownMenuContent side="right" align="start" className="w-auto min-w-48">
+ <DropdownMenuItem
+ onClick={() => {
+ builtinNav.prepare("snoozed");
+ push(builtinNav.hrefFor("snoozed"));
+ }}
+ >
+ <AlarmClock className="size-4" />
+ {t(($) => $.panels.work.inbox_view_snoozed)}
+ {!!snoozed?.length && (
+ <DropdownMenuShortcut className="tracking-normal tabular-nums">{snoozed.length}</DropdownMenuShortcut>
+ )}
+ </DropdownMenuItem>
<DropdownMenuItem onClick={() => push(`${p.inbox()}?${new URLSearchParams({ view: ARCHIVED_VIEW_PARAM })}`)}>
<History className="size-4" />
{t(($) => $.panels.work.inbox_view_archived)}
@@ -317,14 +348,19 @@ function InboxRow({
href,
active,
compact,
+ updatesWhileSnoozed,
onArchive,
+ onSnooze,
}: {
item: InboxItem;
href: string;
active: boolean;
/** One line (status, title, agents, dot or time) instead of the actor line under the title. */
compact: boolean;
+ /** Notifications that arrived while the issue was snoozed. */
+ updatesWhileSnoozed: number;
onArchive: () => void;
+ onSnooze: (until: Date) => void;
}) {
const { t } = useT("inbox");
const typeLabels = useTypeLabels();
@@ -357,10 +393,18 @@ function InboxRow({
const running = !!agents?.running;
const unread = item.read !== true;
const archiveLabel = t(($) => $.list.archive_tooltip);
- // Hidden while the archive button stands in its place.
- const yields = "group-hover/inbox:invisible group-focus-within/inbox:invisible";
+ const snoozeLabel = t(($) => $.snooze.action);
+ const [snoozeOpen, setSnoozeOpen] = useState(false);
+ // Back from a snooze, until it is read: the row says so in place of the actor line.
+ const returned = unread && inboxSnoozeReturnedAt(item) !== null;
+ const at = new Date(inboxRowTime(item)).toISOString();
+ // Hidden while the row's buttons stand in its place.
+ const yields = cn(
+ "group-hover/inbox:invisible group-focus-within/inbox:invisible",
+ snoozeOpen && "invisible",
+ );
const timeClass = "shrink-0 text-caption tabular-nums text-faint-foreground";
- const time = <span className={cn(timeClass, yields)}>{timeAgo(item.created_at)}</span>;
+ const time = <span className={cn(timeClass, yields)}>{timeAgo(at)}</span>;
// Takes the time's place while an agent runs or waits on the issue.
const agentBadge = agents && (
<span className={cn("flex shrink-0 items-center", yields)}>
@@ -399,7 +443,7 @@ function InboxRow({
return (
<li data-inbox-row data-read={unread ? "false" : "true"} className="group/inbox relative">
<HoverCard
- open={cardOpen}
+ open={cardOpen && !snoozeOpen}
onOpenChange={(open) => {
if (open && cardDismissed) return;
setCardOpen(open);
@@ -435,7 +479,13 @@ function InboxRow({
draggable={false}
aria-current={active ? "page" : undefined}
onNavigateInPlace={land}
- className={cn(ISSUE_ROW_LINK_CLASS, compact ? "gap-2.5" : "flex-col items-stretch gap-0")}
+ className={cn(
+ ISSUE_ROW_LINK_CLASS,
+ compact ? "gap-2.5" : "flex-col items-stretch gap-0",
+ // Room for the snooze button beside the archive one.
+ item.issue_id && "group-focus-within/inbox:pr-5 group-hover/inbox:pr-5",
+ snoozeOpen && "pr-5",
+ )}
>
{compact ? (
<>
@@ -456,11 +506,15 @@ function InboxRow({
{/* The status took the avatar's column; it stays with the name. */}
{statusIcon && <InboxActorAvatar item={item} size="xs" />}
<span className="min-w-0 flex-1 truncate">
- <InboxActorLine item={item} />
+ {returned ? (
+ <InboxReturnedLine updates={updatesWhileSnoozed} />
+ ) : (
+ <InboxActorLine item={item} />
+ )}
</span>
</span>
{/* The agents hold the title line's time slot, so the time moves down. */}
- {agents && <span className={timeClass}>{timeAgo(item.created_at)}</span>}
+ {agents && <span className={timeClass}>{timeAgo(at)}</span>}
{unread && dot}
</span>
</>
@@ -483,18 +537,46 @@ function InboxRow({
land();
}}
onArchive={onArchive}
+ onSnooze={
+ item.issue_id
+ ? () => {
+ setCardOpen(false);
+ setSnoozeOpen(true);
+ }
+ : undefined
+ }
/>
</HoverCardContent>
</HoverCard>
+ {item.issue_id && (
+ <InboxSnoozeMenu
+ open={snoozeOpen}
+ onOpenChange={setSnoozeOpen}
+ onSnooze={onSnooze}
+ side="right"
+ align="start"
+ trigger={
+ <button
+ type="button"
+ aria-label={snoozeLabel}
+ title={snoozeLabel}
+ className={cn(
+ rowButtonClass(compact),
+ "right-7",
+ snoozeOpen && "flex bg-surface-selected text-foreground",
+ )}
+ onClick={(event) => event.stopPropagation()}
+ >
+ <AlarmClock className="size-3" />
+ </button>
+ }
+ />
+ )}
<TooltipHint label={archiveLabel}>
<button
type="button"
aria-label={archiveLabel}
- className={cn(
- "absolute right-1.5 z-10 hidden size-5 items-center justify-center rounded-md text-muted-foreground group-hover/inbox:flex group-focus-within/inbox:flex hover:bg-surface-selected hover:text-foreground",
- // On the title's line, where the time was.
- compact ? "top-1/2 -translate-y-1/2" : "top-1.5",
- )}
+ className={cn(rowButtonClass(compact), "right-1.5", snoozeOpen && "flex")}
onClick={(event) => {
event.preventDefault();
event.stopPropagation();
@@ -508,6 +590,29 @@ function InboxRow({
);
}
+/** A row's hover button. */
+function rowButtonClass(compact: boolean) {
+ return cn(
+ "absolute z-10 hidden size-5 items-center justify-center rounded-md text-muted-foreground group-hover/inbox:flex group-focus-within/inbox:flex hover:bg-surface-selected hover:text-foreground",
+ // On the title's line, where the time was.
+ compact ? "top-1/2 -translate-y-1/2" : "top-1.5",
+ );
+}
+
+/** In place of the actor line on a row back from a snooze. */
+function InboxReturnedLine({ updates }: { updates: number }) {
+ const { t } = useT("inbox");
+ return (
+ <span className="inline-flex min-w-0 items-center gap-1 text-brand">
+ <AlarmClock aria-hidden className="size-3 shrink-0" />
+ <span className="truncate">
+ {t(($) => $.snooze.returned)}
+ {updates > 0 && <span className="text-muted-foreground"> · {t(($) => $.snooze.updates, { count: updates })}</span>}
+ </span>
+ </span>
+ );
+}
+
function inboxRowTitle(item: InboxItem, typeLabels: ReturnType<typeof useTypeLabels>) {
return isAutopilotQuotaNotice(item.type) ? typeLabels[item.type] : getInboxDisplayTitle(item);
}
@@ -544,12 +649,15 @@ function InboxRowCard({
title,
onOpen,
onArchive,
+ onSnooze,
}: {
item: InboxItem;
href: string;
title: string;
onOpen: () => void;
onArchive: () => void;
+ /** Opens the row's snooze menu; issue rows only. */
+ onSnooze?: () => void;
}) {
const { t } = useT("layout");
const { t: tInbox } = useT("inbox");
@@ -558,7 +666,6 @@ function InboxRowCard({
const { categoryOf, colorOf, iconOf } = useIssueStatuses(item.workspace_id);
const statusLabelOf = useStatusLabel(item.workspace_id);
const markRead = useMarkInboxRead();
- const markUnread = useMarkInboxUnread();
const { data: issue } = useQuery({ ...issueDetailOptions(item.workspace_id, item.issue_id ?? ""), enabled: !!item.issue_id });
const unread = item.read !== true;
// A comment gets its own block, so the line above names only the kind.
@@ -599,14 +706,16 @@ function InboxRowCard({
<AppLink href={href} onNavigateInPlace={onOpen} className={buttonVariants({ size: "sm", variant: "secondary" })}>
{t(($) => $.panels.work.inbox_open)}
</AppLink>
- <Button
- size="sm"
- variant="ghost"
- className="text-muted-foreground"
- onClick={() => (unread ? markRead.mutate(item.id) : markUnread.mutate(item.id))}
- >
- {unread ? tInbox(($) => $.context_menu.mark_read) : tInbox(($) => $.context_menu.mark_unread)}
- </Button>
+ {unread && (
+ <Button size="sm" variant="ghost" className="text-muted-foreground" onClick={() => markRead.mutate(item.id)}>
+ {tInbox(($) => $.context_menu.mark_read)}
+ </Button>
+ )}
+ {onSnooze && (
+ <Button size="sm" variant="ghost" className="text-muted-foreground" onClick={onSnooze}>
+ {tInbox(($) => $.snooze.action)}
+ </Button>
+ )}
<Button size="sm" variant="ghost" className="text-muted-foreground" onClick={onArchive}>
{tInbox(($) => $.context_menu.archive)}
</Button>
diff --git a/packages/views/layout/panels/views-section.tsx b/packages/views/layout/panels/views-section.tsx
index 0cecad65c2..f1555bf02a 100644
--- a/packages/views/layout/panels/views-section.tsx
+++ b/packages/views/layout/panels/views-section.tsx
@@ -21,6 +21,7 @@ import type { IssueTableFacetsRequest } from "@multica/core/types";
import { useWorkspacePaths } from "@multica/core/paths";
import { issueTableFacetsOptions, sidebarIssuesOptions } from "@multica/core/issues/queries";
import { workspaceWorkingAgentsOptions } from "@multica/core/agents";
+import { snoozedInboxOptions } from "@multica/core/inbox/queries";
import {
SIDEBAR_FIRST_PAGE,
builtinSidebarRequest,
@@ -354,16 +355,24 @@ function BuiltinViewRow({
enabled: builtin === "working",
select: workingIssueIds,
});
+ // Snoozed lists, and counts, the issues the viewer snoozed in the Inbox.
+ const snoozed = useQuery({
+ ...snoozedInboxOptions(wsId),
+ enabled: builtin === "snoozed",
+ select: snoozedIssueIds,
+ });
+ const ids = builtin === "working" ? working : builtin === "snoozed" ? snoozed : null;
const dependency = filterDependencyState(true, [
statusCatalogSource(statusCatalog),
- ...(builtin === "working" ? [working] : []),
+ ...(ids ? [ids] : []),
]);
const request = dependency.unresolved
? undefined
- : builtinSidebarRequest(builtin, issueSettings, statusCatalog.statuses, working.data);
+ : builtinSidebarRequest(builtin, issueSettings, statusCatalog.statuses, ids?.data);
const prefetch = usePrefetch(wsId, source, request);
- const listedCount = useListedCount(wsId, request, showCount && builtin !== "working");
- const count = !showCount ? 0 : builtin === "working" ? (working.data?.length ?? 0) : listedCount;
+ // Working and Snoozed count their own id sets; the rest count what they list.
+ const listedCount = useListedCount(wsId, request, showCount && !ids);
+ const count = !showCount ? 0 : ids ? (ids.data?.length ?? 0) : listedCount;
return (
<>
@@ -425,6 +434,10 @@ function BuiltinViewRow({
);
}
+function snoozedIssueIds(entries: readonly { issue_id: string }[]): string[] {
+ return entries.map((entry) => entry.issue_id).sort();
+}
+
function workingIssueIds(agents: readonly { issue_ids: readonly string[] }[]): string[] {
return [...new Set(agents.flatMap((agent) => agent.issue_ids))].sort();
}
diff --git a/packages/views/locales/en/inbox.json b/packages/views/locales/en/inbox.json
index 6cdbbba39c..48d6ca2c2e 100644
--- a/packages/views/locales/en/inbox.json
+++ b/packages/views/locales/en/inbox.json
@@ -150,5 +150,38 @@
"issue_description": "This permanently deletes the notifications for this issue in this view. The issue and its runs are kept.",
"cancel": "Cancel",
"active_issue_description": "This permanently deletes the active notifications for this issue. Previously archived notifications remain and will be visible again in Archived. The issue and its runs are kept."
+ },
+ "snooze": {
+ "action": "Snooze",
+ "menu_title": "Snooze until…",
+ "unsnooze": "Bring back now",
+ "change_time": "Change time",
+ "hours_1": "1 hour",
+ "hours_3": "3 hours",
+ "days_1": "1 day",
+ "days_3": "3 days",
+ "weeks_1": "1 week",
+ "pick_time": "Pick a date and time…",
+ "picker_title": "Pick a date and time",
+ "picker_back": "Back",
+ "picker_time": "Time",
+ "picker_hour": "Hour",
+ "picker_minute": "Minute",
+ "picker_submit": "Snooze until {{time}}",
+ "hint": "Comes back early when you're mentioned by name, assigned, or a run fails.",
+ "custom_invalid": "Pick a time in the future, within a year.",
+ "back_at": "Back {{time}}",
+ "returned": "Snooze ended",
+ "updates_one": "{{count}} update while snoozed",
+ "updates_other": "{{count}} updates while snoozed",
+ "toast_snoozed": "Snoozed until {{time}}",
+ "toast_unsnoozed": "Back in your inbox",
+ "undo": "Undo",
+ "failed": "Failed to snooze",
+ "unsnooze_failed": "Failed to bring back",
+ "view_empty": "Nothing snoozed",
+ "view_empty_description": "Snooze an issue from your inbox and it waits here until it's time to come back.",
+ "col_updates": "While snoozed",
+ "col_back": "Back"
}
}
diff --git a/packages/views/locales/en/issues.json b/packages/views/locales/en/issues.json
index a9a3c1bfa5..88282e367a 100644
--- a/packages/views/locales/en/issues.json
+++ b/packages/views/locales/en/issues.json
@@ -1895,7 +1895,8 @@
"all_issues": "All issues",
"my_work": "My work",
"working": "Working",
- "subscribed": "Subscribed"
+ "subscribed": "Subscribed",
+ "snoozed": "Snoozed"
},
"untitled": "Untitled view",
"copy_name": "{{name}} (copy)",
diff --git a/packages/views/locales/en/layout.json b/packages/views/locales/en/layout.json
index 5061d5d90a..8800e3b7fc 100644
--- a/packages/views/locales/en/layout.json
+++ b/packages/views/locales/en/layout.json
@@ -172,6 +172,7 @@
"view_delete": "Delete view",
"new_issue_here": "New issue in this project",
"inbox_actions": "Inbox actions",
+ "inbox_view_snoozed": "View snoozed",
"inbox_view_archived": "View archived",
"inbox_empty": "No notifications",
"inbox_settings": "Inbox display",
diff --git a/packages/views/locales/en/settings.json b/packages/views/locales/en/settings.json
index 439727f6cd..b05cf150b8 100644
--- a/packages/views/locales/en/settings.json
+++ b/packages/views/locales/en/settings.json
@@ -432,6 +432,10 @@
"label": "Archive notification",
"description": "Archive the open inbox notification, or restore it while reading the archive."
},
+ "snoozeInboxItem": {
+ "label": "Snooze notification",
+ "description": "Snooze the open inbox issue, or bring it back now if it is snoozed."
+ },
"send": {
"label": "Send",
"description": "Also submits new issues."
diff --git a/packages/views/locales/es/inbox.json b/packages/views/locales/es/inbox.json
index aadc50edfa..c41ec2b4ff 100644
--- a/packages/views/locales/es/inbox.json
+++ b/packages/views/locales/es/inbox.json
@@ -150,5 +150,38 @@
"issue_description": "Las notificaciones de esta tarea en esta vista se eliminarán permanentemente. La tarea y sus ejecuciones se conservarán.",
"cancel": "Cancelar",
"active_issue_description": "Las notificaciones activas de esta tarea se eliminarán permanentemente. Las notificaciones archivadas anteriormente se conservarán y volverán a aparecer en Archivadas. La tarea y sus ejecuciones se conservarán."
+ },
+ "snooze": {
+ "action": "Posponer",
+ "menu_title": "Posponer hasta…",
+ "unsnooze": "Recuperar ahora",
+ "change_time": "Cambiar hora",
+ "hours_1": "1 hora",
+ "hours_3": "3 horas",
+ "days_1": "1 día",
+ "days_3": "3 días",
+ "weeks_1": "1 semana",
+ "pick_time": "Elegir fecha y hora…",
+ "picker_title": "Elegir fecha y hora",
+ "picker_back": "Volver",
+ "picker_time": "Hora",
+ "picker_hour": "Hora",
+ "picker_minute": "Minuto",
+ "picker_submit": "Posponer hasta {{time}}",
+ "hint": "Vuelve antes si te mencionan por tu nombre, te asignan o falla una ejecución.",
+ "custom_invalid": "Elige una hora futura, dentro de un año.",
+ "back_at": "Vuelve {{time}}",
+ "returned": "Pospuesto hasta ahora",
+ "updates_one": "{{count}} novedad mientras estaba pospuesto",
+ "updates_other": "{{count}} novedades mientras estaba pospuesto",
+ "toast_snoozed": "Pospuesto hasta {{time}}",
+ "toast_unsnoozed": "De vuelta en tu bandeja",
+ "undo": "Deshacer",
+ "failed": "No se pudo posponer",
+ "unsnooze_failed": "No se pudo recuperar",
+ "view_empty": "Nada pospuesto",
+ "view_empty_description": "Pospón un issue desde tu bandeja de entrada y esperará aquí hasta que sea hora de volver.",
+ "col_updates": "Mientras estaba pospuesto",
+ "col_back": "Vuelve"
}
}
diff --git a/packages/views/locales/es/issues.json b/packages/views/locales/es/issues.json
index ebe9664582..c19b9fd169 100644
--- a/packages/views/locales/es/issues.json
+++ b/packages/views/locales/es/issues.json
@@ -1895,7 +1895,8 @@
"all_issues": "Todas las tareas",
"my_work": "Mi trabajo",
"working": "En ejecución",
- "subscribed": "Suscritas"
+ "subscribed": "Suscritas",
+ "snoozed": "Pospuestos"
},
"untitled": "Vista sin título",
"copy_name": "{{name}} (copia)",
diff --git a/packages/views/locales/es/layout.json b/packages/views/locales/es/layout.json
index f39b52d9fa..740fcd9b8b 100644
--- a/packages/views/locales/es/layout.json
+++ b/packages/views/locales/es/layout.json
@@ -172,6 +172,7 @@
"view_delete": "Eliminar vista",
"new_issue_here": "Nueva tarea en este proyecto",
"inbox_actions": "Acciones de la bandeja",
+ "inbox_view_snoozed": "Ver pospuestos",
"inbox_view_archived": "Ver archivadas",
"inbox_empty": "Sin notificaciones",
"inbox_settings": "Visualización de la bandeja",
diff --git a/packages/views/locales/es/settings.json b/packages/views/locales/es/settings.json
index 907d507ed5..77dcc29b59 100644
--- a/packages/views/locales/es/settings.json
+++ b/packages/views/locales/es/settings.json
@@ -432,6 +432,10 @@
"label": "Archivar notificación",
"description": "Archiva la notificación de la bandeja abierta, o restaúrala mientras lees el archivo."
},
+ "snoozeInboxItem": {
+ "label": "Posponer notificación",
+ "description": "Pospone el issue abierto de la bandeja, o lo recupera ahora si ya está pospuesto."
+ },
"send": {
"label": "Enviar",
"description": "También envía nuevas tareas."
diff --git a/packages/views/locales/fr/inbox.json b/packages/views/locales/fr/inbox.json
index 96fca9a473..a8a99511e6 100644
--- a/packages/views/locales/fr/inbox.json
+++ b/packages/views/locales/fr/inbox.json
@@ -150,5 +150,38 @@
"issue_description": "Les notifications de cette tâche dans cette vue seront supprimées définitivement. La tâche et ses exécutions seront conservées.",
"cancel": "Annuler",
"active_issue_description": "Les notifications actives de cette tâche seront supprimées définitivement. Les notifications précédemment archivées seront conservées et réapparaîtront dans les archives. La tâche et ses exécutions seront conservées."
+ },
+ "snooze": {
+ "action": "Reporter",
+ "menu_title": "Reporter jusqu'à…",
+ "unsnooze": "Faire revenir maintenant",
+ "change_time": "Changer l'heure",
+ "hours_1": "1 heure",
+ "hours_3": "3 heures",
+ "days_1": "1 jour",
+ "days_3": "3 jours",
+ "weeks_1": "1 semaine",
+ "pick_time": "Choisir une date et une heure…",
+ "picker_title": "Choisir une date et une heure",
+ "picker_back": "Retour",
+ "picker_time": "Heure",
+ "picker_hour": "Heure",
+ "picker_minute": "Minute",
+ "picker_submit": "Reporter jusqu'à {{time}}",
+ "hint": "Revient plus tôt si vous êtes mentionné nommément, assigné, ou si une exécution échoue.",
+ "custom_invalid": "Choisissez une heure future, dans moins d'un an.",
+ "back_at": "Revient {{time}}",
+ "returned": "Report terminé",
+ "updates_one": "{{count}} nouveauté pendant le report",
+ "updates_other": "{{count}} nouveautés pendant le report",
+ "toast_snoozed": "Reporté jusqu'à {{time}}",
+ "toast_unsnoozed": "De retour dans votre boîte de réception",
+ "undo": "Annuler",
+ "failed": "Impossible de reporter",
+ "unsnooze_failed": "Impossible de faire revenir",
+ "view_empty": "Rien de reporté",
+ "view_empty_description": "Reportez une tâche depuis votre boîte de réception : elle attend ici jusqu'à son retour.",
+ "col_updates": "Pendant le report",
+ "col_back": "Retour"
}
}
diff --git a/packages/views/locales/fr/issues.json b/packages/views/locales/fr/issues.json
index 05948a8084..58cf72a2d8 100644
--- a/packages/views/locales/fr/issues.json
+++ b/packages/views/locales/fr/issues.json
@@ -1895,7 +1895,8 @@
"all_issues": "Toutes les tâches",
"my_work": "Mon travail",
"working": "En cours d'exécution",
- "subscribed": "Abonnements"
+ "subscribed": "Abonnements",
+ "snoozed": "Reportés"
},
"untitled": "Vue sans titre",
"copy_name": "{{name}} (copie)",
diff --git a/packages/views/locales/fr/layout.json b/packages/views/locales/fr/layout.json
index 3c23702c73..42de93fe67 100644
--- a/packages/views/locales/fr/layout.json
+++ b/packages/views/locales/fr/layout.json
@@ -172,6 +172,7 @@
"view_delete": "Supprimer la vue",
"new_issue_here": "Nouvelle tâche dans ce projet",
"inbox_actions": "Actions de la boîte de réception",
+ "inbox_view_snoozed": "Voir les reportés",
"inbox_view_archived": "Voir les archivées",
"inbox_empty": "Aucune notification",
"inbox_settings": "Affichage de la boîte de réception",
diff --git a/packages/views/locales/fr/settings.json b/packages/views/locales/fr/settings.json
index 241d109880..a4f17a241a 100644
--- a/packages/views/locales/fr/settings.json
+++ b/packages/views/locales/fr/settings.json
@@ -432,6 +432,10 @@
"label": "Archiver la notification",
"description": "Archiver la notification ouverte, ou la restaurer lors de la consultation des archives."
},
+ "snoozeInboxItem": {
+ "label": "Reporter la notification",
+ "description": "Reporte la tâche ouverte depuis la boîte de réception, ou la fait revenir si elle est reportée."
+ },
"send": {
"label": "Envoyer",
"description": "Permet aussi de créer des tâches."
diff --git a/packages/views/locales/ja/inbox.json b/packages/views/locales/ja/inbox.json
index 4836f6590e..849a5a3447 100644
--- a/packages/views/locales/ja/inbox.json
+++ b/packages/views/locales/ja/inbox.json
@@ -148,5 +148,37 @@
"issue_description": "このビューにあるこのタスクの通知は完全に削除されます。タスクと実行記録は残ります。",
"cancel": "キャンセル",
"active_issue_description": "このタスクの受信トレイ内の通知は完全に削除されます。以前アーカイブした通知は残り、アーカイブに再表示されます。タスクと実行記録は残ります。"
+ },
+ "snooze": {
+ "action": "スヌーズ",
+ "menu_title": "スヌーズする時間…",
+ "unsnooze": "今すぐ戻す",
+ "change_time": "時間を変更",
+ "hours_1": "1 時間",
+ "hours_3": "3 時間",
+ "days_1": "1 日",
+ "days_3": "3 日",
+ "weeks_1": "1 週間",
+ "pick_time": "日時を選択…",
+ "picker_title": "日時を選択",
+ "picker_back": "戻る",
+ "picker_time": "時刻",
+ "picker_hour": "時",
+ "picker_minute": "分",
+ "picker_submit": "{{time}} までスヌーズ",
+ "hint": "名指しでメンションされたとき、割り当てられたとき、実行が失敗したときは早めに戻ります。",
+ "custom_invalid": "1 年以内の未来の時間を選択してください。",
+ "back_at": "{{time}} に戻る",
+ "returned": "スヌーズ終了",
+ "updates_other": "スヌーズ中に {{count}} 件の更新",
+ "toast_snoozed": "{{time}} までスヌーズしました",
+ "toast_unsnoozed": "インボックスに戻しました",
+ "undo": "元に戻す",
+ "failed": "スヌーズできませんでした",
+ "unsnooze_failed": "戻せませんでした",
+ "view_empty": "スヌーズ中の項目はありません",
+ "view_empty_description": "インボックスでタスクをスヌーズすると、戻る時間までここで待機します。",
+ "col_updates": "スヌーズ中",
+ "col_back": "戻る時間"
}
}
diff --git a/packages/views/locales/ja/issues.json b/packages/views/locales/ja/issues.json
index 8b4340f1b3..63a01a75a8 100644
--- a/packages/views/locales/ja/issues.json
+++ b/packages/views/locales/ja/issues.json
@@ -1818,7 +1818,8 @@
"all_issues": "すべてのタスク",
"my_work": "自分の作業",
"working": "実行中",
- "subscribed": "購読中"
+ "subscribed": "購読中",
+ "snoozed": "スヌーズ中"
},
"untitled": "無題のビュー",
"copy_name": "{{name}}(コピー)",
diff --git a/packages/views/locales/ja/layout.json b/packages/views/locales/ja/layout.json
index e17c211d1e..2730b77433 100644
--- a/packages/views/locales/ja/layout.json
+++ b/packages/views/locales/ja/layout.json
@@ -168,6 +168,7 @@
"view_delete": "ビューを削除",
"new_issue_here": "このプロジェクトに新規タスク",
"inbox_actions": "インボックスの操作",
+ "inbox_view_snoozed": "スヌーズ中を表示",
"inbox_view_archived": "アーカイブ済みを表示",
"inbox_empty": "通知はありません",
"inbox_settings": "インボックスの表示",
diff --git a/packages/views/locales/ja/settings.json b/packages/views/locales/ja/settings.json
index b0956cfc78..09a30d75fd 100644
--- a/packages/views/locales/ja/settings.json
+++ b/packages/views/locales/ja/settings.json
@@ -426,6 +426,10 @@
"label": "通知をアーカイブ",
"description": "開いているインボックス通知をアーカイブします。アーカイブ表示中はアーカイブを解除します。"
},
+ "snoozeInboxItem": {
+ "label": "通知をスヌーズ",
+ "description": "インボックスから開いたタスクをスヌーズします。スヌーズ中なら今すぐ戻します。"
+ },
"send": {
"label": "送信",
"description": "新しいタスクの作成にも使えます。"
diff --git a/packages/views/locales/ko/inbox.json b/packages/views/locales/ko/inbox.json
index 4a19213907..8ccfcac2ec 100644
--- a/packages/views/locales/ko/inbox.json
+++ b/packages/views/locales/ko/inbox.json
@@ -148,5 +148,37 @@
"issue_description": "이 보기에서 해당 작업의 알림이 영구적으로 삭제됩니다. 작업과 실행 기록은 유지됩니다.",
"cancel": "취소",
"active_issue_description": "이 작업의 받은편지함 알림은 영구적으로 삭제됩니다. 이전에 보관한 알림은 유지되며 보관함에 다시 표시됩니다. 작업과 실행 기록은 유지됩니다."
+ },
+ "snooze": {
+ "action": "다시 알림",
+ "menu_title": "다시 알릴 시간…",
+ "unsnooze": "지금 되돌리기",
+ "change_time": "시간 변경",
+ "hours_1": "1시간",
+ "hours_3": "3시간",
+ "days_1": "1일",
+ "days_3": "3일",
+ "weeks_1": "1주",
+ "pick_time": "날짜와 시간 선택…",
+ "picker_title": "날짜와 시간 선택",
+ "picker_back": "뒤로",
+ "picker_time": "시간",
+ "picker_hour": "시",
+ "picker_minute": "분",
+ "picker_submit": "{{time}}까지 미루기",
+ "hint": "이름으로 멘션되거나, 할당되거나, 실행이 실패하면 일찍 돌아옵니다.",
+ "custom_invalid": "1년 이내의 미래 시간을 선택하세요.",
+ "back_at": "{{time}}에 돌아옴",
+ "returned": "다시 알림 종료",
+ "updates_other": "미뤄둔 동안 업데이트 {{count}}개",
+ "toast_snoozed": "{{time}}까지 미뤘습니다",
+ "toast_unsnoozed": "인박스로 돌아왔습니다",
+ "undo": "실행 취소",
+ "failed": "미루지 못했습니다",
+ "unsnooze_failed": "되돌리지 못했습니다",
+ "view_empty": "미뤄둔 항목이 없습니다",
+ "view_empty_description": "인박스에서 태스크를 미루면 돌아올 시간까지 여기에서 기다립니다.",
+ "col_updates": "미뤄둔 동안",
+ "col_back": "돌아오는 시간"
}
}
diff --git a/packages/views/locales/ko/issues.json b/packages/views/locales/ko/issues.json
index 5eba8c52a4..e336a97bca 100644
--- a/packages/views/locales/ko/issues.json
+++ b/packages/views/locales/ko/issues.json
@@ -1818,7 +1818,8 @@
"all_issues": "전체 태스크",
"my_work": "내 작업",
"working": "실행 중",
- "subscribed": "구독 중"
+ "subscribed": "구독 중",
+ "snoozed": "미뤄둔 항목"
},
"untitled": "제목 없는 뷰",
"copy_name": "{{name}} (사본)",
diff --git a/packages/views/locales/ko/layout.json b/packages/views/locales/ko/layout.json
index 5a76ce42f5..c21d0b0cc1 100644
--- a/packages/views/locales/ko/layout.json
+++ b/packages/views/locales/ko/layout.json
@@ -168,6 +168,7 @@
"view_delete": "뷰 삭제",
"new_issue_here": "이 프로젝트에 새 태스크",
"inbox_actions": "인박스 작업",
+ "inbox_view_snoozed": "미뤄둔 항목 보기",
"inbox_view_archived": "보관된 알림 보기",
"inbox_empty": "알림 없음",
"inbox_settings": "인박스 표시",
diff --git a/packages/views/locales/ko/settings.json b/packages/views/locales/ko/settings.json
index 1c8e1cf225..dfe2d33b0b 100644
--- a/packages/views/locales/ko/settings.json
+++ b/packages/views/locales/ko/settings.json
@@ -426,6 +426,10 @@
"label": "알림 보관",
"description": "열린 인박스 알림을 보관합니다. 보관함을 보는 중에는 보관을 해제합니다."
},
+ "snoozeInboxItem": {
+ "label": "알림 미루기",
+ "description": "인박스에서 연 태스크를 미룹니다. 이미 미뤘다면 지금 되돌립니다."
+ },
"send": {
"label": "보내기",
"description": "새 태스크 생성에도 사용됩니다."
diff --git a/packages/views/locales/ru/inbox.json b/packages/views/locales/ru/inbox.json
index ecbc0c509e..1ceb380d54 100644
--- a/packages/views/locales/ru/inbox.json
+++ b/packages/views/locales/ru/inbox.json
@@ -154,5 +154,40 @@
"issue_description": "Уведомления этой задачи в текущем представлении будут удалены навсегда. Задача и её запуски сохранятся.",
"cancel": "Отмена",
"active_issue_description": "Активные уведомления этой задачи будут удалены навсегда. Ранее архивированные уведомления сохранятся и снова появятся в архиве. Задача и её запуски сохранятся."
+ },
+ "snooze": {
+ "action": "Отложить",
+ "menu_title": "Отложить до…",
+ "unsnooze": "Вернуть сейчас",
+ "change_time": "Изменить время",
+ "hours_1": "1 час",
+ "hours_3": "3 часа",
+ "days_1": "1 день",
+ "days_3": "3 дня",
+ "weeks_1": "1 неделя",
+ "pick_time": "Выбрать дату и время…",
+ "picker_title": "Выбрать дату и время",
+ "picker_back": "Назад",
+ "picker_time": "Время",
+ "picker_hour": "Часы",
+ "picker_minute": "Минуты",
+ "picker_submit": "Отложить до {{time}}",
+ "hint": "Вернётся раньше, если вас упомянут по имени, назначат или запуск завершится с ошибкой.",
+ "custom_invalid": "Выберите время в будущем, не дальше чем через год.",
+ "back_at": "Вернётся {{time}}",
+ "returned": "Срок отсрочки истёк",
+ "updates_one": "{{count}} обновление за время отсрочки",
+ "updates_few": "{{count}} обновления за время отсрочки",
+ "updates_many": "{{count}} обновлений за время отсрочки",
+ "updates_other": "{{count}} обновления за время отсрочки",
+ "toast_snoozed": "Отложено до {{time}}",
+ "toast_unsnoozed": "Снова во входящих",
+ "undo": "Отменить",
+ "failed": "Не удалось отложить",
+ "unsnooze_failed": "Не удалось вернуть",
+ "view_empty": "Ничего не отложено",
+ "view_empty_description": "Отложите issue во входящих — оно подождёт здесь, пока не придёт время вернуться.",
+ "col_updates": "За время отсрочки",
+ "col_back": "Вернётся"
}
}
diff --git a/packages/views/locales/ru/issues.json b/packages/views/locales/ru/issues.json
index ce2ffb3edb..5ece793cf5 100644
--- a/packages/views/locales/ru/issues.json
+++ b/packages/views/locales/ru/issues.json
@@ -2048,7 +2048,8 @@
"all_issues": "Все задачи",
"my_work": "Моя работа",
"working": "Выполняются",
- "subscribed": "Подписки"
+ "subscribed": "Подписки",
+ "snoozed": "Отложенные"
},
"untitled": "Представление без названия",
"copy_name": "{{name}} (копия)",
diff --git a/packages/views/locales/ru/layout.json b/packages/views/locales/ru/layout.json
index 925d07f4f6..8b5385075b 100644
--- a/packages/views/locales/ru/layout.json
+++ b/packages/views/locales/ru/layout.json
@@ -148,6 +148,7 @@
"project_issues_retry": "Повторить",
"new_issue_here": "Новая задача в этом проекте",
"inbox_actions": "Действия со входящими",
+ "inbox_view_snoozed": "Показать отложенные",
"inbox_view_archived": "Открыть архив",
"inbox_empty": "Нет уведомлений",
"inbox_settings": "Отображение входящих",
diff --git a/packages/views/locales/ru/settings.json b/packages/views/locales/ru/settings.json
index 7fc1e8e41b..ad09f2859e 100644
--- a/packages/views/locales/ru/settings.json
+++ b/packages/views/locales/ru/settings.json
@@ -443,6 +443,10 @@
"label": "Архивировать уведомление",
"description": "Отправить в архив открытое уведомление во входящих или восстановить его при просмотре архива."
},
+ "snoozeInboxItem": {
+ "label": "Отложить уведомление",
+ "description": "Откладывает открытое issue из входящих или возвращает его, если оно уже отложено."
+ },
"send": {
"label": "Отправить",
"description": "Также отправляет новые задачи."
diff --git a/packages/views/locales/zh-Hans/inbox.json b/packages/views/locales/zh-Hans/inbox.json
index 4d7abc71ae..3341c70833 100644
--- a/packages/views/locales/zh-Hans/inbox.json
+++ b/packages/views/locales/zh-Hans/inbox.json
@@ -148,5 +148,37 @@
"issue_description": "当前视图中此任务的通知将被永久删除,任务和运行记录不受影响。",
"cancel": "取消",
"active_issue_description": "此任务在收件箱中的通知将被永久删除。此前归档的通知会保留,并重新显示在归档视图中。任务和运行记录不受影响。"
+ },
+ "snooze": {
+ "action": "延后",
+ "menu_title": "延后到…",
+ "unsnooze": "现在回来",
+ "change_time": "修改时间",
+ "hours_1": "1 小时",
+ "hours_3": "3 小时",
+ "days_1": "1 天",
+ "days_3": "3 天",
+ "weeks_1": "1 周",
+ "pick_time": "选择日期和时间…",
+ "picker_title": "选择日期和时间",
+ "picker_back": "返回",
+ "picker_time": "时间",
+ "picker_hour": "时",
+ "picker_minute": "分",
+ "picker_submit": "延后到 {{time}}",
+ "hint": "被点名 @、被指派或运行失败时会提前回来。",
+ "custom_invalid": "请选择一年内的未来时间。",
+ "back_at": "{{time}} 回来",
+ "returned": "延后到期",
+ "updates_other": "期间 {{count}} 条动态",
+ "toast_snoozed": "已延后到 {{time}}",
+ "toast_unsnoozed": "已回到收件箱",
+ "undo": "撤销",
+ "failed": "延后失败",
+ "unsnooze_failed": "恢复失败",
+ "view_empty": "没有延后的事项",
+ "view_empty_description": "在收件箱里延后一个任务,它会在这里等到时间再回来。",
+ "col_updates": "延后期间",
+ "col_back": "回来时间"
}
}
diff --git a/packages/views/locales/zh-Hans/issues.json b/packages/views/locales/zh-Hans/issues.json
index 6dcf8c793a..133afd1498 100644
--- a/packages/views/locales/zh-Hans/issues.json
+++ b/packages/views/locales/zh-Hans/issues.json
@@ -1818,7 +1818,8 @@
"all_issues": "全部任务",
"my_work": "我的工作",
"working": "执行中",
- "subscribed": "已订阅"
+ "subscribed": "已订阅",
+ "snoozed": "已延后"
},
"untitled": "未命名视图",
"copy_name": "{{name}}(副本)",
diff --git a/packages/views/locales/zh-Hans/layout.json b/packages/views/locales/zh-Hans/layout.json
index b3f6460815..fabaa651d6 100644
--- a/packages/views/locales/zh-Hans/layout.json
+++ b/packages/views/locales/zh-Hans/layout.json
@@ -168,6 +168,7 @@
"view_delete": "删除视图",
"new_issue_here": "在此项目中新建任务",
"inbox_actions": "收件箱操作",
+ "inbox_view_snoozed": "查看已延后",
"inbox_view_archived": "查看已归档",
"inbox_empty": "暂无通知",
"inbox_settings": "收件箱显示",
diff --git a/packages/views/locales/zh-Hans/settings.json b/packages/views/locales/zh-Hans/settings.json
index ba089fc582..e2a3c67527 100644
--- a/packages/views/locales/zh-Hans/settings.json
+++ b/packages/views/locales/zh-Hans/settings.json
@@ -426,6 +426,10 @@
"label": "归档通知",
"description": "归档当前打开的收件箱通知;在归档列表中则取消归档。"
},
+ "snoozeInboxItem": {
+ "label": "延后通知",
+ "description": "延后从收件箱打开的任务;已延后时让它现在回来。"
+ },
"send": {
"label": "发送",
"description": "也用于提交新任务。"
diff --git a/packages/views/locales/zh-Hant/inbox.json b/packages/views/locales/zh-Hant/inbox.json
index 5572918134..8ed962bd1c 100644
--- a/packages/views/locales/zh-Hant/inbox.json
+++ b/packages/views/locales/zh-Hant/inbox.json
@@ -148,5 +148,37 @@
"issue_description": "目前檢視中此任務的通知將被永久刪除,任務和執行記錄不受影響。",
"cancel": "取消",
"active_issue_description": "此任務在收件箱中的通知將被永久刪除。先前歸檔的通知會保留,並重新顯示在已歸檔檢視中。任務和執行記錄不受影響。"
+ },
+ "snooze": {
+ "action": "延後",
+ "menu_title": "延後到…",
+ "unsnooze": "現在回來",
+ "change_time": "修改時間",
+ "hours_1": "1 小時",
+ "hours_3": "3 小時",
+ "days_1": "1 天",
+ "days_3": "3 天",
+ "weeks_1": "1 週",
+ "pick_time": "選擇日期和時間…",
+ "picker_title": "選擇日期和時間",
+ "picker_back": "返回",
+ "picker_time": "時間",
+ "picker_hour": "時",
+ "picker_minute": "分",
+ "picker_submit": "延後到 {{time}}",
+ "hint": "被點名 @、被指派或執行失敗時會提前回來。",
+ "custom_invalid": "請選擇一年內的未來時間。",
+ "back_at": "{{time}} 回來",
+ "returned": "延後到期",
+ "updates_other": "期間 {{count}} 則動態",
+ "toast_snoozed": "已延後到 {{time}}",
+ "toast_unsnoozed": "已回到收件箱",
+ "undo": "復原",
+ "failed": "延後失敗",
+ "unsnooze_failed": "恢復失敗",
+ "view_empty": "沒有延後的項目",
+ "view_empty_description": "在收件箱裡延後一個任務,它會在這裡等到時間再回來。",
+ "col_updates": "延後期間",
+ "col_back": "回來時間"
}
}
diff --git a/packages/views/locales/zh-Hant/issues.json b/packages/views/locales/zh-Hant/issues.json
index df828d0b47..9a6feab512 100644
--- a/packages/views/locales/zh-Hant/issues.json
+++ b/packages/views/locales/zh-Hant/issues.json
@@ -1818,7 +1818,8 @@
"all_issues": "全部任務",
"my_work": "我的工作",
"working": "執行中",
- "subscribed": "已訂閱"
+ "subscribed": "已訂閱",
+ "snoozed": "已延後"
},
"untitled": "未命名檢視",
"copy_name": "{{name}}(副本)",
diff --git a/packages/views/locales/zh-Hant/layout.json b/packages/views/locales/zh-Hant/layout.json
index 927fdeea76..1589410925 100644
--- a/packages/views/locales/zh-Hant/layout.json
+++ b/packages/views/locales/zh-Hant/layout.json
@@ -168,6 +168,7 @@
"view_delete": "刪除檢視",
"new_issue_here": "在此專案中新建任務",
"inbox_actions": "收件箱操作",
+ "inbox_view_snoozed": "查看已延後",
"inbox_view_archived": "查看已歸檔",
"inbox_empty": "暫無通知",
"inbox_settings": "收件箱顯示",
diff --git a/packages/views/locales/zh-Hant/settings.json b/packages/views/locales/zh-Hant/settings.json
index 086e93de9e..ebe09d638d 100644
--- a/packages/views/locales/zh-Hant/settings.json
+++ b/packages/views/locales/zh-Hant/settings.json
@@ -426,6 +426,10 @@
"label": "歸檔通知",
"description": "歸檔當前開啟的收件箱通知;在歸檔列表中則取消歸檔。"
},
+ "snoozeInboxItem": {
+ "label": "延後通知",
+ "description": "延後從收件箱開啟的任務;已延後時讓它現在回來。"
+ },
"send": {
"label": "傳送",
"description": "也用於提交新任務。"
diff --git a/packages/views/search/search-command.test.tsx b/packages/views/search/search-command.test.tsx
index 390c1fb3fb..fd44236bcc 100644
--- a/packages/views/search/search-command.test.tsx
+++ b/packages/views/search/search-command.test.tsx
@@ -863,7 +863,7 @@ describe("SearchCommand", () => {
renderSearch();
await user.type(input(), "views");
- await waitFor(() => expect(viewRows()).toHaveLength(6));
+ await waitFor(() => expect(viewRows()).toHaveLength(7));
expect(renderedValues().indexOf("page:views")).toBeLessThan(renderedValues().indexOf("view:view-bugs"));
});
diff --git a/packages/views/settings/components/keyboard-shortcuts-tab.tsx b/packages/views/settings/components/keyboard-shortcuts-tab.tsx
index e68e280b89..cf2613e490 100644
--- a/packages/views/settings/components/keyboard-shortcuts-tab.tsx
+++ b/packages/views/settings/components/keyboard-shortcuts-tab.tsx
@@ -273,7 +273,7 @@ function ShortcutRow({
const { t } = useT("settings");
const label = t(($) => $.shortcuts.actions[action.id].label);
// Keep descriptions in the search index, but only show non-obvious behavior.
- const description = ["openSearch", "toggleRightSidebar", "archiveInboxItem", "send"].includes(action.id)
+ const description = ["openSearch", "toggleRightSidebar", "archiveInboxItem", "snoozeInboxItem", "send"].includes(action.id)
? t(($) => $.shortcuts.actions[action.id].description)
: undefined;
const errorText = error?.kind === "reserved"
diff --git a/server/cmd/server/listeners.go b/server/cmd/server/listeners.go
index ee0c9ee09c..b5d2bb7041 100644
--- a/server/cmd/server/listeners.go
+++ b/server/cmd/server/listeners.go
@@ -120,6 +120,8 @@ func registerListeners(bus *events.Bus, b realtime.Broadcaster, audience ...priv
protocol.EventInboxDeleted: true,
protocol.EventInboxBatchRead: true,
protocol.EventInboxBatchArchived: true,
+ protocol.EventInboxSnoozed: true,
+ protocol.EventInboxUnsnoozed: true,
protocol.EventInvitationCreated: true,
protocol.EventInvitationRevoked: true,
protocol.EventIssueUnreadChanged: true,
@@ -152,6 +154,20 @@ func registerListeners(bus *events.Bus, b realtime.Broadcaster, audience ...priv
sendToRecipient(b, e, recipientID)
})
+ // inbox:snoozed — a snooze names its recipient at the top level; a row
+ // written into a snooze carries it on the nested item, like inbox:new.
+ bus.Subscribe(protocol.EventInboxSnoozed, func(e events.Event) {
+ payload, ok := e.Payload.(map[string]any)
+ if !ok {
+ return
+ }
+ recipientID, _ := payload["recipient_id"].(string)
+ if item, ok := payload["item"].(map[string]any); ok && recipientID == "" {
+ recipientID, _ = item["recipient_id"].(string)
+ }
+ sendToRecipient(b, e, recipientID)
+ })
+
// inbox:read, inbox:archived, inbox:unarchived, inbox:batch-read,
// inbox:batch-archived, issue_unread:changed — extract recipient from
// top-level payload
@@ -159,6 +175,7 @@ func registerListeners(bus *events.Bus, b realtime.Broadcaster, audience ...priv
protocol.EventInboxRead, protocol.EventInboxArchived, protocol.EventInboxUnarchived,
protocol.EventInboxDeleted,
protocol.EventInboxBatchRead, protocol.EventInboxBatchArchived,
+ protocol.EventInboxUnsnoozed,
protocol.EventIssueUnreadChanged,
} {
bus.Subscribe(eventType, func(e events.Event) {
diff --git a/server/cmd/server/notification_listeners.go b/server/cmd/server/notification_listeners.go
index e56e2d8787..d14830a8ac 100644
--- a/server/cmd/server/notification_listeners.go
+++ b/server/cmd/server/notification_listeners.go
@@ -556,7 +556,7 @@ func createMemberInboxItem(
resp := inboxItemToResponse(item)
resp["issue_status"] = issueStatus
bus.Publish(events.Event{
- Type: protocol.EventInboxNew,
+ Type: inbox.NewItemEventType(item),
WorkspaceID: workspaceID,
ActorType: e.ActorType,
ActorID: e.ActorID,
@@ -720,7 +720,7 @@ func notifyDirect(
resp := inboxItemToResponse(item)
resp["issue_status"] = issueStatus
bus.Publish(events.Event{
- Type: protocol.EventInboxNew,
+ Type: inbox.NewItemEventType(item),
WorkspaceID: workspaceID,
ActorType: e.ActorType,
ActorID: e.ActorID,
@@ -798,8 +798,18 @@ func notifyMentionedMembers(
details []byte,
) map[string]bool {
notified := map[string]bool{}
- // Collect the set of member IDs to notify.
+ // Collect the set of member IDs to notify, each with how the mention
+ // reached them. Naming someone outranks reaching them through a squad,
+ // which outranks @all.
recipientIDs := map[string]bool{}
+ via := map[string]string{}
+ reach := func(id, how string) {
+ recipientIDs[id] = true
+ if via[id] == inbox.MentionViaMember || (via[id] == inbox.MentionViaSquad && how == inbox.MentionViaAll) {
+ return
+ }
+ via[id] = how
+ }
hasAll := false
var squadIDs []string
@@ -812,7 +822,7 @@ func notifyMentionedMembers(
if _, err := util.ParseUUID(m.ID); err != nil {
continue
}
- recipientIDs[m.ID] = true
+ reach(m.ID, inbox.MentionViaMember)
}
if m.Type == "squad" {
squadIDs = append(squadIDs, m.ID)
@@ -834,7 +844,7 @@ func notifyMentionedMembers(
}
for _, sm := range members {
if sm.MemberType == "member" {
- recipientIDs[util.UUIDToString(sm.MemberID)] = true
+ reach(util.UUIDToString(sm.MemberID), inbox.MentionViaSquad)
}
}
}
@@ -846,7 +856,7 @@ func notifyMentionedMembers(
slog.Error("failed to list members for @all mention", "workspace_id", e.WorkspaceID, "error", err)
} else {
for _, m := range members {
- recipientIDs[util.UUIDToString(m.UserID)] = true
+ reach(util.UUIDToString(m.UserID), inbox.MentionViaAll)
}
}
}
@@ -882,7 +892,7 @@ func notifyMentionedMembers(
Body: util.StrToText(body),
ActorType: util.StrToText(e.ActorType),
ActorID: optionalUUID(e.ActorID),
- Details: details,
+ Details: withDetail(details, "mention_via", via[id]),
})
if err != nil {
slog.Error("mention inbox creation failed", "mentioned_id", id, "error", err)
@@ -895,7 +905,7 @@ func notifyMentionedMembers(
resp := inboxItemToResponse(item)
resp["issue_status"] = issueStatus
bus.Publish(events.Event{
- Type: protocol.EventInboxNew,
+ Type: inbox.NewItemEventType(item),
WorkspaceID: e.WorkspaceID,
ActorType: e.ActorType,
ActorID: e.ActorID,
@@ -1367,3 +1377,20 @@ func inboxItemToResponse(item db.InboxItem) map[string]any {
"details": json.RawMessage(item.Details),
}
}
+
+// withDetail returns details with one more string field. Details that are not
+// a JSON object are returned as they are.
+func withDetail(details []byte, key, value string) []byte {
+ fields := map[string]any{}
+ if len(details) > 0 {
+ if err := json.Unmarshal(details, &fields); err != nil || fields == nil {
+ return details
+ }
+ }
+ fields[key] = value
+ out, err := json.Marshal(fields)
+ if err != nil {
+ return details
+ }
+ return out
+}
diff --git a/server/cmd/server/router.go b/server/cmd/server/router.go
index c6b6532bde..80ce93a79f 100644
--- a/server/cmd/server/router.go
+++ b/server/cmd/server/router.go
@@ -2662,6 +2662,8 @@ func NewRouterWithOptions(pool *pgxpool.Pool, hub *realtime.Hub, bus *events.Bus
r.Post("/archive-all", h.ArchiveAllInbox)
r.Post("/archive-all-read", h.ArchiveAllReadInbox)
r.Post("/archive-completed", h.ArchiveCompletedInbox)
+ // The caller's snoozed issues, for the Snoozed view (MUL-9333).
+ r.Get("/snoozed", h.ListSnoozedInbox)
// Every unread notification on one issue, for reading the issue
// outside the inbox (MUL-8588).
r.Post("/issues/{issueId}/read", h.MarkIssueInboxRead)
@@ -2669,6 +2671,8 @@ func NewRouterWithOptions(pool *pgxpool.Pool, hub *realtime.Hub, bus *events.Bus
r.Post("/{id}/unread", h.MarkInboxUnread)
r.Post("/{id}/archive", h.ArchiveInboxItem)
r.Post("/{id}/unarchive", h.UnarchiveInboxItem)
+ r.Post("/{id}/snooze", h.SnoozeInboxItem)
+ r.Post("/{id}/unsnooze", h.UnsnoozeInboxItem)
r.Delete("/{id}", h.DeleteInboxItem)
})
diff --git a/server/internal/connectedapps/requests.go b/server/internal/connectedapps/requests.go
index 63f81d4115..982111b0ea 100644
--- a/server/internal/connectedapps/requests.go
+++ b/server/internal/connectedapps/requests.go
@@ -482,7 +482,7 @@ func (s *Service) notify(ctx context.Context, req db.AppActionRequest, notifType
return
}
s.bus.Publish(events.Event{
- Type: "inbox:new", WorkspaceID: util.UUIDToString(item.WorkspaceID), ActorType: "agent", ActorID: util.UUIDToString(req.AgentID),
+ Type: inbox.NewItemEventType(item), WorkspaceID: util.UUIDToString(item.WorkspaceID), ActorType: "agent", ActorID: util.UUIDToString(req.AgentID),
Payload: map[string]any{"item": map[string]any{
"id": util.UUIDToString(item.ID), "workspace_id": util.UUIDToString(item.WorkspaceID),
"recipient_type": item.RecipientType, "recipient_id": util.UUIDToString(item.RecipientID),
diff --git a/server/internal/handler/inbox.go b/server/internal/handler/inbox.go
index 9ad39f3557..98d2e30357 100644
--- a/server/internal/handler/inbox.go
+++ b/server/internal/handler/inbox.go
@@ -39,6 +39,12 @@ type InboxItemResponse struct {
ActorType *string `json:"actor_type"`
ActorID *string `json:"actor_id"`
Details json.RawMessage `json:"details"`
+ // When the issue comes back from a snooze (MUL-9333). In the list it is
+ // always past: the issue came back on its own at that time.
+ SnoozedUntil *string `json:"snoozed_until,omitempty"`
+ // When that snooze began; the issue's rows written after it arrived
+ // while it was away.
+ SnoozedAt *string `json:"snoozed_at,omitempty"`
}
func inboxToResponse(i db.InboxItem) InboxItemResponse {
@@ -58,6 +64,8 @@ func inboxToResponse(i db.InboxItem) InboxItemResponse {
ActorType: textToPtr(i.ActorType),
ActorID: uuidToPtr(i.ActorID),
Details: json.RawMessage(i.Details),
+ SnoozedUntil: timestampToPtr(i.SnoozedUntil),
+ SnoozedAt: timestampToPtr(i.SnoozedAt),
}
}
@@ -141,6 +149,8 @@ func inboxRowToResponse(r db.ListInboxItemsRow) InboxItemResponse {
ActorType: textToPtr(r.ActorType),
ActorID: uuidToPtr(r.ActorID),
Details: json.RawMessage(r.Details),
+ SnoozedUntil: timestampToPtr(r.SnoozedUntil),
+ SnoozedAt: timestampToPtr(r.SnoozedAt),
}
}
diff --git a/server/internal/handler/inbox_snooze.go b/server/internal/handler/inbox_snooze.go
new file mode 100644
index 0000000000..0a13905b52
--- /dev/null
+++ b/server/internal/handler/inbox_snooze.go
@@ -0,0 +1,192 @@
+package handler
+
+import (
+ "encoding/json"
+ "net/http"
+ "time"
+
+ "github.com/go-chi/chi/v5"
+ "github.com/jackc/pgx/v5/pgtype"
+ "github.com/multica-ai/multica/server/internal/inbox"
+ db "github.com/multica-ai/multica/server/pkg/db/generated"
+ "github.com/multica-ai/multica/server/pkg/protocol"
+)
+
+// SnoozedInboxResponse is one snoozed issue in the caller's inbox.
+type SnoozedInboxResponse struct {
+ IssueID string `json:"issue_id"`
+ ItemID string `json:"item_id"`
+ SnoozedUntil string `json:"snoozed_until"`
+ SnoozedAt string `json:"snoozed_at"`
+ // Rows that arrived on the issue while it was snoozed.
+ Updates int64 `json:"updates"`
+}
+
+// ListSnoozedInbox returns the caller's snoozed issues, soonest back first,
+// for the Snoozed view (MUL-9333). An issue whose time has passed is back in
+// the main list and no longer here.
+func (h *Handler) ListSnoozedInbox(w http.ResponseWriter, r *http.Request) {
+ userID, ok := requireUserID(w, r)
+ if !ok {
+ return
+ }
+ workspaceID := ctxWorkspaceID(r.Context())
+ wsUUID, ok := parseUUIDOrBadRequest(w, workspaceID, "workspace id")
+ if !ok {
+ return
+ }
+ hidden, ok := h.requestHiddenProjects(w, r, workspaceID)
+ if !ok {
+ return
+ }
+ rows, err := h.Queries.ListSnoozedInbox(r.Context(), db.ListSnoozedInboxParams{
+ WorkspaceID: wsUUID,
+ RecipientID: parseUUID(userID),
+ HiddenProjectIds: hidden.Param(),
+ })
+ if err != nil {
+ writeError(w, http.StatusInternalServerError, "failed to list snoozed inbox")
+ return
+ }
+ resp := make([]SnoozedInboxResponse, len(rows))
+ for i, row := range rows {
+ resp[i] = SnoozedInboxResponse{
+ IssueID: uuidToString(row.IssueID),
+ ItemID: uuidToString(row.ItemID),
+ SnoozedUntil: timestampToString(row.SnoozedUntil),
+ SnoozedAt: timestampToString(row.SnoozedAt),
+ Updates: row.Updates,
+ }
+ }
+ writeJSON(w, http.StatusOK, resp)
+}
+
+type snoozeInboxRequest struct {
+ Until string `json:"until"`
+}
+
+// SnoozeInboxItem takes the item's issue out of the caller's inbox until a
+// time (MUL-9333). Issue-level, like archive: every active row on the issue
+// is snoozed, and rows written later join the snooze unless they need the
+// caller (inbox.WakesSnooze). Snoozing a snoozed issue changes its time.
+func (h *Handler) SnoozeInboxItem(w http.ResponseWriter, r *http.Request) {
+ prev, ok := h.loadInboxItemForUser(w, r, chi.URLParam(r, "id"))
+ if !ok {
+ return
+ }
+ if !prev.IssueID.Valid {
+ writeError(w, http.StatusBadRequest, "only notifications on an issue can be snoozed")
+ return
+ }
+ if prev.Archived {
+ writeError(w, http.StatusBadRequest, "an archived notification cannot be snoozed")
+ return
+ }
+ var req snoozeInboxRequest
+ if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
+ writeError(w, http.StatusBadRequest, "invalid request body")
+ return
+ }
+ until, err := time.Parse(time.RFC3339, req.Until)
+ if err != nil {
+ writeError(w, http.StatusBadRequest, "until must be an RFC 3339 time")
+ return
+ }
+ now := time.Now()
+ if !until.After(now) {
+ writeError(w, http.StatusBadRequest, "until must be in the future")
+ return
+ }
+ if until.After(now.Add(inbox.MaxSnooze)) {
+ writeError(w, http.StatusBadRequest, "until must be within a year")
+ return
+ }
+
+ rows, err := h.Queries.SnoozeInboxGroup(r.Context(), db.SnoozeInboxGroupParams{
+ ID: prev.ID,
+ SnoozedUntil: pgtype.Timestamptz{Time: until, Valid: true},
+ })
+ if err != nil {
+ writeError(w, http.StatusInternalServerError, "failed to snooze")
+ return
+ }
+
+ h.publish(protocol.EventInboxSnoozed, uuidToString(prev.WorkspaceID), "member", requestUserID(r), map[string]any{
+ "item_id": uuidToString(prev.ID),
+ "issue_id": uuidToPtr(prev.IssueID),
+ "recipient_id": uuidToString(prev.RecipientID),
+ "snoozed_until": until.UTC().Format(time.RFC3339),
+ })
+ h.publishInboxRefresh(r, prev)
+ writeJSON(w, http.StatusOK, map[string]any{
+ "issue_id": uuidToString(prev.IssueID),
+ "snoozed_until": until.UTC().Format(time.RFC3339),
+ "count": len(rows),
+ })
+}
+
+type unsnoozeInboxRequest struct {
+ // Read restores the issue as read. Undoing a snooze puts back the read
+ // state it had; ending one brings it back unread.
+ Read bool `json:"read"`
+}
+
+// UnsnoozeInboxItem ends the snooze on the item's issue: it is back in the
+// inbox now.
+func (h *Handler) UnsnoozeInboxItem(w http.ResponseWriter, r *http.Request) {
+ prev, ok := h.loadInboxItemForUser(w, r, chi.URLParam(r, "id"))
+ if !ok {
+ return
+ }
+ if !prev.IssueID.Valid {
+ writeError(w, http.StatusBadRequest, "only notifications on an issue can be snoozed")
+ return
+ }
+ var req unsnoozeInboxRequest
+ if r.ContentLength != 0 {
+ if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
+ writeError(w, http.StatusBadRequest, "invalid request body")
+ return
+ }
+ }
+
+ rows, err := h.Queries.UnsnoozeInboxGroup(r.Context(), db.UnsnoozeInboxGroupParams{
+ WorkspaceID: prev.WorkspaceID,
+ RecipientType: prev.RecipientType,
+ RecipientID: prev.RecipientID,
+ IssueID: prev.IssueID,
+ })
+ if err != nil {
+ writeError(w, http.StatusInternalServerError, "failed to unsnooze")
+ return
+ }
+ if req.Read {
+ if _, err := h.Queries.MarkInboxRead(r.Context(), prev.ID); err != nil {
+ writeError(w, http.StatusInternalServerError, "failed to mark read")
+ return
+ }
+ }
+
+ h.publish(protocol.EventInboxUnsnoozed, uuidToString(prev.WorkspaceID), "member", requestUserID(r), map[string]any{
+ "item_id": uuidToString(prev.ID),
+ "issue_id": uuidToPtr(prev.IssueID),
+ "recipient_id": uuidToString(prev.RecipientID),
+ })
+ h.publishInboxRefresh(r, prev)
+ writeJSON(w, http.StatusOK, map[string]any{
+ "issue_id": uuidToString(prev.IssueID),
+ "count": len(rows),
+ })
+}
+
+// publishInboxRefresh repeats a snooze or unsnooze as a batch read of no rows.
+// Mobile builds from before snooze refetch the inbox only on the event names
+// they subscribe to, and this is the one every client takes as "refetch the
+// inbox and badge" with no other effect. Rows written into a snooze don't send
+// it: they stay out of the list and must not reach anyone as new.
+func (h *Handler) publishInboxRefresh(r *http.Request, prev db.InboxItem) {
+ h.publish(protocol.EventInboxBatchRead, uuidToString(prev.WorkspaceID), "member", requestUserID(r), map[string]any{
+ "recipient_id": uuidToString(prev.RecipientID),
+ "count": 0,
+ })
+}
diff --git a/server/internal/handler/inbox_snooze_test.go b/server/internal/handler/inbox_snooze_test.go
new file mode 100644
index 0000000000..4d47929a63
--- /dev/null
+++ b/server/internal/handler/inbox_snooze_test.go
@@ -0,0 +1,353 @@
+package handler
+
+import (
+ "context"
+ "net/http"
+ "slices"
+ "sync"
+ "testing"
+ "time"
+
+ "github.com/google/uuid"
+ "github.com/multica-ai/multica/server/internal/events"
+ "github.com/multica-ai/multica/server/internal/inbox"
+ "github.com/multica-ai/multica/server/internal/testutil"
+ db "github.com/multica-ai/multica/server/pkg/db/generated"
+ "github.com/multica-ai/multica/server/pkg/protocol"
+)
+
+type snoozeFixture struct {
+ workspaceID string
+ issueID string
+ otherIssue string
+}
+
+func newSnoozeFixture(t *testing.T) snoozeFixture {
+ t.Helper()
+ workspaceID := dbfx.Workspace(t, "Inbox snooze", "inbox-snooze-"+uuid.NewString())
+ dbfx.Member(t, workspaceID, testUserID, "owner")
+ dbfx.Cleanup(t, `DELETE FROM inbox_item WHERE workspace_id = $1`, workspaceID)
+ return snoozeFixture{
+ workspaceID: workspaceID,
+ issueID: dbfx.Issue(t, "Snoozed issue", testutil.Cols{"workspace_id": workspaceID}),
+ otherIssue: dbfx.Issue(t, "Other issue", testutil.Cols{"workspace_id": workspaceID}),
+ }
+}
+
+func (f snoozeFixture) insert(t *testing.T, issueID, title string, read bool, createdAt time.Time) string {
+ t.Helper()
+ return dbfx.Insert(t, "inbox_item", testutil.Cols{
+ "workspace_id": f.workspaceID,
+ "recipient_type": "member",
+ "recipient_id": testUserID,
+ "type": "new_comment",
+ "severity": "info",
+ "issue_id": issueID,
+ "title": title,
+ "read": read,
+ "created_at": createdAt,
+ })
+}
+
+func (f snoozeFixture) snooze(t *testing.T, itemID string, until time.Time) *testutil.Response {
+ t.Helper()
+ req := testutil.WithHeaders(
+ testutil.JSONRequest(http.MethodPost, "/api/inbox/"+itemID+"/snooze", map[string]any{"until": until.UTC().Format(time.RFC3339)}),
+ "X-User-ID", testUserID,
+ "X-Workspace-ID", f.workspaceID,
+ )
+ return testutil.Call(t, inboxWorkspaceHandler(testHandler.SnoozeInboxItem), withURLParam(req, "id", itemID))
+}
+
+func (f snoozeFixture) list(t *testing.T) []InboxItemResponse {
+ t.Helper()
+ var items []InboxItemResponse
+ testutil.Call(t, inboxWorkspaceHandler(testHandler.ListInbox), inboxRequest(http.MethodGet, "/api/inbox", f.workspaceID)).
+ Want(http.StatusOK).JSON(&items)
+ return items
+}
+
+func (f snoozeFixture) snoozed(t *testing.T) []SnoozedInboxResponse {
+ t.Helper()
+ var rows []SnoozedInboxResponse
+ testutil.Call(t, inboxWorkspaceHandler(testHandler.ListSnoozedInbox), inboxRequest(http.MethodGet, "/api/inbox/snoozed", f.workspaceID)).
+ Want(http.StatusOK).JSON(&rows)
+ return rows
+}
+
+func (f snoozeFixture) unreadCount(t *testing.T) int64 {
+ t.Helper()
+ var resp struct {
+ Count int64 `json:"count"`
+ }
+ testutil.Call(t, inboxWorkspaceHandler(testHandler.CountUnreadInbox), inboxRequest(http.MethodGet, "/api/inbox/unread-count", f.workspaceID)).
+ Want(http.StatusOK).JSON(&resp)
+ return resp.Count
+}
+
+func inboxIssueIDs(items []InboxItemResponse) map[string]int {
+ ids := map[string]int{}
+ for _, item := range items {
+ if item.IssueID != nil {
+ ids[*item.IssueID]++
+ }
+ }
+ return ids
+}
+
+func TestSnoozeInboxTakesTheWholeIssueOutUntilItsTime(t *testing.T) {
+ f := newSnoozeFixture(t)
+ now := time.Now()
+ f.insert(t, f.issueID, "older", false, now.Add(-2*time.Hour))
+ newest := f.insert(t, f.issueID, "newest", true, now.Add(-time.Hour))
+ f.insert(t, f.otherIssue, "other", false, now.Add(-time.Hour))
+
+ until := now.Add(48 * time.Hour).Truncate(time.Second)
+ f.snooze(t, newest, until).Want(http.StatusOK)
+
+ if ids := inboxIssueIDs(f.list(t)); ids[f.issueID] != 0 || ids[f.otherIssue] != 1 {
+ t.Fatalf("listed issues = %v, want only the other issue", ids)
+ }
+ if got := f.unreadCount(t); got != 1 {
+ t.Fatalf("unread count = %d, want 1 (the snoozed issue does not count)", got)
+ }
+ rows := f.snoozed(t)
+ if len(rows) != 1 || rows[0].IssueID != f.issueID || rows[0].ItemID != newest || rows[0].Updates != 0 {
+ t.Fatalf("snoozed = %+v, want the issue with its newest row and no updates", rows)
+ }
+ if got, err := time.Parse(time.RFC3339, rows[0].SnoozedUntil); err != nil || !got.Equal(until) {
+ t.Fatalf("snoozed_until = %q, want %s", rows[0].SnoozedUntil, until)
+ }
+ if got := dbfx.Count(t, "SELECT count(*) FROM inbox_item WHERE id = $1 AND read = false", newest); got != 1 {
+ t.Fatal("the newest row stayed read; a snoozed issue comes back unread")
+ }
+
+ // Its time passes: back in the list, carrying when it came back.
+ dbfx.Exec(t, `UPDATE inbox_item SET snoozed_until = now() - interval '1 minute' WHERE issue_id = $1`, f.issueID)
+ items := f.list(t)
+ if ids := inboxIssueIDs(items); ids[f.issueID] != 2 {
+ t.Fatalf("listed issues after the snooze ran out = %v, want both rows of the issue", ids)
+ }
+ for _, item := range items {
+ if item.IssueID != nil && *item.IssueID == f.issueID && item.SnoozedUntil == nil {
+ t.Fatal("a row back from a snooze lost snoozed_until")
+ }
+ }
+ if got := len(f.snoozed(t)); got != 0 {
+ t.Fatalf("snoozed after the time passed = %d, want 0", got)
+ }
+}
+
+func TestSnoozeInboxRejectsTimesOutsideTheWindow(t *testing.T) {
+ f := newSnoozeFixture(t)
+ item := f.insert(t, f.issueID, "row", false, time.Now())
+ f.snooze(t, item, time.Now().Add(-time.Minute)).Want(http.StatusBadRequest)
+ f.snooze(t, item, time.Now().Add(inbox.MaxSnooze+time.Hour)).Want(http.StatusBadRequest)
+ if got := dbfx.Count(t, "SELECT count(*) FROM inbox_item WHERE id = $1 AND snoozed_until IS NOT NULL", item); got != 0 {
+ t.Fatal("a rejected snooze was written")
+ }
+}
+
+func TestUnsnoozeInboxBringsTheIssueBack(t *testing.T) {
+ f := newSnoozeFixture(t)
+ item := f.insert(t, f.issueID, "row", true, time.Now())
+ f.snooze(t, item, time.Now().Add(time.Hour)).Want(http.StatusOK)
+
+ req := testutil.WithHeaders(
+ testutil.JSONRequest(http.MethodPost, "/api/inbox/"+item+"/unsnooze", map[string]any{"read": true}),
+ "X-User-ID", testUserID,
+ "X-Workspace-ID", f.workspaceID,
+ )
+ testutil.Call(t, inboxWorkspaceHandler(testHandler.UnsnoozeInboxItem), withURLParam(req, "id", item)).Want(http.StatusOK)
+
+ if ids := inboxIssueIDs(f.list(t)); ids[f.issueID] != 1 {
+ t.Fatalf("listed issues = %v, want the issue back", ids)
+ }
+ if got := dbfx.Count(t, "SELECT count(*) FROM inbox_item WHERE id = $1 AND read = true AND snoozed_until IS NULL AND snoozed_at IS NULL", item); got != 1 {
+ t.Fatal("undo did not restore the row as read and unsnoozed")
+ }
+}
+
+func TestInboxRowsWrittenIntoASnoozeJoinItUnlessTheyWakeIt(t *testing.T) {
+ f := newSnoozeFixture(t)
+ item := f.insert(t, f.issueID, "row", false, time.Now().Add(-time.Hour))
+ f.snooze(t, item, time.Now().Add(24*time.Hour)).Want(http.StatusOK)
+
+ create := func(notifType string, details string) db.InboxItem {
+ t.Helper()
+ row, inserted, err := inbox.CreateIfEligible(context.Background(), testHandler.Queries, db.CreateInboxItemParams{
+ WorkspaceID: parseUUID(f.workspaceID),
+ RecipientType: "member",
+ RecipientID: parseUUID(testUserID),
+ Type: notifType,
+ Severity: "info",
+ IssueID: parseUUID(f.issueID),
+ Title: "Snoozed issue",
+ Details: []byte(details),
+ })
+ if err != nil || !inserted {
+ t.Fatalf("create %s: inserted=%v err=%v", notifType, inserted, err)
+ }
+ return row
+ }
+
+ for _, quiet := range []struct{ notifType, details string }{
+ {"new_comment", `{}`},
+ {"status_changed", `{}`},
+ {"mentioned", `{"mention_via":"all"}`},
+ {"mentioned", `{"mention_via":"squad"}`},
+ } {
+ row := create(quiet.notifType, quiet.details)
+ if !inbox.IsSnoozed(row, time.Now()) {
+ t.Fatalf("%s %s woke the snooze", quiet.notifType, quiet.details)
+ }
+ }
+ rows := f.snoozed(t)
+ if len(rows) != 1 || rows[0].Updates != 4 {
+ t.Fatalf("snoozed = %+v, want one issue with 4 updates", rows)
+ }
+ if ids := inboxIssueIDs(f.list(t)); ids[f.issueID] != 0 {
+ t.Fatalf("listed issues = %v, want the snoozed issue still out", ids)
+ }
+
+ woke := create("mentioned", `{"mention_via":"member"}`)
+ if woke.SnoozedUntil.Valid {
+ t.Fatal("a mention by name did not wake the snooze")
+ }
+ if got := len(f.snoozed(t)); got != 0 {
+ t.Fatalf("snoozed after the wake = %d, want 0", got)
+ }
+ if ids := inboxIssueIDs(f.list(t)); ids[f.issueID] != 6 {
+ t.Fatalf("listed issues = %v, want all six rows back", ids)
+ }
+
+ // Without a snooze a new row is written as before.
+ if row := create("new_comment", `{}`); row.SnoozedUntil.Valid {
+ t.Fatal("a row on an issue that is not snoozed was written snoozed")
+ }
+}
+
+func TestInboxBatchActionsSkipSnoozedIssues(t *testing.T) {
+ f := newSnoozeFixture(t)
+ snoozedItem := f.insert(t, f.issueID, "snoozed", false, time.Now())
+ f.insert(t, f.otherIssue, "listed", false, time.Now())
+ f.snooze(t, snoozedItem, time.Now().Add(time.Hour)).Want(http.StatusOK)
+
+ testutil.Call(t, inboxWorkspaceHandler(testHandler.MarkAllInboxRead), inboxRequest(http.MethodPost, "/api/inbox/mark-all-read", f.workspaceID)).Want(http.StatusOK)
+ if got := dbfx.Count(t, "SELECT count(*) FROM inbox_item WHERE id = $1 AND read = false", snoozedItem); got != 1 {
+ t.Fatal("mark all read read a snoozed issue")
+ }
+ testutil.Call(t, inboxWorkspaceHandler(testHandler.ArchiveAllInbox), inboxRequest(http.MethodPost, "/api/inbox/archive-all", f.workspaceID)).Want(http.StatusOK)
+ if got := dbfx.Count(t, "SELECT count(*) FROM inbox_item WHERE id = $1 AND archived = false", snoozedItem); got != 1 {
+ t.Fatal("archive all archived a snoozed issue")
+ }
+ if got := dbfx.Count(t, "SELECT count(*) FROM inbox_item WHERE issue_id = $1 AND archived = false", f.otherIssue); got != 0 {
+ t.Fatal("archive all left the listed issue")
+ }
+
+ // Viewing the snoozed issue elsewhere leaves it unread.
+ testutil.Call(t, inboxWorkspaceHandler(testHandler.MarkIssueInboxRead),
+ withURLParam(inboxRequest(http.MethodPost, "/api/inbox/issues/"+f.issueID+"/read", f.workspaceID), "issueId", f.issueID)).
+ Want(http.StatusOK)
+ if got := dbfx.Count(t, "SELECT count(*) FROM inbox_item WHERE id = $1 AND read = false", snoozedItem); got != 1 {
+ t.Fatal("viewing a snoozed issue read it")
+ }
+
+ // Archiving it ends the snooze, so a restore does not bring it back hidden.
+ testutil.Call(t, inboxWorkspaceHandler(testHandler.ArchiveInboxItem),
+ withURLParam(inboxRequest(http.MethodPost, "/api/inbox/"+snoozedItem+"/archive", f.workspaceID), "id", snoozedItem)).
+ Want(http.StatusOK)
+ if got := dbfx.Count(t, "SELECT count(*) FROM inbox_item WHERE id = $1 AND archived = true AND snoozed_until IS NULL", snoozedItem); got != 1 {
+ t.Fatal("archiving kept the snooze")
+ }
+}
+
+// subscribeInboxEvents records the inbox events published for one workspace.
+// Bus handlers are never unsubscribed in this suite, and Publish is
+// synchronous, so the slice is complete once a request returns.
+func subscribeInboxEvents(workspaceID string) *[]string {
+ var seen []string
+ var mu sync.Mutex
+ for _, eventType := range []string{
+ protocol.EventInboxNew, protocol.EventInboxSnoozed, protocol.EventInboxUnsnoozed, protocol.EventInboxBatchRead,
+ } {
+ testHandler.Bus.Subscribe(eventType, func(e events.Event) {
+ if e.WorkspaceID != workspaceID {
+ return
+ }
+ mu.Lock()
+ defer mu.Unlock()
+ seen = append(seen, e.Type)
+ })
+ }
+ return &seen
+}
+
+func TestSnoozeInboxRefreshesClientsThatPredateIt(t *testing.T) {
+ f := newSnoozeFixture(t)
+ item := f.insert(t, f.issueID, "row", false, time.Now())
+ seen := subscribeInboxEvents(f.workspaceID)
+
+ f.snooze(t, item, time.Now().Add(time.Hour)).Want(http.StatusOK)
+ want := []string{protocol.EventInboxSnoozed, protocol.EventInboxBatchRead}
+ if !slices.Equal(*seen, want) {
+ t.Fatalf("snooze published %v, want %v", *seen, want)
+ }
+
+ // A row written into the snooze is announced as snoozed only: never as new,
+ // and without the refresh, since the list does not change.
+ *seen = nil
+ row, inserted, err := inbox.CreateIfEligible(context.Background(), testHandler.Queries, db.CreateInboxItemParams{
+ WorkspaceID: parseUUID(f.workspaceID),
+ RecipientType: "member",
+ RecipientID: parseUUID(testUserID),
+ Type: "new_comment",
+ Severity: "info",
+ IssueID: parseUUID(f.issueID),
+ Title: "Snoozed issue",
+ Details: []byte(`{}`),
+ })
+ if err != nil || !inserted {
+ t.Fatalf("create: inserted=%v err=%v", inserted, err)
+ }
+ if got := inbox.NewItemEventType(row); got != protocol.EventInboxSnoozed {
+ t.Fatalf("a row written into a snooze is announced as %s, want %s", got, protocol.EventInboxSnoozed)
+ }
+
+ req := testutil.WithHeaders(
+ testutil.JSONRequest(http.MethodPost, "/api/inbox/"+item+"/unsnooze", map[string]any{}),
+ "X-User-ID", testUserID,
+ "X-Workspace-ID", f.workspaceID,
+ )
+ testutil.Call(t, inboxWorkspaceHandler(testHandler.UnsnoozeInboxItem), withURLParam(req, "id", item)).Want(http.StatusOK)
+ want = []string{protocol.EventInboxUnsnoozed, protocol.EventInboxBatchRead}
+ if !slices.Equal(*seen, want) {
+ t.Fatalf("unsnooze published %v, want %v", *seen, want)
+ }
+}
+
+func TestWakesSnooze(t *testing.T) {
+ cases := []struct {
+ notifType string
+ details string
+ want bool
+ }{
+ {"issue_assigned", ``, true},
+ {"task_failed", `{}`, true},
+ {"children_done", `{}`, true},
+ {"app_action_requested", `{}`, true},
+ {"app_action_reminder", `{}`, true},
+ {"mentioned", `{"mention_via":"member"}`, true},
+ {"mentioned", `{}`, true},
+ {"mentioned", `{"mention_via":"all"}`, false},
+ {"mentioned", `{"mention_via":"squad"}`, false},
+ {"new_comment", `{}`, false},
+ {"status_changed", `{}`, false},
+ {"reaction_added", `{}`, false},
+ }
+ for _, c := range cases {
+ if got := inbox.WakesSnooze(c.notifType, []byte(c.details)); got != c.want {
+ t.Errorf("WakesSnooze(%s, %s) = %v, want %v", c.notifType, c.details, got, c.want)
+ }
+ }
+}
diff --git a/server/internal/inbox/create.go b/server/internal/inbox/create.go
index 1fb9d23369..3559677f0f 100644
--- a/server/internal/inbox/create.go
+++ b/server/internal/inbox/create.go
@@ -3,14 +3,21 @@ package inbox
import (
"context"
"errors"
+ "log/slog"
"github.com/jackc/pgx/v5"
+ "github.com/jackc/pgx/v5/pgtype"
db "github.com/multica-ai/multica/server/pkg/db/generated"
)
// CreateIfEligible returns inserted=false without an error when the recipient
// does not belong to the workspace. Other database errors remain failures.
// Eligibility is checked by the insert's snapshot, without additional locks.
+//
+// A row written on an issue the recipient has snoozed joins the snooze (see
+// CreateInboxItem). When the row is one that needs the recipient
+// (WakesSnooze), the snooze ends instead and the issue is back in the inbox
+// with this row on top. Announce the returned row with NewItemEventType.
func CreateIfEligible(ctx context.Context, queries *db.Queries, params db.CreateInboxItemParams) (item db.InboxItem, inserted bool, err error) {
item, err = queries.CreateInboxItem(ctx, params)
if errors.Is(err, pgx.ErrNoRows) {
@@ -19,5 +26,20 @@ func CreateIfEligible(ctx context.Context, queries *db.Queries, params db.Create
if err != nil {
return db.InboxItem{}, false, err
}
+ if item.SnoozedUntil.Valid && WakesSnooze(item.Type, item.Details) {
+ if _, err := queries.UnsnoozeInboxGroup(ctx, db.UnsnoozeInboxGroupParams{
+ WorkspaceID: item.WorkspaceID,
+ RecipientType: item.RecipientType,
+ RecipientID: item.RecipientID,
+ IssueID: item.IssueID,
+ }); err != nil {
+ // The row is written; it stays snoozed with the rest of the issue.
+ slog.Warn("inbox: failed to end snooze for a waking notification",
+ "type", item.Type, "error", err)
+ return item, true, nil
+ }
+ item.SnoozedUntil = pgtype.Timestamptz{}
+ item.SnoozedAt = pgtype.Timestamptz{}
+ }
return item, true, nil
}
diff --git a/server/internal/inbox/snooze.go b/server/internal/inbox/snooze.go
new file mode 100644
index 0000000000..f02794151b
--- /dev/null
+++ b/server/internal/inbox/snooze.go
@@ -0,0 +1,65 @@
+package inbox
+
+import (
+ "encoding/json"
+ "time"
+
+ db "github.com/multica-ai/multica/server/pkg/db/generated"
+ "github.com/multica-ai/multica/server/pkg/protocol"
+)
+
+// MaxSnooze is how far ahead an issue can be snoozed.
+const MaxSnooze = 366 * 24 * time.Hour
+
+// Values of details.mention_via on a "mentioned" row: how the mention reached
+// the recipient.
+const (
+ MentionViaMember = "member"
+ MentionViaSquad = "squad"
+ MentionViaAll = "all"
+)
+
+// wakingTypes are the notifications that end a snooze early: each one asks
+// something of the recipient, where the rest only report activity.
+var wakingTypes = map[string]bool{
+ "mentioned": true,
+ "issue_assigned": true,
+ "task_failed": true,
+ "app_action_requested": true,
+ "app_action_reminder": true,
+ "children_done": true,
+}
+
+// WakesSnooze reports whether a row of this type ends a snooze on its issue.
+// A mention wakes only when it names the recipient; one that reached them
+// through @all or a squad is counted like any other update.
+func WakesSnooze(notifType string, details []byte) bool {
+ if !wakingTypes[notifType] {
+ return false
+ }
+ if notifType != "mentioned" || len(details) == 0 {
+ return true
+ }
+ var d struct {
+ MentionVia string `json:"mention_via"`
+ }
+ if err := json.Unmarshal(details, &d); err != nil {
+ return true
+ }
+ return d.MentionVia != MentionViaAll && d.MentionVia != MentionViaSquad
+}
+
+// IsSnoozed reports whether the row is out of the inbox at now.
+func IsSnoozed(item db.InboxItem, now time.Time) bool {
+ return item.SnoozedUntil.Valid && item.SnoozedUntil.Time.After(now)
+}
+
+// NewItemEventType names the event that announces a row CreateIfEligible
+// wrote. A row that joined a snooze is announced as inbox:snoozed, so no
+// client raises a banner and no channel pushes it.
+func NewItemEventType(item db.InboxItem) string {
+ if IsSnoozed(item, time.Now()) {
+ return protocol.EventInboxSnoozed
+ }
+ return protocol.EventInboxNew
+}
diff --git a/server/internal/service/issue_wakeup_system.go b/server/internal/service/issue_wakeup_system.go
index 9e2bbe2e0d..00a3b9b2d5 100644
--- a/server/internal/service/issue_wakeup_system.go
+++ b/server/internal/service/issue_wakeup_system.go
@@ -711,7 +711,7 @@ func (s *IssueWakeupService) publishSystemInbox(item db.InboxItem, issueStatus s
return
}
s.Tasks.Bus.Publish(events.Event{
- Type: protocol.EventInboxNew, WorkspaceID: util.UUIDToString(item.WorkspaceID), ActorType: "system",
+ Type: inboxwriter.NewItemEventType(item), WorkspaceID: util.UUIDToString(item.WorkspaceID), ActorType: "system",
Payload: map[string]any{"item": map[string]any{
"id": util.UUIDToString(item.ID), "workspace_id": util.UUIDToString(item.WorkspaceID),
"recipient_type": item.RecipientType, "recipient_id": util.UUIDToString(item.RecipientID),
diff --git a/server/internal/service/task.go b/server/internal/service/task.go
index da69676401..b0015f318d 100644
--- a/server/internal/service/task.go
+++ b/server/internal/service/task.go
@@ -6892,7 +6892,7 @@ func (s *TaskService) exhaustDelegatedFailureRecovery(ctx context.Context, targe
}
if inboxCreated && s.Bus != nil {
s.Bus.Publish(events.Event{
- Type: protocol.EventInboxNew,
+ Type: inbox.NewItemEventType(exhaustedInbox),
WorkspaceID: util.UUIDToString(target.issue.WorkspaceID),
ActorType: "system",
ActorID: "",
@@ -8473,7 +8473,7 @@ func (s *TaskService) publishQuickCreateInbox(item db.InboxItem, workspaceID, ag
"issue_status": issueStatus,
}
s.Bus.Publish(events.Event{
- Type: protocol.EventInboxNew,
+ Type: inbox.NewItemEventType(item),
WorkspaceID: workspaceID,
ActorType: "agent",
ActorID: agentID,
diff --git a/server/migrations/660_inbox_item_snoozed_at.down.sql b/server/migrations/660_inbox_item_snoozed_at.down.sql
new file mode 100644
index 0000000000..e03d86706c
--- /dev/null
+++ b/server/migrations/660_inbox_item_snoozed_at.down.sql
@@ -0,0 +1 @@
+ALTER TABLE inbox_item DROP COLUMN IF EXISTS snoozed_at;
diff --git a/server/migrations/660_inbox_item_snoozed_at.up.sql b/server/migrations/660_inbox_item_snoozed_at.up.sql
new file mode 100644
index 0000000000..3c1837a8a8
--- /dev/null
+++ b/server/migrations/660_inbox_item_snoozed_at.up.sql
@@ -0,0 +1,5 @@
+-- MUL-9333: when the snooze on an issue started. The Snoozed view counts the
+-- rows that arrived after it ("2 updates while snoozed"). Set together with
+-- snoozed_until and cleared with it. Nullable with no default, so the ALTER is
+-- a catalog-only change with no table scan and no backfill.
+ALTER TABLE inbox_item ADD COLUMN IF NOT EXISTS snoozed_at TIMESTAMPTZ;
diff --git a/server/pkg/db/generated/inbox.sql.go b/server/pkg/db/generated/inbox.sql.go
index e8774ad2eb..494ff84319 100644
--- a/server/pkg/db/generated/inbox.sql.go
+++ b/server/pkg/db/generated/inbox.sql.go
@@ -14,6 +14,7 @@ import (
const archiveAllInbox = `-- name: ArchiveAllInbox :execrows
UPDATE inbox_item SET archived = true
WHERE workspace_id = $1 AND recipient_type = 'member' AND recipient_id = $2 AND archived = false
+ AND (snoozed_until IS NULL OR snoozed_until <= now())
`
type ArchiveAllInboxParams struct {
@@ -39,6 +40,7 @@ WITH newest_groups AS (
AND i.recipient_type = 'member'
AND i.recipient_id = $2
AND i.archived = false
+ AND (i.snoozed_until IS NULL OR i.snoozed_until <= now())
ORDER BY COALESCE(i.issue_id, i.id), i.created_at DESC, i.id DESC
), read_groups AS (
SELECT group_id
@@ -73,7 +75,7 @@ func (q *Queries) ArchiveAllReadInbox(ctx context.Context, arg ArchiveAllReadInb
}
const archiveCompletedInbox = `-- name: ArchiveCompletedInbox :execrows
-UPDATE inbox_item i SET archived = true
+UPDATE inbox_item i SET archived = true, snoozed_until = NULL, snoozed_at = NULL
WHERE i.workspace_id = $1 AND i.recipient_type = 'member' AND i.recipient_id = $2 AND i.archived = false
AND i.issue_id IN (
SELECT id FROM issue
@@ -88,6 +90,7 @@ type ArchiveCompletedInboxParams struct {
TerminalStatusKeys []string `json:"terminal_status_keys"`
}
+// Snoozed issues included: a done issue leaves the inbox either way.
func (q *Queries) ArchiveCompletedInbox(ctx context.Context, arg ArchiveCompletedInboxParams) (int64, error) {
result, err := q.db.Exec(ctx, archiveCompletedInbox, arg.WorkspaceID, arg.RecipientID, arg.TerminalStatusKeys)
if err != nil {
@@ -97,7 +100,7 @@ func (q *Queries) ArchiveCompletedInbox(ctx context.Context, arg ArchiveComplete
}
const archiveInboxByIssue = `-- name: ArchiveInboxByIssue :execrows
-UPDATE inbox_item SET archived = true
+UPDATE inbox_item SET archived = true, snoozed_until = NULL, snoozed_at = NULL
WHERE workspace_id = $1 AND recipient_type = $2 AND recipient_id = $3 AND issue_id = $4 AND archived = false
`
@@ -122,7 +125,7 @@ func (q *Queries) ArchiveInboxByIssue(ctx context.Context, arg ArchiveInboxByIss
}
const archiveInboxByIssueAndType = `-- name: ArchiveInboxByIssueAndType :many
-UPDATE inbox_item SET archived = true
+UPDATE inbox_item SET archived = true, snoozed_until = NULL, snoozed_at = NULL
WHERE workspace_id = $1 AND issue_id = $2 AND type = $3 AND archived = false
RETURNING recipient_type, recipient_id
`
@@ -159,11 +162,13 @@ func (q *Queries) ArchiveInboxByIssueAndType(ctx context.Context, arg ArchiveInb
}
const archiveInboxItem = `-- name: ArchiveInboxItem :one
-UPDATE inbox_item SET archived = true
+UPDATE inbox_item SET archived = true, snoozed_until = NULL, snoozed_at = NULL
WHERE id = $1
-RETURNING id, workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, body, read, archived, created_at, actor_type, actor_id, details, section, snoozed_until
+RETURNING id, workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, body, read, archived, created_at, actor_type, actor_id, details, section, snoozed_until, snoozed_at
`
+// Archiving ends a snooze (MUL-9333), on every archive path below: a row
+// restored later must not come back still hidden.
func (q *Queries) ArchiveInboxItem(ctx context.Context, id pgtype.UUID) (InboxItem, error) {
row := q.db.QueryRow(ctx, archiveInboxItem, id)
var i InboxItem
@@ -185,6 +190,7 @@ func (q *Queries) ArchiveInboxItem(ctx context.Context, id pgtype.UUID) (InboxIt
&i.Details,
&i.Section,
&i.SnoozedUntil,
+ &i.SnoozedAt,
)
return i, err
}
@@ -196,6 +202,7 @@ WHERE i.workspace_id = $1
AND i.recipient_id = $3
AND i.read = false
AND i.archived = false
+ AND (i.snoozed_until IS NULL OR i.snoozed_until <= now())
-- MUL-8472: private projects the caller cannot see.
AND ($4::uuid[] IS NULL OR i.issue_id IS NULL OR NOT EXISTS (
SELECT 1 FROM issue hidden_issue
@@ -233,6 +240,8 @@ FROM (
WHERE i.recipient_type = 'member'
AND i.recipient_id = $1
AND i.archived = false
+ -- MUL-9333: a snoozed issue does not count until it comes back.
+ AND (i.snoozed_until IS NULL OR i.snoozed_until <= now())
-- MUL-8472: issues in private projects the recipient is not a member
-- of do not count.
AND NOT EXISTS (
@@ -291,9 +300,20 @@ const createInboxItem = `-- name: CreateInboxItem :one
INSERT INTO inbox_item (
workspace_id, recipient_type, recipient_id,
type, severity, issue_id, title, body,
- actor_type, actor_id, details, id
+ actor_type, actor_id, details, id,
+ snoozed_until, snoozed_at
)
-SELECT $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, COALESCE($12::uuid, gen_random_uuid())
+SELECT $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, COALESCE($12::uuid, gen_random_uuid()),
+ snoozed.snoozed_until, snoozed.snoozed_at
+FROM (SELECT 1) AS one
+LEFT JOIN LATERAL (
+ SELECT s.snoozed_until, s.snoozed_at
+ FROM inbox_item s
+ WHERE s.workspace_id = $1 AND s.recipient_type = $2 AND s.recipient_id = $3
+ AND s.issue_id = $6 AND s.archived = false AND s.snoozed_until > now()
+ ORDER BY s.snoozed_until DESC
+ LIMIT 1
+) AS snoozed ON true
WHERE (($2::text = 'member' AND EXISTS (
SELECT 1 FROM member WHERE workspace_id = $1 AND user_id = $3
)) OR ($2::text = 'agent' AND EXISTS (
@@ -309,7 +329,7 @@ AND NOT ($2::text = 'member' AND EXISTS (
WHERE pm.project_id = private_project.id AND pm.user_id = $3
)
))
-RETURNING id, workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, body, read, archived, created_at, actor_type, actor_id, details, section, snoozed_until
+RETURNING id, workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, body, read, archived, created_at, actor_type, actor_id, details, section, snoozed_until, snoozed_at
`
type CreateInboxItemParams struct {
@@ -329,6 +349,11 @@ type CreateInboxItemParams struct {
// A missing recipient is a quiet skip (pgx.ErrNoRows), not a delivery failure.
// Check the insertion snapshot without adding recipient row locks.
+//
+// MUL-9333: a row written on an issue the recipient has snoozed joins the
+// snooze, so it stays out of the inbox with the rest of the issue.
+// inbox.CreateIfEligible ends the snooze instead when the row is one that
+// wakes it.
// MUL-8472: a member outside a private project gets no notification about its
// issues, whatever their workspace role. Only project members do.
func (q *Queries) CreateInboxItem(ctx context.Context, arg CreateInboxItemParams) (InboxItem, error) {
@@ -365,13 +390,14 @@ func (q *Queries) CreateInboxItem(ctx context.Context, arg CreateInboxItemParams
&i.Details,
&i.Section,
&i.SnoozedUntil,
+ &i.SnoozedAt,
)
return i, err
}
const deleteInboxGroup = `-- name: DeleteInboxGroup :execrows
WITH target AS (
- SELECT selected.id, selected.workspace_id, selected.recipient_type, selected.recipient_id, selected.type, selected.severity, selected.issue_id, selected.title, selected.body, selected.read, selected.archived, selected.created_at, selected.actor_type, selected.actor_id, selected.details, selected.section, selected.snoozed_until FROM inbox_item selected
+ SELECT selected.id, selected.workspace_id, selected.recipient_type, selected.recipient_id, selected.type, selected.severity, selected.issue_id, selected.title, selected.body, selected.read, selected.archived, selected.created_at, selected.actor_type, selected.actor_id, selected.details, selected.section, selected.snoozed_until, selected.snoozed_at FROM inbox_item selected
WHERE selected.id = $1 AND selected.workspace_id = $2
AND selected.recipient_type = 'member' AND selected.recipient_id = $3
)
@@ -401,7 +427,7 @@ func (q *Queries) DeleteInboxGroup(ctx context.Context, arg DeleteInboxGroupPara
}
const getInboxItemInWorkspace = `-- name: GetInboxItemInWorkspace :one
-SELECT id, workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, body, read, archived, created_at, actor_type, actor_id, details, section, snoozed_until FROM inbox_item
+SELECT id, workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, body, read, archived, created_at, actor_type, actor_id, details, section, snoozed_until, snoozed_at FROM inbox_item
WHERE id = $1 AND workspace_id = $2
`
@@ -431,6 +457,7 @@ func (q *Queries) GetInboxItemInWorkspace(ctx context.Context, arg GetInboxItemI
&i.Details,
&i.Section,
&i.SnoozedUntil,
+ &i.SnoozedAt,
)
return i, err
}
@@ -486,7 +513,7 @@ WITH eligible_archived AS MATERIALIZED (
UNION
SELECT id FROM comment_anchors
)
-SELECT i.id, i.workspace_id, i.recipient_type, i.recipient_id, i.type, i.severity, i.issue_id, i.title, i.body, i.read, i.archived, i.created_at, i.actor_type, i.actor_id, i.details, i.section, i.snoozed_until,
+SELECT i.id, i.workspace_id, i.recipient_type, i.recipient_id, i.type, i.severity, i.issue_id, i.title, i.body, i.read, i.archived, i.created_at, i.actor_type, i.actor_id, i.details, i.section, i.snoozed_until, i.snoozed_at,
iss.status AS issue_status,
iss.priority AS issue_priority,
iss.project_id AS issue_project_id,
@@ -527,6 +554,7 @@ type ListArchivedInboxItemsRow struct {
Details []byte `json:"details"`
Section pgtype.Text `json:"section"`
SnoozedUntil pgtype.Timestamptz `json:"snoozed_until"`
+ SnoozedAt pgtype.Timestamptz `json:"snoozed_at"`
IssueStatus pgtype.Text `json:"issue_status"`
IssuePriority pgtype.Text `json:"issue_priority"`
IssueProjectID pgtype.UUID `json:"issue_project_id"`
@@ -589,6 +617,7 @@ func (q *Queries) ListArchivedInboxItems(ctx context.Context, arg ListArchivedIn
&i.Details,
&i.Section,
&i.SnoozedUntil,
+ &i.SnoozedAt,
&i.IssueStatus,
&i.IssuePriority,
&i.IssueProjectID,
@@ -608,7 +637,7 @@ func (q *Queries) ListArchivedInboxItems(ctx context.Context, arg ListArchivedIn
}
const listInboxItems = `-- name: ListInboxItems :many
-SELECT i.id, i.workspace_id, i.recipient_type, i.recipient_id, i.type, i.severity, i.issue_id, i.title, i.body, i.read, i.archived, i.created_at, i.actor_type, i.actor_id, i.details, i.section, i.snoozed_until,
+SELECT i.id, i.workspace_id, i.recipient_type, i.recipient_id, i.type, i.severity, i.issue_id, i.title, i.body, i.read, i.archived, i.created_at, i.actor_type, i.actor_id, i.details, i.section, i.snoozed_until, i.snoozed_at,
iss.status AS issue_status,
iss.priority AS issue_priority,
iss.project_id AS issue_project_id,
@@ -621,6 +650,10 @@ SELECT i.id, i.workspace_id, i.recipient_type, i.recipient_id, i.type, i.severit
FROM inbox_item i
LEFT JOIN issue iss ON iss.id = i.issue_id
WHERE i.workspace_id = $1 AND i.recipient_type = $2 AND i.recipient_id = $3 AND i.archived = false
+ -- MUL-9333: a snoozed issue stays out of the inbox until its time. A row
+ -- whose time has passed is listed again and keeps snoozed_until, which is
+ -- how the client tells an issue that came back on its own.
+ AND (i.snoozed_until IS NULL OR i.snoozed_until <= now())
AND ($4::uuid[] IS NULL OR iss.project_id IS NULL OR NOT (iss.project_id = ANY($4::uuid[])))
ORDER BY i.created_at DESC
`
@@ -650,6 +683,7 @@ type ListInboxItemsRow struct {
Details []byte `json:"details"`
Section pgtype.Text `json:"section"`
SnoozedUntil pgtype.Timestamptz `json:"snoozed_until"`
+ SnoozedAt pgtype.Timestamptz `json:"snoozed_at"`
IssueStatus pgtype.Text `json:"issue_status"`
IssuePriority pgtype.Text `json:"issue_priority"`
IssueProjectID pgtype.UUID `json:"issue_project_id"`
@@ -694,6 +728,7 @@ func (q *Queries) ListInboxItems(ctx context.Context, arg ListInboxItemsParams)
&i.Details,
&i.Section,
&i.SnoozedUntil,
+ &i.SnoozedAt,
&i.IssueStatus,
&i.IssuePriority,
&i.IssueProjectID,
@@ -712,9 +747,93 @@ func (q *Queries) ListInboxItems(ctx context.Context, arg ListInboxItemsParams)
return items, nil
}
+const listSnoozedInbox = `-- name: ListSnoozedInbox :many
+SELECT g.issue_id::uuid AS issue_id,
+ newest.id AS item_id,
+ g.snoozed_until::timestamptz AS snoozed_until,
+ g.snoozed_at::timestamptz AS snoozed_at,
+ g.updates::bigint AS updates
+FROM (
+ SELECT i.issue_id,
+ max(i.snoozed_until) AS snoozed_until,
+ min(i.snoozed_at) AS snoozed_at,
+ count(*) FILTER (WHERE i.snoozed_at IS NOT NULL AND i.created_at > i.snoozed_at) AS updates
+ FROM inbox_item i
+ WHERE i.workspace_id = $1
+ AND i.recipient_type = 'member'
+ AND i.recipient_id = $2
+ AND i.archived = false
+ AND i.issue_id IS NOT NULL
+ AND i.snoozed_until > now()
+ -- MUL-8472: private projects the caller cannot see.
+ AND ($3::uuid[] IS NULL OR NOT EXISTS (
+ SELECT 1 FROM issue hidden_issue
+ WHERE hidden_issue.id = i.issue_id
+ AND hidden_issue.project_id = ANY($3::uuid[])
+ ))
+ GROUP BY i.issue_id
+) g
+JOIN LATERAL (
+ SELECT n.id
+ FROM inbox_item n
+ WHERE n.workspace_id = $1
+ AND n.recipient_type = 'member'
+ AND n.recipient_id = $2
+ AND n.issue_id = g.issue_id
+ AND n.archived = false
+ ORDER BY n.created_at DESC, n.id DESC
+ LIMIT 1
+) newest ON true
+ORDER BY g.snoozed_until ASC, g.issue_id
+`
+
+type ListSnoozedInboxParams struct {
+ WorkspaceID pgtype.UUID `json:"workspace_id"`
+ RecipientID pgtype.UUID `json:"recipient_id"`
+ HiddenProjectIds []pgtype.UUID `json:"hidden_project_ids"`
+}
+
+type ListSnoozedInboxRow struct {
+ IssueID pgtype.UUID `json:"issue_id"`
+ ItemID pgtype.UUID `json:"item_id"`
+ SnoozedUntil pgtype.Timestamptz `json:"snoozed_until"`
+ SnoozedAt pgtype.Timestamptz `json:"snoozed_at"`
+ Updates int64 `json:"updates"`
+}
+
+// The recipient's snoozed issues, soonest back first (MUL-9333). `updates` is
+// how many rows arrived while snoozed; `item_id` is the issue's newest row,
+// the one the snooze endpoints take.
+func (q *Queries) ListSnoozedInbox(ctx context.Context, arg ListSnoozedInboxParams) ([]ListSnoozedInboxRow, error) {
+ rows, err := q.db.Query(ctx, listSnoozedInbox, arg.WorkspaceID, arg.RecipientID, arg.HiddenProjectIds)
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+ items := []ListSnoozedInboxRow{}
+ for rows.Next() {
+ var i ListSnoozedInboxRow
+ if err := rows.Scan(
+ &i.IssueID,
+ &i.ItemID,
+ &i.SnoozedUntil,
+ &i.SnoozedAt,
+ &i.Updates,
+ ); err != nil {
+ return nil, err
+ }
+ items = append(items, i)
+ }
+ if err := rows.Err(); err != nil {
+ return nil, err
+ }
+ return items, nil
+}
+
const markAllInboxRead = `-- name: MarkAllInboxRead :execrows
UPDATE inbox_item SET read = true
WHERE workspace_id = $1 AND recipient_type = 'member' AND recipient_id = $2 AND archived = false AND read = false
+ AND (snoozed_until IS NULL OR snoozed_until <= now())
`
type MarkAllInboxReadParams struct {
@@ -722,6 +841,8 @@ type MarkAllInboxReadParams struct {
RecipientID pgtype.UUID `json:"recipient_id"`
}
+// The batch actions act on what the inbox lists, so they skip snoozed issues
+// (MUL-9333).
func (q *Queries) MarkAllInboxRead(ctx context.Context, arg MarkAllInboxReadParams) (int64, error) {
result, err := q.db.Exec(ctx, markAllInboxRead, arg.WorkspaceID, arg.RecipientID)
if err != nil {
@@ -747,7 +868,7 @@ WITH target AS (
)
UPDATE inbox_item AS item SET read = true
WHERE item.id = $1
-RETURNING item.id, item.workspace_id, item.recipient_type, item.recipient_id, item.type, item.severity, item.issue_id, item.title, item.body, item.read, item.archived, item.created_at, item.actor_type, item.actor_id, item.details, item.section, item.snoozed_until
+RETURNING item.id, item.workspace_id, item.recipient_type, item.recipient_id, item.type, item.severity, item.issue_id, item.title, item.body, item.read, item.archived, item.created_at, item.actor_type, item.actor_id, item.details, item.section, item.snoozed_until, item.snoozed_at
`
// Opening a row in the inbox opens its issue, so it reads every active unread
@@ -780,6 +901,7 @@ func (q *Queries) MarkInboxRead(ctx context.Context, id pgtype.UUID) (InboxItem,
&i.Details,
&i.Section,
&i.SnoozedUntil,
+ &i.SnoozedAt,
)
return i, err
}
@@ -788,6 +910,7 @@ const markInboxReadByIssue = `-- name: MarkInboxReadByIssue :execrows
UPDATE inbox_item SET read = true
WHERE workspace_id = $1 AND recipient_type = 'member' AND recipient_id = $2
AND issue_id = $3 AND archived = false AND read = false
+ AND (snoozed_until IS NULL OR snoozed_until <= now())
`
type MarkInboxReadByIssueParams struct {
@@ -805,6 +928,8 @@ type MarkInboxReadByIssueParams struct {
// same through MarkInboxRead. Archived rows are left as they are, as in
// MarkAllInboxRead, which also keeps the lookup on the partial index
// idx_inbox_active_by_issue.
+// A snoozed issue is left unread: viewing it elsewhere does not end the
+// snooze, and it comes back as something to look at (MUL-9333).
func (q *Queries) MarkInboxReadByIssue(ctx context.Context, arg MarkInboxReadByIssueParams) (int64, error) {
result, err := q.db.Exec(ctx, markInboxReadByIssue, arg.WorkspaceID, arg.RecipientID, arg.IssueID)
if err != nil {
@@ -816,7 +941,7 @@ func (q *Queries) MarkInboxReadByIssue(ctx context.Context, arg MarkInboxReadByI
const markInboxUnread = `-- name: MarkInboxUnread :one
UPDATE inbox_item SET read = false
WHERE id = $1
-RETURNING id, workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, body, read, archived, created_at, actor_type, actor_id, details, section, snoozed_until
+RETURNING id, workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, body, read, archived, created_at, actor_type, actor_id, details, section, snoozed_until, snoozed_at
`
// Item-level, unlike MarkInboxRead: the inbox renders one row per issue
@@ -846,10 +971,89 @@ func (q *Queries) MarkInboxUnread(ctx context.Context, id pgtype.UUID) (InboxIte
&i.Details,
&i.Section,
&i.SnoozedUntil,
+ &i.SnoozedAt,
)
return i, err
}
+const snoozeInboxGroup = `-- name: SnoozeInboxGroup :many
+WITH target AS (
+ SELECT t.workspace_id, t.recipient_type, t.recipient_id, t.issue_id
+ FROM inbox_item t
+ WHERE t.id = $2 AND t.issue_id IS NOT NULL AND t.archived = false
+), newest AS (
+ SELECT n.id
+ FROM inbox_item n
+ JOIN target ON n.workspace_id = target.workspace_id
+ AND n.recipient_type = target.recipient_type
+ AND n.recipient_id = target.recipient_id
+ AND n.issue_id = target.issue_id
+ WHERE n.archived = false
+ ORDER BY n.created_at DESC, n.id DESC
+ LIMIT 1
+)
+UPDATE inbox_item item
+SET snoozed_until = $1::timestamptz,
+ snoozed_at = CASE WHEN item.snoozed_until > now() AND item.snoozed_at IS NOT NULL THEN item.snoozed_at ELSE now() END,
+ read = CASE WHEN item.id = (SELECT id FROM newest) THEN false ELSE item.read END
+FROM target
+WHERE item.workspace_id = target.workspace_id
+ AND item.recipient_type = target.recipient_type
+ AND item.recipient_id = target.recipient_id
+ AND item.issue_id = target.issue_id
+ AND item.archived = false
+RETURNING item.id, item.workspace_id, item.recipient_type, item.recipient_id, item.type, item.severity, item.issue_id, item.title, item.body, item.read, item.archived, item.created_at, item.actor_type, item.actor_id, item.details, item.section, item.snoozed_until, item.snoozed_at
+`
+
+type SnoozeInboxGroupParams struct {
+ SnoozedUntil pgtype.Timestamptz `json:"snoozed_until"`
+ ID pgtype.UUID `json:"id"`
+}
+
+// Snooze is issue-level, like archive (MUL-9333): every active row the
+// recipient has on the item's issue carries the time it comes back. Changing
+// the time of a running snooze keeps when it started, so the count of what
+// arrived meanwhile carries on. The newest row turns unread, so the issue
+// comes back as something to look at.
+func (q *Queries) SnoozeInboxGroup(ctx context.Context, arg SnoozeInboxGroupParams) ([]InboxItem, error) {
+ rows, err := q.db.Query(ctx, snoozeInboxGroup, arg.SnoozedUntil, arg.ID)
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+ items := []InboxItem{}
+ for rows.Next() {
+ var i InboxItem
+ if err := rows.Scan(
+ &i.ID,
+ &i.WorkspaceID,
+ &i.RecipientType,
+ &i.RecipientID,
+ &i.Type,
+ &i.Severity,
+ &i.IssueID,
+ &i.Title,
+ &i.Body,
+ &i.Read,
+ &i.Archived,
+ &i.CreatedAt,
+ &i.ActorType,
+ &i.ActorID,
+ &i.Details,
+ &i.Section,
+ &i.SnoozedUntil,
+ &i.SnoozedAt,
+ ); err != nil {
+ return nil, err
+ }
+ items = append(items, i)
+ }
+ if err := rows.Err(); err != nil {
+ return nil, err
+ }
+ return items, nil
+}
+
const unarchiveInboxByIssue = `-- name: UnarchiveInboxByIssue :execrows
UPDATE inbox_item SET archived = false
WHERE workspace_id = $1 AND recipient_type = $2 AND recipient_id = $3 AND issue_id = $4 AND archived = true
@@ -881,7 +1085,7 @@ func (q *Queries) UnarchiveInboxByIssue(ctx context.Context, arg UnarchiveInboxB
const unarchiveInboxItem = `-- name: UnarchiveInboxItem :one
UPDATE inbox_item SET archived = false
WHERE id = $1
-RETURNING id, workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, body, read, archived, created_at, actor_type, actor_id, details, section, snoozed_until
+RETURNING id, workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, body, read, archived, created_at, actor_type, actor_id, details, section, snoozed_until, snoozed_at
`
// Deliberately does not touch `read`: unarchiving restores an item to the main
@@ -908,6 +1112,67 @@ func (q *Queries) UnarchiveInboxItem(ctx context.Context, id pgtype.UUID) (Inbox
&i.Details,
&i.Section,
&i.SnoozedUntil,
+ &i.SnoozedAt,
)
return i, err
}
+
+const unsnoozeInboxGroup = `-- name: UnsnoozeInboxGroup :many
+UPDATE inbox_item SET snoozed_until = NULL, snoozed_at = NULL
+WHERE workspace_id = $1 AND recipient_type = $2 AND recipient_id = $3 AND issue_id = $4
+ AND archived = false AND snoozed_until IS NOT NULL
+RETURNING id, workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, body, read, archived, created_at, actor_type, actor_id, details, section, snoozed_until, snoozed_at
+`
+
+type UnsnoozeInboxGroupParams struct {
+ WorkspaceID pgtype.UUID `json:"workspace_id"`
+ RecipientType string `json:"recipient_type"`
+ RecipientID pgtype.UUID `json:"recipient_id"`
+ IssueID pgtype.UUID `json:"issue_id"`
+}
+
+// Ends a snooze on one issue: back in the inbox now. Also clears the time a
+// snooze that already ran out left on the rows.
+func (q *Queries) UnsnoozeInboxGroup(ctx context.Context, arg UnsnoozeInboxGroupParams) ([]InboxItem, error) {
+ rows, err := q.db.Query(ctx, unsnoozeInboxGroup,
+ arg.WorkspaceID,
+ arg.RecipientType,
+ arg.RecipientID,
+ arg.IssueID,
+ )
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+ items := []InboxItem{}
+ for rows.Next() {
+ var i InboxItem
+ if err := rows.Scan(
+ &i.ID,
+ &i.WorkspaceID,
+ &i.RecipientType,
+ &i.RecipientID,
+ &i.Type,
+ &i.Severity,
+ &i.IssueID,
+ &i.Title,
+ &i.Body,
+ &i.Read,
+ &i.Archived,
+ &i.CreatedAt,
+ &i.ActorType,
+ &i.ActorID,
+ &i.Details,
+ &i.Section,
+ &i.SnoozedUntil,
+ &i.SnoozedAt,
+ ); err != nil {
+ return nil, err
+ }
+ items = append(items, i)
+ }
+ if err := rows.Err(); err != nil {
+ return nil, err
+ }
+ return items, nil
+}
diff --git a/server/pkg/db/generated/inbox_archive.sql.go b/server/pkg/db/generated/inbox_archive.sql.go
index 39526f44dd..6cf227bde1 100644
--- a/server/pkg/db/generated/inbox_archive.sql.go
+++ b/server/pkg/db/generated/inbox_archive.sql.go
@@ -290,7 +290,7 @@ WITH base AS MATERIALIZED (
ORDER BY created_at DESC, id DESC
LIMIT $19::int
)
-SELECT i.id, i.workspace_id, i.recipient_type, i.recipient_id, i.type, i.severity, i.issue_id, i.title, i.body, i.read, i.archived, i.created_at, i.actor_type, i.actor_id, i.details, i.section, i.snoozed_until, selected.issue_status, selected.issue_priority,
+SELECT i.id, i.workspace_id, i.recipient_type, i.recipient_id, i.type, i.severity, i.issue_id, i.title, i.body, i.read, i.archived, i.created_at, i.actor_type, i.actor_id, i.details, i.section, i.snoozed_until, i.snoozed_at, selected.issue_status, selected.issue_priority,
iss.project_id AS issue_project_id,
iss.assignee_type AS issue_assignee_type,
iss.assignee_id AS issue_assignee_id,
@@ -406,6 +406,7 @@ func (q *Queries) ListArchivedInboxPage(ctx context.Context, arg ListArchivedInb
&i.InboxItem.Details,
&i.InboxItem.Section,
&i.InboxItem.SnoozedUntil,
+ &i.InboxItem.SnoozedAt,
&i.IssueStatus,
&i.IssuePriority,
&i.IssueProjectID,
diff --git a/server/pkg/db/generated/models.go b/server/pkg/db/generated/models.go
index abacc2f91d..6611c2d994 100644
--- a/server/pkg/db/generated/models.go
+++ b/server/pkg/db/generated/models.go
@@ -916,6 +916,7 @@ type InboxItem struct {
Details []byte `json:"details"`
Section pgtype.Text `json:"section"`
SnoozedUntil pgtype.Timestamptz `json:"snoozed_until"`
+ SnoozedAt pgtype.Timestamptz `json:"snoozed_at"`
}
type InstanceTelemetryState struct {
diff --git a/server/pkg/db/queries/inbox.sql b/server/pkg/db/queries/inbox.sql
index 1cef30c01e..4048874b25 100644
--- a/server/pkg/db/queries/inbox.sql
+++ b/server/pkg/db/queries/inbox.sql
@@ -15,6 +15,10 @@ SELECT i.*,
FROM inbox_item i
LEFT JOIN issue iss ON iss.id = i.issue_id
WHERE i.workspace_id = $1 AND i.recipient_type = $2 AND i.recipient_id = $3 AND i.archived = false
+ -- MUL-9333: a snoozed issue stays out of the inbox until its time. A row
+ -- whose time has passed is listed again and keeps snoozed_until, which is
+ -- how the client tells an issue that came back on its own.
+ AND (i.snoozed_until IS NULL OR i.snoozed_until <= now())
AND (sqlc.narg('hidden_project_ids')::uuid[] IS NULL OR iss.project_id IS NULL OR NOT (iss.project_id = ANY(sqlc.narg('hidden_project_ids')::uuid[])))
ORDER BY i.created_at DESC;
@@ -112,12 +116,28 @@ WHERE id = $1 AND workspace_id = $2;
-- name: CreateInboxItem :one
-- A missing recipient is a quiet skip (pgx.ErrNoRows), not a delivery failure.
-- Check the insertion snapshot without adding recipient row locks.
+--
+-- MUL-9333: a row written on an issue the recipient has snoozed joins the
+-- snooze, so it stays out of the inbox with the rest of the issue.
+-- inbox.CreateIfEligible ends the snooze instead when the row is one that
+-- wakes it.
INSERT INTO inbox_item (
workspace_id, recipient_type, recipient_id,
type, severity, issue_id, title, body,
- actor_type, actor_id, details, id
+ actor_type, actor_id, details, id,
+ snoozed_until, snoozed_at
)
-SELECT $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, COALESCE(sqlc.narg('id')::uuid, gen_random_uuid())
+SELECT $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, COALESCE(sqlc.narg('id')::uuid, gen_random_uuid()),
+ snoozed.snoozed_until, snoozed.snoozed_at
+FROM (SELECT 1) AS one
+LEFT JOIN LATERAL (
+ SELECT s.snoozed_until, s.snoozed_at
+ FROM inbox_item s
+ WHERE s.workspace_id = $1 AND s.recipient_type = $2 AND s.recipient_id = $3
+ AND s.issue_id = $6 AND s.archived = false AND s.snoozed_until > now()
+ ORDER BY s.snoozed_until DESC
+ LIMIT 1
+) AS snoozed ON true
WHERE (($2::text = 'member' AND EXISTS (
SELECT 1 FROM member WHERE workspace_id = $1 AND user_id = $3
)) OR ($2::text = 'agent' AND EXISTS (
@@ -177,7 +197,9 @@ WHERE id = $1
RETURNING *;
-- name: ArchiveInboxItem :one
-UPDATE inbox_item SET archived = true
+-- Archiving ends a snooze (MUL-9333), on every archive path below: a row
+-- restored later must not come back still hidden.
+UPDATE inbox_item SET archived = true, snoozed_until = NULL, snoozed_at = NULL
WHERE id = $1
RETURNING *;
@@ -198,7 +220,7 @@ WHERE item.workspace_id = target.workspace_id
AND (item.id = target.id OR item.issue_id = target.issue_id);
-- name: ArchiveInboxByIssue :execrows
-UPDATE inbox_item SET archived = true
+UPDATE inbox_item SET archived = true, snoozed_until = NULL, snoozed_at = NULL
WHERE workspace_id = $1 AND recipient_type = $2 AND recipient_id = $3 AND issue_id = $4 AND archived = false;
-- name: UnarchiveInboxItem :one
@@ -217,7 +239,7 @@ UPDATE inbox_item SET archived = false
WHERE workspace_id = $1 AND recipient_type = $2 AND recipient_id = $3 AND issue_id = $4 AND archived = true;
-- name: ArchiveInboxByIssueAndType :many
-UPDATE inbox_item SET archived = true
+UPDATE inbox_item SET archived = true, snoozed_until = NULL, snoozed_at = NULL
WHERE workspace_id = $1 AND issue_id = $2 AND type = $3 AND archived = false
RETURNING recipient_type, recipient_id;
@@ -228,6 +250,7 @@ WHERE i.workspace_id = sqlc.arg('workspace_id')
AND i.recipient_id = sqlc.arg('recipient_id')
AND i.read = false
AND i.archived = false
+ AND (i.snoozed_until IS NULL OR i.snoozed_until <= now())
-- MUL-8472: private projects the caller cannot see.
AND (sqlc.narg('hidden_project_ids')::uuid[] IS NULL OR i.issue_id IS NULL OR NOT EXISTS (
SELECT 1 FROM issue hidden_issue
@@ -256,6 +279,8 @@ FROM (
WHERE i.recipient_type = 'member'
AND i.recipient_id = $1
AND i.archived = false
+ -- MUL-9333: a snoozed issue does not count until it comes back.
+ AND (i.snoozed_until IS NULL OR i.snoozed_until <= now())
-- MUL-8472: issues in private projects the recipient is not a member
-- of do not count.
AND NOT EXISTS (
@@ -274,8 +299,11 @@ WHERE newest.read = false
GROUP BY newest.workspace_id;
-- name: MarkAllInboxRead :execrows
+-- The batch actions act on what the inbox lists, so they skip snoozed issues
+-- (MUL-9333).
UPDATE inbox_item SET read = true
-WHERE workspace_id = $1 AND recipient_type = 'member' AND recipient_id = $2 AND archived = false AND read = false;
+WHERE workspace_id = $1 AND recipient_type = 'member' AND recipient_id = $2 AND archived = false AND read = false
+ AND (snoozed_until IS NULL OR snoozed_until <= now());
-- name: MarkInboxReadByIssue :execrows
-- Reading an issue outside the inbox (its page, a side peek, the Unread view)
@@ -287,13 +315,17 @@ WHERE workspace_id = $1 AND recipient_type = 'member' AND recipient_id = $2 AND
-- same through MarkInboxRead. Archived rows are left as they are, as in
-- MarkAllInboxRead, which also keeps the lookup on the partial index
-- idx_inbox_active_by_issue.
+-- A snoozed issue is left unread: viewing it elsewhere does not end the
+-- snooze, and it comes back as something to look at (MUL-9333).
UPDATE inbox_item SET read = true
WHERE workspace_id = $1 AND recipient_type = 'member' AND recipient_id = $2
- AND issue_id = $3 AND archived = false AND read = false;
+ AND issue_id = $3 AND archived = false AND read = false
+ AND (snoozed_until IS NULL OR snoozed_until <= now());
-- name: ArchiveAllInbox :execrows
UPDATE inbox_item SET archived = true
-WHERE workspace_id = $1 AND recipient_type = 'member' AND recipient_id = $2 AND archived = false;
+WHERE workspace_id = $1 AND recipient_type = 'member' AND recipient_id = $2 AND archived = false
+ AND (snoozed_until IS NULL OR snoozed_until <= now());
-- name: ArchiveAllReadInbox :execrows
-- "Read" is the state of the one issue row the inbox renders: the newest
@@ -310,6 +342,7 @@ WITH newest_groups AS (
AND i.recipient_type = 'member'
AND i.recipient_id = $2
AND i.archived = false
+ AND (i.snoozed_until IS NULL OR i.snoozed_until <= now())
ORDER BY COALESCE(i.issue_id, i.id), i.created_at DESC, i.id DESC
), read_groups AS (
SELECT group_id
@@ -325,10 +358,94 @@ WHERE i.workspace_id = $1
AND COALESCE(i.issue_id, i.id) = selected.group_id;
-- name: ArchiveCompletedInbox :execrows
-UPDATE inbox_item i SET archived = true
+-- Snoozed issues included: a done issue leaves the inbox either way.
+UPDATE inbox_item i SET archived = true, snoozed_until = NULL, snoozed_at = NULL
WHERE i.workspace_id = $1 AND i.recipient_type = 'member' AND i.recipient_id = $2 AND i.archived = false
AND i.issue_id IN (
SELECT id FROM issue
WHERE workspace_id = $1
AND status = ANY(sqlc.arg('terminal_status_keys')::text[])
);
+
+-- name: SnoozeInboxGroup :many
+-- Snooze is issue-level, like archive (MUL-9333): every active row the
+-- recipient has on the item's issue carries the time it comes back. Changing
+-- the time of a running snooze keeps when it started, so the count of what
+-- arrived meanwhile carries on. The newest row turns unread, so the issue
+-- comes back as something to look at.
+WITH target AS (
+ SELECT t.workspace_id, t.recipient_type, t.recipient_id, t.issue_id
+ FROM inbox_item t
+ WHERE t.id = sqlc.arg('id') AND t.issue_id IS NOT NULL AND t.archived = false
+), newest AS (
+ SELECT n.id
+ FROM inbox_item n
+ JOIN target ON n.workspace_id = target.workspace_id
+ AND n.recipient_type = target.recipient_type
+ AND n.recipient_id = target.recipient_id
+ AND n.issue_id = target.issue_id
+ WHERE n.archived = false
+ ORDER BY n.created_at DESC, n.id DESC
+ LIMIT 1
+)
+UPDATE inbox_item item
+SET snoozed_until = sqlc.arg('snoozed_until')::timestamptz,
+ snoozed_at = CASE WHEN item.snoozed_until > now() AND item.snoozed_at IS NOT NULL THEN item.snoozed_at ELSE now() END,
+ read = CASE WHEN item.id = (SELECT id FROM newest) THEN false ELSE item.read END
+FROM target
+WHERE item.workspace_id = target.workspace_id
+ AND item.recipient_type = target.recipient_type
+ AND item.recipient_id = target.recipient_id
+ AND item.issue_id = target.issue_id
+ AND item.archived = false
+RETURNING item.*;
+
+-- name: UnsnoozeInboxGroup :many
+-- Ends a snooze on one issue: back in the inbox now. Also clears the time a
+-- snooze that already ran out left on the rows.
+UPDATE inbox_item SET snoozed_until = NULL, snoozed_at = NULL
+WHERE workspace_id = $1 AND recipient_type = $2 AND recipient_id = $3 AND issue_id = $4
+ AND archived = false AND snoozed_until IS NOT NULL
+RETURNING *;
+
+-- name: ListSnoozedInbox :many
+-- The recipient's snoozed issues, soonest back first (MUL-9333). `updates` is
+-- how many rows arrived while snoozed; `item_id` is the issue's newest row,
+-- the one the snooze endpoints take.
+SELECT g.issue_id::uuid AS issue_id,
+ newest.id AS item_id,
+ g.snoozed_until::timestamptz AS snoozed_until,
+ g.snoozed_at::timestamptz AS snoozed_at,
+ g.updates::bigint AS updates
+FROM (
+ SELECT i.issue_id,
+ max(i.snoozed_until) AS snoozed_until,
+ min(i.snoozed_at) AS snoozed_at,
+ count(*) FILTER (WHERE i.snoozed_at IS NOT NULL AND i.created_at > i.snoozed_at) AS updates
+ FROM inbox_item i
+ WHERE i.workspace_id = sqlc.arg('workspace_id')
+ AND i.recipient_type = 'member'
+ AND i.recipient_id = sqlc.arg('recipient_id')
+ AND i.archived = false
+ AND i.issue_id IS NOT NULL
+ AND i.snoozed_until > now()
+ -- MUL-8472: private projects the caller cannot see.
+ AND (sqlc.narg('hidden_project_ids')::uuid[] IS NULL OR NOT EXISTS (
+ SELECT 1 FROM issue hidden_issue
+ WHERE hidden_issue.id = i.issue_id
+ AND hidden_issue.project_id = ANY(sqlc.narg('hidden_project_ids')::uuid[])
+ ))
+ GROUP BY i.issue_id
+) g
+JOIN LATERAL (
+ SELECT n.id
+ FROM inbox_item n
+ WHERE n.workspace_id = sqlc.arg('workspace_id')
+ AND n.recipient_type = 'member'
+ AND n.recipient_id = sqlc.arg('recipient_id')
+ AND n.issue_id = g.issue_id
+ AND n.archived = false
+ ORDER BY n.created_at DESC, n.id DESC
+ LIMIT 1
+) newest ON true
+ORDER BY g.snoozed_until ASC, g.issue_id;
diff --git a/server/pkg/protocol/events.go b/server/pkg/protocol/events.go
index 36047d5e71..0154804eac 100644
--- a/server/pkg/protocol/events.go
+++ b/server/pkg/protocol/events.go
@@ -54,6 +54,12 @@ const (
EventInboxDeleted = "inbox:deleted"
EventInboxBatchRead = "inbox:batch-read"
EventInboxBatchArchived = "inbox:batch-archived"
+ // An issue left the recipient's inbox until a set time, or a row was
+ // written on an issue they have snoozed. Payload: `recipient_id`,
+ // `issue_id`, `snoozed_until`, or `item` for a written row.
+ EventInboxSnoozed = "inbox:snoozed"
+ // A snooze ended before its time. Payload: `recipient_id`, `issue_id`.
+ EventInboxUnsnoozed = "inbox:unsnoozed"
// Workspace events
EventWorkspaceUpdated = "workspace:updated"