wip
This commit is contained in:
		| @@ -248,11 +248,11 @@ export class ChatService { | |||||||
| 	public async readUserChatMessage( | 	public async readUserChatMessage( | ||||||
| 		readerId: MiUser['id'], | 		readerId: MiUser['id'], | ||||||
| 		senderId: MiUser['id'], | 		senderId: MiUser['id'], | ||||||
| 	) { | 	): Promise<void> { | ||||||
| 		const redisPipeline = this.redisClient.pipeline(); | 		const redisPipeline = this.redisClient.pipeline(); | ||||||
| 		redisPipeline.del(`newChatMessageExists:${readerId}:${senderId}`); | 		redisPipeline.del(`newChatMessageExists:${readerId}:${senderId}`); | ||||||
| 		redisPipeline.srem(`newChatMessagesExists:${readerId}`, `user:${senderId}`); | 		redisPipeline.srem(`newChatMessagesExists:${readerId}`, `user:${senderId}`); | ||||||
| 		redisPipeline.exec(); | 		await redisPipeline.exec(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	@bindThis | 	@bindThis | ||||||
| @@ -467,6 +467,7 @@ export class ChatService { | |||||||
|  |  | ||||||
| 	@bindThis | 	@bindThis | ||||||
| 	public async hasUnreadMessages(userId: MiUser['id']) { | 	public async hasUnreadMessages(userId: MiUser['id']) { | ||||||
| 		// TODO | 		const card = await this.redisClient.scard(`newChatMessagesExists:${userId}`); | ||||||
|  | 		return card > 0; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -74,6 +74,7 @@ export interface MainEventTypes { | |||||||
| 	unreadNotification: Packed<'Notification'>; | 	unreadNotification: Packed<'Notification'>; | ||||||
| 	readAllAntennas: undefined; | 	readAllAntennas: undefined; | ||||||
| 	unreadAntenna: MiAntenna; | 	unreadAntenna: MiAntenna; | ||||||
|  | 	newChatMessage: Packed<'ChatMessage'>; | ||||||
| 	readAllAnnouncements: undefined; | 	readAllAnnouncements: undefined; | ||||||
| 	myTokenRegenerated: undefined; | 	myTokenRegenerated: undefined; | ||||||
| 	signin: { | 	signin: { | ||||||
|   | |||||||
| @@ -545,6 +545,10 @@ export const packedMeDetailedOnlySchema = { | |||||||
| 			type: 'boolean', | 			type: 'boolean', | ||||||
| 			nullable: false, optional: false, | 			nullable: false, optional: false, | ||||||
| 		}, | 		}, | ||||||
|  | 		hasUnreadChatMessages: { | ||||||
|  | 			type: 'boolean', | ||||||
|  | 			nullable: false, optional: false, | ||||||
|  | 		}, | ||||||
| 		hasUnreadNotification: { | 		hasUnreadNotification: { | ||||||
| 			type: 'boolean', | 			type: 'boolean', | ||||||
| 			nullable: false, optional: false, | 			nullable: false, optional: false, | ||||||
|   | |||||||
| @@ -133,6 +133,7 @@ describe('ユーザー', () => { | |||||||
| 			hasUnreadAnnouncement: user.hasUnreadAnnouncement, | 			hasUnreadAnnouncement: user.hasUnreadAnnouncement, | ||||||
| 			hasUnreadAntenna: user.hasUnreadAntenna, | 			hasUnreadAntenna: user.hasUnreadAntenna, | ||||||
| 			hasUnreadChannel: user.hasUnreadChannel, | 			hasUnreadChannel: user.hasUnreadChannel, | ||||||
|  | 			hasUnreadChatMessages: user.hasUnreadChatMessages, | ||||||
| 			hasUnreadNotification: user.hasUnreadNotification, | 			hasUnreadNotification: user.hasUnreadNotification, | ||||||
| 			unreadNotificationsCount: user.unreadNotificationsCount, | 			unreadNotificationsCount: user.unreadNotificationsCount, | ||||||
| 			hasPendingReceivedFollowRequest: user.hasPendingReceivedFollowRequest, | 			hasPendingReceivedFollowRequest: user.hasPendingReceivedFollowRequest, | ||||||
| @@ -371,6 +372,7 @@ describe('ユーザー', () => { | |||||||
| 		assert.strictEqual(response.hasUnreadAnnouncement, false); | 		assert.strictEqual(response.hasUnreadAnnouncement, false); | ||||||
| 		assert.strictEqual(response.hasUnreadAntenna, false); | 		assert.strictEqual(response.hasUnreadAntenna, false); | ||||||
| 		assert.strictEqual(response.hasUnreadChannel, false); | 		assert.strictEqual(response.hasUnreadChannel, false); | ||||||
|  | 		assert.strictEqual(response.hasUnreadChatMessages, false); | ||||||
| 		assert.strictEqual(response.hasUnreadNotification, false); | 		assert.strictEqual(response.hasUnreadNotification, false); | ||||||
| 		assert.strictEqual(response.unreadNotificationsCount, 0); | 		assert.strictEqual(response.unreadNotificationsCount, 0); | ||||||
| 		assert.strictEqual(response.hasPendingReceivedFollowRequest, false); | 		assert.strictEqual(response.hasPendingReceivedFollowRequest, false); | ||||||
|   | |||||||
| @@ -511,6 +511,11 @@ export async function mainBoot() { | |||||||
| 			sound.playMisskeySfx('antenna'); | 			sound.playMisskeySfx('antenna'); | ||||||
| 		}); | 		}); | ||||||
|  |  | ||||||
|  | 		main.on('newChatMessage', () => { | ||||||
|  | 			updateCurrentAccountPartial({ hasUnreadChatMessages: true }); | ||||||
|  | 			sound.playMisskeySfx('chat'); | ||||||
|  | 		}); | ||||||
|  |  | ||||||
| 		main.on('readAllAnnouncements', () => { | 		main.on('readAllAnnouncements', () => { | ||||||
| 			updateCurrentAccountPartial({ hasUnreadAnnouncement: false }); | 			updateCurrentAccountPartial({ hasUnreadAnnouncement: false }); | ||||||
| 		}); | 		}); | ||||||
|   | |||||||
| @@ -114,6 +114,7 @@ export const navbarItemDef = reactive({ | |||||||
| 		title: i18n.ts.chat, | 		title: i18n.ts.chat, | ||||||
| 		icon: 'ti ti-message', | 		icon: 'ti ti-message', | ||||||
| 		to: '/chat', | 		to: '/chat', | ||||||
|  | 		indicated: computed(() => $i != null && $i.hasUnreadChatMessages), | ||||||
| 	}, | 	}, | ||||||
| 	achievements: { | 	achievements: { | ||||||
| 		title: i18n.ts.achievements, | 		title: i18n.ts.achievements, | ||||||
|   | |||||||
| @@ -626,6 +626,7 @@ export type Channels = { | |||||||
|             readAllUnreadSpecifiedNotes: () => void; |             readAllUnreadSpecifiedNotes: () => void; | ||||||
|             readAllAntennas: () => void; |             readAllAntennas: () => void; | ||||||
|             unreadAntenna: (payload: Antenna) => void; |             unreadAntenna: (payload: Antenna) => void; | ||||||
|  |             newChatMessage: (payload: ChatMessage) => void; | ||||||
|             readAllAnnouncements: () => void; |             readAllAnnouncements: () => void; | ||||||
|             myTokenRegenerated: () => void; |             myTokenRegenerated: () => void; | ||||||
|             signin: (payload: Signin) => void; |             signin: (payload: Signin) => void; | ||||||
| @@ -3480,8 +3481,8 @@ type V2AdminEmojiListResponse = operations['v2___admin___emoji___list']['respons | |||||||
| // | // | ||||||
| // src/entities.ts:50:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts | // src/entities.ts:50:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts | ||||||
| // src/streaming.ts:57:3 - (ae-forgotten-export) The symbol "ReconnectingWebSocket" needs to be exported by the entry point index.d.ts | // src/streaming.ts:57:3 - (ae-forgotten-export) The symbol "ReconnectingWebSocket" needs to be exported by the entry point index.d.ts | ||||||
| // src/streaming.types.ts:220:4 - (ae-forgotten-export) The symbol "ReversiUpdateKey" needs to be exported by the entry point index.d.ts | // src/streaming.types.ts:222:4 - (ae-forgotten-export) The symbol "ReversiUpdateKey" needs to be exported by the entry point index.d.ts | ||||||
| // src/streaming.types.ts:230:4 - (ae-forgotten-export) The symbol "ReversiUpdateSettings" needs to be exported by the entry point index.d.ts | // src/streaming.types.ts:232:4 - (ae-forgotten-export) The symbol "ReversiUpdateSettings" needs to be exported by the entry point index.d.ts | ||||||
|  |  | ||||||
| // (No @packageDocumentation comment for this package) | // (No @packageDocumentation comment for this package) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3914,6 +3914,7 @@ export type components = { | |||||||
|       unreadAnnouncements: components['schemas']['Announcement'][]; |       unreadAnnouncements: components['schemas']['Announcement'][]; | ||||||
|       hasUnreadAntenna: boolean; |       hasUnreadAntenna: boolean; | ||||||
|       hasUnreadChannel: boolean; |       hasUnreadChannel: boolean; | ||||||
|  |       hasUnreadChatMessages: boolean; | ||||||
|       hasUnreadNotification: boolean; |       hasUnreadNotification: boolean; | ||||||
|       hasPendingReceivedFollowRequest: boolean; |       hasPendingReceivedFollowRequest: boolean; | ||||||
|       unreadNotificationsCount: number; |       unreadNotificationsCount: number; | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| import { | import { | ||||||
| 	Antenna, | 	Antenna, | ||||||
|  | 	ChatMessage, | ||||||
| 	DriveFile, | 	DriveFile, | ||||||
| 	DriveFolder, | 	DriveFolder, | ||||||
| 	Note, | 	Note, | ||||||
| @@ -53,6 +54,7 @@ export type Channels = { | |||||||
| 			readAllUnreadSpecifiedNotes: () => void; | 			readAllUnreadSpecifiedNotes: () => void; | ||||||
| 			readAllAntennas: () => void; | 			readAllAntennas: () => void; | ||||||
| 			unreadAntenna: (payload: Antenna) => void; | 			unreadAntenna: (payload: Antenna) => void; | ||||||
|  | 			newChatMessage: (payload: ChatMessage) => void; | ||||||
| 			readAllAnnouncements: () => void; | 			readAllAnnouncements: () => void; | ||||||
| 			myTokenRegenerated: () => void; | 			myTokenRegenerated: () => void; | ||||||
| 			signin: (payload: Signin) => void; | 			signin: (payload: Signin) => void; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 syuilo
					syuilo