fix: 通知インジケータが光りっぱなしになる問題を修正 (#10483)

* fix(misskey-js): ストリームがstringで送信される場合があるのを修正

* pnpm run api

* force read notification

* fix competition
This commit is contained in:
tamaina 2023-04-06 06:11:59 +09:00 committed by GitHub
parent 712c60106a
commit 2650a7a5b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 22 deletions

View file

@ -166,8 +166,6 @@ export type Channels = {
readAllAntennas: () => void;
unreadAntenna: (payload: Antenna) => void;
readAllAnnouncements: () => void;
readAllChannels: () => void;
unreadChannel: (payload: Note['id']) => void;
myTokenRegenerated: () => void;
reversiNoInvites: () => void;
reversiInvited: (payload: FIXME) => void;
@ -1857,12 +1855,6 @@ export type Endpoints = {
req: NoParams;
res: null;
};
'notifications/read': {
req: {
notificationId: Notification_2['id'];
};
res: null;
};
'page-push': {
req: {
pageId: Page['id'];
@ -2361,7 +2353,6 @@ type MeDetailed = UserDetailed & {
hasPendingReceivedFollowRequest: boolean;
hasUnreadAnnouncement: boolean;
hasUnreadAntenna: boolean;
hasUnreadChannel: boolean;
hasUnreadMentions: boolean;
hasUnreadMessagingMessage: boolean;
hasUnreadNotification: boolean;
@ -2618,7 +2609,11 @@ export class Stream extends EventEmitter<StreamEvents> {
// (undocumented)
removeSharedConnectionPool(pool: Pool): void;
// (undocumented)
send(typeOrPayload: any, payload?: any): void;
send(typeOrPayload: string): void;
// (undocumented)
send(typeOrPayload: string, payload: any): void;
// (undocumented)
send(typeOrPayload: Record<string, any> | any[]): void;
// (undocumented)
state: 'initializing' | 'reconnecting' | 'connected';
// (undocumented)
@ -2714,8 +2709,8 @@ type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+u
//
// src/api.types.ts:16:32 - (ae-forgotten-export) The symbol "TODO" needs to be exported by the entry point index.d.ts
// src/api.types.ts:18:25 - (ae-forgotten-export) The symbol "NoParams" needs to be exported by the entry point index.d.ts
// src/api.types.ts:595:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
// src/streaming.types.ts:35:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts
// src/api.types.ts:594:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
// src/streaming.types.ts:33:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts
// (No @packageDocumentation comment for this package)

View file

@ -169,14 +169,21 @@ export default class Stream extends EventEmitter<StreamEvents> {
/**
* Send a message to connection
* ! JSONで行われます !
*/
public send(typeOrPayload: any, payload?: any): void {
const data = payload === undefined ? typeOrPayload : {
type: typeOrPayload,
body: payload,
};
public send(typeOrPayload: string): void
public send(typeOrPayload: string, payload: any): void
public send(typeOrPayload: Record<string, any> | any[]): void
public send(typeOrPayload: string | Record<string, any> | any[], payload?: any): void {
if (typeof typeOrPayload === 'string') {
this.stream.send(JSON.stringify({
type: typeOrPayload,
...(payload === undefined ? {} : { body: payload }),
}));
return;
}
this.stream.send(JSON.stringify(data));
this.stream.send(JSON.stringify(typeOrPayload));
}
/**