From eaae8e6bea272fa9bb0f3b2ac3859a3e3bbfb947 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 05:47:09 +0900 Subject: [PATCH] =?UTF-8?q?enhance:=20=E3=83=80=E3=82=A4=E3=82=A2=E3=83=AD?= =?UTF-8?q?=E3=82=B0=E3=81=AE=E3=81=8A=E7=9F=A5=E3=82=89=E3=81=9B=E3=82=92?= =?UTF-8?q?=E3=82=A2=E3=83=BC=E3=82=AB=E3=82=A4=E3=83=96=E3=81=97=E3=81=9F?= =?UTF-8?q?=E6=99=82=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88=E3=81=8C=E7=99=BA?= =?UTF-8?q?=E7=94=9F=E3=81=97=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=83=BB=E3=82=A2=E3=83=BC=E3=82=AB=E3=82=A4=E3=83=96=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=81=9F=E3=81=8A=E7=9F=A5=E3=82=89=E3=81=9B=E3=82=92?= =?UTF-8?q?=E3=82=8F=E3=81=8B=E3=82=8A=E3=82=84=E3=81=99=E3=81=8F=20(Missk?= =?UTF-8?q?eyIO#153)?= 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 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