enhance(frontend): チャンネルノートのピン留めをノートメニューからできるように (#12887)

* enhance(frontend): チャンネルノートのピン留めをノートメニューからできるように

* Update Changelog
This commit is contained in:
かっこかり 2024-01-03 13:35:40 +09:00 committed by GitHub
parent 58469c0a69
commit a9127e3ecd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 61 additions and 15 deletions

View file

@ -16,6 +16,7 @@
### Client
- Enhance: ハッシュタグ入力時に、本文の末尾の行に何も書かれていない場合は新たにスペースを追加しないように
- Enhance: チャンネルノートのピン留めをノートのメニューからできるように
## 2023.12.2

View file

@ -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,

View file

@ -148,6 +148,10 @@ export const packedNoteSchema = {
type: 'boolean',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: true,
},
},
},
localOnly: {

View file

@ -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 ? {

View file

@ -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<E extends 'admin/accounts/create', P extends Endpoints[E]['req']>(

View file

@ -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 {

View file

@ -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';

View file

@ -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';

View file

@ -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<string, never>;
@ -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;