Skip to content

Commit 882674f

Browse files
Hide all tagged messages from the inbox
The inbox now excludes any message that has any user tag, not just archive and spam. Only completely untagged messages appear in the inbox. Tagged messages are found via their tag views in the sidebar. Uses a module-level tag list (setAllTags) in api.jsx that the app updates whenever tags load or change. appendViewLinks adds a missing_link for each known tag when building inbox queries. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent f0c86dc commit 882674f

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

ui/js/api.jsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
const LINK_ARCHIVE = "message_tags.message_id:tag=archive";
22
const LINK_SPAM = "message_tags.message_id:tag=spam";
33

4+
// Module-level tag list — updated by the app when tags load.
5+
// Used to exclude all tagged messages from the inbox view.
6+
let _allTags = [];
7+
function setAllTags(tags) { _allTags = tags || []; }
8+
49
// ─── multi-account session store ───────────────────────────────────────
510
// Each logged-in mailbox keeps its own session token, all stored together,
611
// so switching accounts (like Proton's account switcher) never needs to
@@ -340,7 +345,14 @@ function appendViewLinks(params, view, tagView) {
340345
params.append("has_link", "message_tags.message_id:tag=" + tagView);
341346
} else if (view !== "sent") {
342347
params.append("missing_link", LINK_ARCHIVE);
343-
if (view === "inbox") params.append("missing_link", LINK_SPAM);
348+
if (view === "inbox") {
349+
// Exclude all tagged messages from the inbox — any message with
350+
// any user tag is hidden. Only untagged messages appear here.
351+
_allTags.forEach((name) => {
352+
if (name === "archive") return;
353+
params.append("missing_link", "message_tags.message_id:tag=" + name);
354+
});
355+
}
344356
}
345357
}
346358

ui/js/app.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function App() {
9292
);
9393

9494
useEffect(() => {
95-
if (token) loadTags().then((names) => loadUnread(names));
95+
if (token) loadTags().then((names) => { setAllTags(names); loadUnread(names); });
9696
}, [token, loadTags]);
9797

9898
useEffect(() => {
@@ -214,19 +214,19 @@ function App() {
214214
};
215215

216216
const onCreateTag = (name) =>
217-
createTag(token, name).then(() => loadTags().then((names) => loadUnread(names)));
217+
createTag(token, name).then(() => loadTags().then((names) => { setAllTags(names); loadUnread(names); }));
218218

219219
const afterTagChange = (gone) => {
220220
// Leaving the view of a tag that no longer exists would show an empty list
221221
// with no way back, so fall back to the inbox.
222222
if (gone && view === "tag" && tagView === gone) setView("inbox", "");
223-
return loadTags().then((names) => loadUnread(names));
223+
return loadTags().then((names) => { setAllTags(names); loadUnread(names); });
224224
};
225225

226226
const onRenameTag = (name, newName) =>
227227
renameTag(token, name, newName).then((res) => {
228228
if (view === "tag" && tagView === name) setView("tag", res?.name || newName);
229-
return loadTags().then((names) => loadUnread(names));
229+
return loadTags().then((names) => { setAllTags(names); loadUnread(names); });
230230
});
231231

232232
const onDeleteTag = (name) => deleteTag(token, name).then(() => afterTagChange(name));

0 commit comments

Comments
 (0)