Keep unread notifications in sync with headerbar

This commit is contained in:
Johannes Zellner
2026-01-23 12:26:08 +01:00
parent 2040eb22a2
commit 106cc5238e
3 changed files with 20 additions and 22 deletions
+5 -1
View File
@@ -2,7 +2,7 @@
import { marked } from 'marked';
import { eachLimit } from 'async';
import { ref, onMounted } from 'vue';
import { ref, onMounted, inject } from 'vue';
import { Button } from '@cloudron/pankow';
import { prettyDate } from '@cloudron/pankow/utils';
import NotificationsModel from '../models/NotificationsModel.js';
@@ -12,6 +12,7 @@ const notificationsModel = NotificationsModel.create();
const busy = ref(true);
const notifications = ref([]);
const notificationsAllBusy = ref(false);
const refreshNotifications = inject('refreshNotifications');
async function refresh() {
const [error, result] = await notificationsModel.list();
@@ -30,6 +31,7 @@ async function onMarkNotificationRead(notification) {
if (error) return console.error(error);
await refresh();
refreshNotifications();
}
async function onMarkNotificationUnread(notification) {
@@ -38,6 +40,7 @@ async function onMarkNotificationUnread(notification) {
if (error) return console.error(error);
await refresh();
refreshNotifications();
}
async function onMarkAllNotificationRead() {
@@ -50,6 +53,7 @@ async function onMarkAllNotificationRead() {
});
await refresh();
refreshNotifications();
notificationsAllBusy.value = false;
}