aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/app.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/app.js b/packages/meshbay-hub/src/meshbay_hub/static/app.js
index 06b6c10..7cc7c83 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/app.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/app.js
@@ -342,7 +342,7 @@ function NotificationFeed({ notifications, onMarkRead, onPurge }) {
</button>
</h3>
${notifications.map(n => html`
- <div key=${n.id} class="notif-item ${n.read ? '' : 'notif-unread'}"
+ <div key=${n.id} class="notif-item notif-unread"
onClick=${() => {
// Reading it is the point of clicking it: it goes, here and in the
// count, rather than sitting there greyed out.
@@ -579,7 +579,13 @@ function App() {
if (!user || notifDisabled) {
setNotifications([]); setUnreadCount(0); return;
}
- hubFetch('/v1/notifications?limit=20', { token: user.token })
+ // `unread_only`: clicking one is what dismisses it (see markRead), so a
+ // read notification is a dismissed notification and must not come back on
+ // the next launch. Without this the two halves disagreed — the click
+ // removed it here and marked it read on the hub, and the next startup
+ // asked for everything and put it straight back. `unread_count` is
+ // computed server-side and is unaffected by the filter.
+ hubFetch('/v1/notifications?limit=20&unread_only=true', { token: user.token })
.then(data => {
setNotifications(data.notifications || []);
setUnreadCount(data.unread_count || 0);