fix: チャット周りの修正 (#15741)

* fix(misskey-js): チャットのChannel型定義を追加

* fix(backend); canChatで塞いでいない書き込み系のAPIを塞ぐ

* fix(frontend): チャット周りのフロントエンド型修正

* lint fix

* fix broken lockfile

* fix

* refactor

* wip

* wip

* wip

* clean up

---------

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
かっこかり 2025-04-03 15:28:10 +09:00 committed by GitHub
parent 7cecaa5c54
commit e07bb1dcbc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 453 additions and 153 deletions

View file

@ -56,6 +56,8 @@ export type SystemWebhook = components['schemas']['SystemWebhook'];
export type AbuseReportNotificationRecipient = components['schemas']['AbuseReportNotificationRecipient'];
export type ChatMessage = components['schemas']['ChatMessage'];
export type ChatMessageLite = components['schemas']['ChatMessageLite'];
export type ChatMessageLiteFor1on1 = components['schemas']['ChatMessageLiteFor1on1'];
export type ChatMessageLiteForRoom = components['schemas']['ChatMessageLiteForRoom'];
export type ChatRoom = components['schemas']['ChatRoom'];
export type ChatRoomInvitation = components['schemas']['ChatRoomInvitation'];
export type ChatRoomMembership = components['schemas']['ChatRoomMembership'];

View file

@ -5406,10 +5406,10 @@ export type components = {
fileId?: string | null;
file?: components['schemas']['DriveFile'] | null;
isRead?: boolean;
reactions: ({
reactions: {
reaction: string;
user?: components['schemas']['UserLite'] | null;
})[];
user: components['schemas']['UserLite'];
}[];
};
ChatMessageLite: {
id: string;
@ -5427,6 +5427,34 @@ export type components = {
user?: components['schemas']['UserLite'] | null;
})[];
};
ChatMessageLiteFor1on1: {
id: string;
/** Format: date-time */
createdAt: string;
fromUserId: string;
toUserId: string;
text?: string | null;
fileId?: string | null;
file?: components['schemas']['DriveFile'] | null;
reactions: {
reaction: string;
}[];
};
ChatMessageLiteForRoom: {
id: string;
/** Format: date-time */
createdAt: string;
fromUserId: string;
fromUser: components['schemas']['UserLite'];
toRoomId: string;
text?: string | null;
fileId?: string | null;
file?: components['schemas']['DriveFile'] | null;
reactions: {
reaction: string;
user: components['schemas']['UserLite'];
}[];
};
ChatRoom: {
id: string;
/** Format: date-time */
@ -14067,7 +14095,7 @@ export type operations = {
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['ChatMessageLite'];
'application/json': components['schemas']['ChatMessageLiteForRoom'];
};
};
/** @description Client error */
@ -14130,7 +14158,7 @@ export type operations = {
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['ChatMessageLite'];
'application/json': components['schemas']['ChatMessageLiteFor1on1'];
};
};
/** @description Client error */
@ -14305,7 +14333,7 @@ export type operations = {
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['ChatMessageLite'][];
'application/json': components['schemas']['ChatMessageLiteForRoom'][];
};
};
/** @description Client error */
@ -14533,7 +14561,7 @@ export type operations = {
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['ChatMessageLite'][];
'application/json': components['schemas']['ChatMessageLiteFor1on1'][];
};
};
/** @description Client error */

View file

@ -1,6 +1,7 @@
import {
Antenna,
ChatMessage,
ChatMessageLite,
DriveFile,
DriveFolder,
Note,
@ -227,7 +228,55 @@ export type Channels = {
updateSettings: ReversiUpdateSettings<ReversiUpdateKey>;
claimTimeIsUp: null | Record<string, never>;
}
}
};
chatUser: {
params: {
otherId: string;
};
events: {
message: (payload: ChatMessageLite) => void;
deleted: (payload: ChatMessageLite['id']) => void;
react: (payload: {
reaction: string;
user?: UserLite;
messageId: ChatMessageLite['id'];
}) => void;
unreact: (payload: {
reaction: string;
user?: UserLite;
messageId: ChatMessageLite['id'];
}) => void;
};
receives: {
read: {
id: ChatMessageLite['id'];
};
};
};
chatRoom: {
params: {
roomId: string;
};
events: {
message: (payload: ChatMessageLite) => void;
deleted: (payload: ChatMessageLite['id']) => void;
react: (payload: {
reaction: string;
user?: UserLite;
messageId: ChatMessageLite['id'];
}) => void;
unreact: (payload: {
reaction: string;
user?: UserLite;
messageId: ChatMessageLite['id'];
}) => void;
};
receives: {
read: {
id: ChatMessageLite['id'];
};
};
};
};
export type NoteUpdatedEvent = { id: Note['id'] } & ({