refactor: update chat modifications to be uniform across MD + legacy

This commit is contained in:
Adhiraj Singh
2021-12-21 10:53:39 +05:30
parent 677f50baaa
commit c87d8b8129
5 changed files with 32 additions and 22 deletions

View File

@@ -27,9 +27,17 @@ export type Chat = Omit<proto.IConversation, 'messages'> & {
pin?: number | null
archive?: boolean
}
/**
* the last messages in a chat, sorted reverse-chronologically
* for MD modifications, the last message in the array must be the last message recv in the chat
* */
export type LastMessageList = Pick<proto.IWebMessageInfo, 'key' | 'messageTimestamp'>[]
export type ChatModification =
{ archive: boolean } |
{
archive: boolean
lastMessages: LastMessageList
} |
{
pin: boolean
} |
@@ -48,5 +56,6 @@ export type ChatModification =
} |
{
markRead: boolean
lastMessages: LastMessageList
} |
{ delete: true }