diff --git a/packages/backend/src/core/AnnouncementService.ts b/packages/backend/src/core/AnnouncementService.ts index e00bd2582c..ddb646b57a 100644 --- a/packages/backend/src/core/AnnouncementService.ts +++ b/packages/backend/src/core/AnnouncementService.ts @@ -98,6 +98,7 @@ export class AnnouncementService { } query.orderBy({ + 'announcement."isActive"': 'DESC', 'announcement."displayOrder"': 'DESC', 'announcement."createdAt"': 'DESC', }); @@ -166,21 +167,26 @@ export class AnnouncementService { const packed = await this.announcementEntityService.pack( announcement, - values.userId ? { id: values.userId } : null, + announcement.userId ? { id: announcement.userId } : null, ); - if (values.userId) { - this.globalEventService.publishMainStream( - values.userId, - 'announcementCreated', - { - announcement: packed, - }, - ); - } else { - this.globalEventService.publishBroadcastStream('announcementCreated', { - announcement: packed, - }); + if (announcement.isActive) { + if (announcement.userId) { + this.globalEventService.publishMainStream( + announcement.userId, + 'announcementCreated', + { + announcement: packed, + }, + ); + } else { + this.globalEventService.publishBroadcastStream( + 'announcementCreated', + { + announcement: packed, + }, + ); + } } return { diff --git a/packages/frontend/src/pages/admin/announcements.vue b/packages/frontend/src/pages/admin/announcements.vue index fc19102dab..d9f7c6e0f7 100644 --- a/packages/frontend/src/pages/admin/announcements.vue +++ b/packages/frontend/src/pages/admin/announcements.vue @@ -28,6 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only