announcements: push notification for internal announcements

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2024-02-07 10:55:41 -05:00
parent f946e6a28d
commit 67c98f6a76
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 7 additions and 0 deletions

View File

@ -236,8 +236,15 @@ class Announcements:
"feed": feed "feed": feed
} }
self.entry_mgr.add_entry(entry) self.entry_mgr.add_entry(entry)
self.eventloop.create_task(self._notify_internal())
return entry return entry
async def _notify_internal(self) -> None:
entries = await self.entry_mgr.list_entries()
self.server.send_event(
"announcements:entries_updated", {"entries": entries}
)
async def remove_announcement(self, entry_id: str) -> None: async def remove_announcement(self, entry_id: str) -> None:
ret = await self.entry_mgr.remove_entry(entry_id) ret = await self.entry_mgr.remove_entry(entry_id)
if ret is not None: if ret is not None: