enhance(backend): push notification for chat message

Resolve #15831
This commit is contained in:
syuilo 2025-04-15 18:27:45 +09:00
parent fff2783c1b
commit fc6037af46
7 changed files with 36 additions and 4 deletions

View file

@ -16,7 +16,7 @@ export const cli = new Misskey.api.APIClient({ origin, fetch: (...args): Promise
export async function api<
E extends keyof Misskey.Endpoints,
P extends Misskey.Endpoints[E]['req']
P extends Misskey.Endpoints[E]['req'],
>(endpoint: E, userId?: string, params?: P): Promise<Misskey.api.SwitchCaseResponseType<E, P> | undefined> {
let account: Pick<Misskey.entities.SignupResponse, 'id' | 'token'> | undefined;
@ -60,6 +60,14 @@ export function openAntenna(antennaId: string, loginId: string): ReturnType<type
return openClient('push', `/timeline/antenna/${antennaId}`, loginId, { antennaId });
}
export function openChat(body: any, loginId: string): ReturnType<typeof openClient> {
if (body.toRoomId != null) {
return openClient('push', `/chat/room/${body.toRoomId}`, loginId, { body });
} else {
return openClient('push', `/chat/user/${body.toUserId}`, loginId, { body });
}
}
// post-formのオプションから投稿フォームを開く
export async function openPost(options: { initialText?: string; reply?: Misskey.entities.Note; renote?: Misskey.entities.Note }, loginId?: string): ReturnType<typeof openClient> {
// クエリを作成しておく