From a198a7414a57b5f298b8b0afbfab0598888e23fe Mon Sep 17 00:00:00 2001 From: lqvp <183242690+lqvp@users.noreply.github.com> Date: Fri, 13 Dec 2024 22:49:53 +0900 Subject: [PATCH 1/3] =?UTF-8?q?enhance:=20=E3=83=AD=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E5=90=8D=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit misskey-js --- .../core/entities/AnnouncementEntityService.ts | 15 ++++++++++++++- .../src/models/json-schema/announcement.ts | 8 ++++++++ packages/frontend/src/pages/announcements.vue | 11 +++++++++-- packages/misskey-js/src/autogen/types.ts | 1 + 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/core/entities/AnnouncementEntityService.ts b/packages/backend/src/core/entities/AnnouncementEntityService.ts index e86411b35273..c8dc3376fc14 100644 --- a/packages/backend/src/core/entities/AnnouncementEntityService.ts +++ b/packages/backend/src/core/entities/AnnouncementEntityService.ts @@ -5,10 +5,11 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; -import type { AnnouncementsRepository, AnnouncementReadsRepository, MiAnnouncement, MiUser } from '@/models/_.js'; +import type { AnnouncementsRepository, AnnouncementReadsRepository, AnnouncementRolesRepository, MiAnnouncement, MiUser } from '@/models/_.js'; import type { Packed } from '@/misc/json-schema.js'; import { bindThis } from '@/decorators.js'; import { IdService } from '@/core/IdService.js'; +import { RoleEntityService } from './RoleEntityService.js'; @Injectable() export class AnnouncementEntityService { @@ -19,7 +20,11 @@ export class AnnouncementEntityService { @Inject(DI.announcementReadsRepository) private announcementReadsRepository: AnnouncementReadsRepository, + @Inject(DI.announcementRolesRepository) + private announcementRolesRepository: AnnouncementRolesRepository, + private idService: IdService, + private roleEntityService: RoleEntityService, ) { } @@ -43,6 +48,13 @@ export class AnnouncementEntityService { .then((count: number) => count > 0); } + // ロール名を取得 + const roles = announcement.isRoleSpecified ? await this.announcementRolesRepository.findBy({ announcementId: announcement.id }) : []; + const roleNames = await Promise.all(roles.map(async role => { + const roleEntity = await this.roleEntityService.pack(role.roleId); + return roleEntity.name; + })); + return { id: announcement.id, createdAt: this.idService.parse(announcement.id).date.toISOString(), @@ -57,6 +69,7 @@ export class AnnouncementEntityService { needConfirmationToRead: announcement.needConfirmationToRead, silence: announcement.silence, isRead: announcement.isRead !== null ? announcement.isRead : undefined, + roleNames: roleNames, }; } diff --git a/packages/backend/src/models/json-schema/announcement.ts b/packages/backend/src/models/json-schema/announcement.ts index 1a39ad975eb5..f054c8926aad 100644 --- a/packages/backend/src/models/json-schema/announcement.ts +++ b/packages/backend/src/models/json-schema/announcement.ts @@ -60,6 +60,14 @@ export const packedAnnouncementSchema = { type: 'boolean', optional: false, nullable: false, }, + roleNames: { + type: 'array', + items: { + type: 'string', + }, + optional: false, + nullable: false, + }, isRead: { type: 'boolean', optional: true, nullable: false, diff --git a/packages/frontend/src/pages/announcements.vue b/packages/frontend/src/pages/announcements.vue index c8153061a92c..2d171a536170 100644 --- a/packages/frontend/src/pages/announcements.vue +++ b/packages/frontend/src/pages/announcements.vue @@ -13,7 +13,9 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.forYou }}
-
{{ i18n.ts.forYourRoles }}
+
+ {{ i18n.ts.forYourRoles }}: {{ announcement.roleNames.join(', ') }} +
🆕 @@ -129,7 +131,12 @@ definePageMetadata(() => ({ line-height: 24px; font-size: 90%; white-space: pre; - color: #d28a3f; + color: var(--MI_THEME-warn); +} + +.roleNames { + font-weight: bold; + color: var(--MI_THEME-accent); } .header { diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index 01d7a39edcf9..750a78c465aa 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -4118,6 +4118,7 @@ export type components = { silence: boolean; forYou: boolean; forYourRoles: boolean; + roleNames: string[]; isRead?: boolean; }; App: { From 10a05f534438d6ef43899d9d912d39e95c008372 Mon Sep 17 00:00:00 2001 From: mai <74494945+chan-mai@users.noreply.github.com> Date: Wed, 18 Dec 2024 09:22:29 +0000 Subject: [PATCH 2/3] type --- packages/misskey-js/src/autogen/types.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index 750a78c465aa..aa1e10908749 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -16300,8 +16300,8 @@ export type operations = { * @enum {string|null} */ type: 'follow' | 'unFollow' | 'wasFollow' | 'wasUnFollow' | 'blocked' | 'unBlocked' | 'wasBlocked' | 'wasUnBlocked'; - fromUser: components['schemas']['UserDetailedNotMe']; - toUser: components['schemas']['UserDetailedNotMe']; + fromUser: Record; + toUser: Record; /** Format: date-time */ timestamp: string; })[]; @@ -16389,8 +16389,8 @@ export type operations = { * @enum {string|null} */ type: 'sent' | 'received' | 'approved' | 'rejected' | 'wasApproved' | 'wasRejected' | 'wasBlocked' | 'wasUnBlocked'; - fromUser: components['schemas']['UserDetailedNotMe']; - toUser: components['schemas']['UserDetailedNotMe']; + fromUser: Record; + toUser: Record; /** Format: date-time */ timestamp: string; })[]; @@ -22911,6 +22911,10 @@ export type operations = { scheduleNote: { scheduledAt?: number; }; + scheduledDelete?: ({ + deleteAt?: number | null; + deleteAfter?: number | null; + }) | null; }; }; }; From 1b7afa4ef06e706208f7a568da248091e078c560 Mon Sep 17 00:00:00 2001 From: mai <74494945+chan-mai@users.noreply.github.com> Date: Wed, 18 Dec 2024 09:25:11 +0000 Subject: [PATCH 3/3] =?UTF-8?q?docs:=20=E6=9B=B8=E3=81=8D=E8=B6=B3?= =?UTF-8?q?=E3=81=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d17915a6948c..aea79561fe33 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ - アバターデコレーションを登録したユーザーがアカウントを消去しても継続して使用ができるように - アバターデコレーションをmisskeyUI上から登録できるように https://github.com/team-shahu/misskey/pull/12 - TL上のサーバー情報をアイコン表示に切り替えられるように https://github.com/team-shahu/misskey/pull/13 https://github.com/team-shahu/misskey/pull/24 -- 特定のロールにのみお知らせを発行する機能 https://github.com/team-shahu/misskey/pull/18 +- 特定のロールにのみお知らせを発行する機能 https://github.com/team-shahu/misskey/pull/18 https://github.com/team-shahu/misskey/pull/54 - リアクションした人一覧がブロック・ミュートを考慮するようにする設定 https://github.com/team-shahu/misskey/pull/23 https://github.com/team-shahu/misskey/pull/27 - 誰がリアクションをしたのかを非表示にできる機能 https://github.com/hideki0403/kakurega.app/commit/65d85bb4fe724dc0737f1ac7958bc13c96cc926d - 誰がリアクションをしたのかを非表示にできる機能 https://github.com/team-shahu/misskey/pull/35 (https://github.com/team-shahu/misskey/commit/5b2923c8127336d7fd2ee39c76d16f8a30d1b9e1)