From a9127e3ecd0c5789ba01123b8c4bbfc22c4e70e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?= <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:35:40 +0900 Subject: [PATCH] =?UTF-8?q?enhance(frontend):=20=E3=83=81=E3=83=A3?= =?UTF-8?q?=E3=83=B3=E3=83=8D=E3=83=AB=E3=83=8E=E3=83=BC=E3=83=88=E3=81=AE?= =?UTF-8?q?=E3=83=94=E3=83=B3=E7=95=99=E3=82=81=E3=82=92=E3=83=8E=E3=83=BC?= =?UTF-8?q?=E3=83=88=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC=E3=81=8B=E3=82=89?= =?UTF-8?q?=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=20(#1288?= =?UTF-8?q?7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * enhance(frontend): チャンネルノートのピン留めをノートメニューからできるように * Update Changelog --- CHANGELOG.md | 1 + .../src/core/entities/NoteEntityService.ts | 1 + .../backend/src/models/json-schema/note.ts | 4 +++ .../frontend/src/scripts/get-note-menu.ts | 36 +++++++++++++++++++ .../misskey-js/src/autogen/apiClientJSDoc.ts | 5 ++- packages/misskey-js/src/autogen/endpoint.ts | 4 +-- packages/misskey-js/src/autogen/entities.ts | 4 +-- packages/misskey-js/src/autogen/models.ts | 4 +-- packages/misskey-js/src/autogen/types.ts | 17 +++++---- 9 files changed, 61 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea34fa9ef..efd98ba31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ ### Client - Enhance: ハッシュタグ入力時に、本文の末尾の行に何も書かれていない場合は新たにスペースを追加しないように +- Enhance: チャンネルノートのピン留めをノートのメニューからできるように ## 2023.12.2 diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index c49dad8e7..1777e2cf5 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -351,6 +351,7 @@ export class NoteEntityService implements OnModuleInit { color: channel.color, isSensitive: channel.isSensitive, allowRenoteToExternal: channel.allowRenoteToExternal, + userId: channel.userId, } : undefined, mentions: note.mentions.length > 0 ? note.mentions : undefined, uri: note.uri ?? undefined, diff --git a/packages/backend/src/models/json-schema/note.ts b/packages/backend/src/models/json-schema/note.ts index aa749943f..2b7722129 100644 --- a/packages/backend/src/models/json-schema/note.ts +++ b/packages/backend/src/models/json-schema/note.ts @@ -148,6 +148,10 @@ export const packedNoteSchema = { type: 'boolean', optional: false, nullable: false, }, + userId: { + type: 'string', + optional: false, nullable: true, + }, }, }, localOnly: { diff --git a/packages/frontend/src/scripts/get-note-menu.ts b/packages/frontend/src/scripts/get-note-menu.ts index 7130e6927..b9224c559 100644 --- a/packages/frontend/src/scripts/get-note-menu.ts +++ b/packages/frontend/src/scripts/get-note-menu.ts @@ -352,6 +352,42 @@ export function getNoteMenu(props: { ] : [] ), + ...(appearNote.channel && (appearNote.channel.userId === $i.id || $i.isModerator || $i.isAdmin) ? [ + { type: 'divider' }, + { + type: 'parent' as const, + icon: 'ti ti-device-tv', + text: i18n.ts.channel, + children: async () => { + const channelChildMenu = [] as MenuItem[]; + + const channel = await os.api('channels/show', { channelId: appearNote.channel!.id }); + + if (channel.pinnedNoteIds.includes(appearNote.id)) { + channelChildMenu.push({ + icon: 'ti ti-pinned-off', + text: i18n.ts.unpin, + action: () => os.apiWithDialog('channels/update', { + channelId: appearNote.channel!.id, + pinnedNoteIds: channel.pinnedNoteIds.filter(id => id !== appearNote.id), + }), + }); + } else { + channelChildMenu.push({ + icon: 'ti ti-pin', + text: i18n.ts.pin, + action: () => os.apiWithDialog('channels/update', { + channelId: appearNote.channel!.id, + pinnedNoteIds: [...channel.pinnedNoteIds, appearNote.id], + }), + }); + } + return channelChildMenu; + }, + }, + ] + : [] + ), ...(appearNote.userId === $i.id || $i.isModerator || $i.isAdmin ? [ { type: 'divider' }, appearNote.userId === $i.id ? { diff --git a/packages/misskey-js/src/autogen/apiClientJSDoc.ts b/packages/misskey-js/src/autogen/apiClientJSDoc.ts index 758beaf3a..e8722cab3 100644 --- a/packages/misskey-js/src/autogen/apiClientJSDoc.ts +++ b/packages/misskey-js/src/autogen/apiClientJSDoc.ts @@ -1,6 +1,6 @@ /* - * version: 2023.12.0 - * generatedAt: 2023-12-26T23:35:09.494Z + * version: 2023.12.2 + * generatedAt: 2024-01-02T08:53:57.449Z */ import type { SwitchCaseResponseType } from '../api.js'; @@ -33,7 +33,6 @@ declare module '../api.js' { /** * No description provided. * - * **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties. * **Credential required**: *No* */ request( diff --git a/packages/misskey-js/src/autogen/endpoint.ts b/packages/misskey-js/src/autogen/endpoint.ts index 2ed76a22f..192a1a31e 100644 --- a/packages/misskey-js/src/autogen/endpoint.ts +++ b/packages/misskey-js/src/autogen/endpoint.ts @@ -1,6 +1,6 @@ /* - * version: 2023.12.0 - * generatedAt: 2023-12-26T23:35:09.491Z + * version: 2023.12.2 + * generatedAt: 2024-01-02T08:53:57.445Z */ import type { diff --git a/packages/misskey-js/src/autogen/entities.ts b/packages/misskey-js/src/autogen/entities.ts index c857e8e37..fd4d7372c 100644 --- a/packages/misskey-js/src/autogen/entities.ts +++ b/packages/misskey-js/src/autogen/entities.ts @@ -1,6 +1,6 @@ /* - * version: 2023.12.0 - * generatedAt: 2023-12-26T23:35:09.489Z + * version: 2023.12.2 + * generatedAt: 2024-01-02T08:53:57.443Z */ import { operations } from './types.js'; diff --git a/packages/misskey-js/src/autogen/models.ts b/packages/misskey-js/src/autogen/models.ts index c5b81a6b4..db0ada0f3 100644 --- a/packages/misskey-js/src/autogen/models.ts +++ b/packages/misskey-js/src/autogen/models.ts @@ -1,6 +1,6 @@ /* - * version: 2023.12.0 - * generatedAt: 2023-12-26T23:35:09.485Z + * version: 2023.12.2 + * generatedAt: 2024-01-02T08:53:57.441Z */ import { components } from './types.js'; diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index 94bb26398..37c8f58f5 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -2,8 +2,8 @@ /* eslint @typescript-eslint/no-explicit-any: 0 */ /* - * version: 2023.12.0 - * generatedAt: 2023-12-26T23:35:09.389Z + * version: 2023.12.2 + * generatedAt: 2024-01-02T08:53:56.447Z */ /** @@ -40,7 +40,6 @@ export type paths = { * admin/accounts/create * @description No description provided. * - * **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties. * **Credential required**: *No* */ post: operations['admin/accounts/create']; @@ -3788,13 +3787,14 @@ export type components = { * @example xxxxxxxxxx */ channelId?: string | null; - channel?: { + channel?: ({ id: string; name: string; color: string; isSensitive: boolean; allowRenoteToExternal: boolean; - } | null; + userId: string | null; + }) | null; localOnly?: boolean; reactionAcceptance: string | null; reactions: Record; @@ -4456,6 +4456,9 @@ export type operations = { enableActiveEmailValidation: boolean; enableVerifymailApi: boolean; verifymailAuthKey: string | null; + enableTruemailApi: boolean; + truemailInstance: string | null; + truemailAuthKey: string | null; enableChartsForRemoteUser: boolean; enableChartsForFederatedInstances: boolean; enableServerMachineStats: boolean; @@ -4620,7 +4623,6 @@ export type operations = { * admin/accounts/create * @description No description provided. * - * **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties. * **Credential required**: *No* */ 'admin/accounts/create': { @@ -8247,6 +8249,9 @@ export type operations = { enableActiveEmailValidation?: boolean; enableVerifymailApi?: boolean; verifymailAuthKey?: string | null; + enableTruemailApi?: boolean; + truemailInstance?: string | null; + truemailAuthKey?: string | null; enableChartsForRemoteUser?: boolean; enableChartsForFederatedInstances?: boolean; enableServerMachineStats?: boolean;