From 4cab2919ac323e46fc05fccf9e10ada833dbb3b6 Mon Sep 17 00:00:00 2001 From: Michael Genson Date: Sat, 28 Mar 2026 19:03:18 +0000 Subject: [PATCH] don't advance announcements if the dialog already opened --- .../Announcement/AnnouncementDialog.vue | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/frontend/components/Domain/Announcement/AnnouncementDialog.vue b/frontend/components/Domain/Announcement/AnnouncementDialog.vue index aa61c72f1..fec13c94e 100644 --- a/frontend/components/Domain/Announcement/AnnouncementDialog.vue +++ b/frontend/components/Domain/Announcement/AnnouncementDialog.vue @@ -85,20 +85,15 @@ const dialog = defineModel({ default: false }); const { newAnnouncements, allAnnouncements, setLastRead } = useAnnouncements(); const currentAnnouncement = shallowRef(); -watch( - dialog, - () => { - // Once the dialog is opened, show the next announcement - if (dialog.value) { - nextAnnouncement(); +watch(dialog, () => { + if (!dialog.value || currentAnnouncement.value) { + return; + } - // If there are no new announcements, this is never set, so show the newest one - if (!currentAnnouncement.value) { - setCurrentAnnouncement(allAnnouncements.at(-1)!); - } - } - }, -); + // Show first unread on open, or fall back to the newest + const next = newAnnouncements.value.at(0) || allAnnouncements.at(-1)!; + setCurrentAnnouncement(next); +}); function setCurrentAnnouncement(announcement: Announcement) { currentAnnouncement.value = announcement;