From 0ff78bde100c70c15f513ed0c712d11b769d4146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Sun, 20 Aug 2023 00:17:28 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A2=E3=83=BC=E3=82=AB=E3=82=A4=E3=83=96?= =?UTF-8?q?=E3=81=95=E3=82=8C=E3=81=9F=E3=81=8A=E7=9F=A5=E3=82=89=E3=81=9B?= =?UTF-8?q?=E3=82=92=E3=82=8F=E3=81=8B=E3=82=8A=E3=82=84=E3=81=99=E3=81=8F?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/src/core/AnnouncementService.ts | 32 +++++++++++-------- .../src/pages/admin/announcements.vue | 1 + 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/packages/backend/src/core/AnnouncementService.ts b/packages/backend/src/core/AnnouncementService.ts index e00bd2582cb5..ddb646b57a73 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 fc19102dabed..d9f7c6e0f754 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