Message Send Log to enable comprehensive resend

This commit is contained in:
Scott Nonnenberg 2021-07-15 16:48:09 -07:00 committed by GitHub
parent 0fe68b57b1
commit a42c41ed01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 3154 additions and 1266 deletions

View file

@ -7,9 +7,18 @@ import { getSendOptions } from './getSendOptions';
import { handleMessageSend } from './handleMessageSend';
import { isConversationAccepted } from './isConversationAccepted';
type ReceiptSpecType = {
messageId: string;
senderE164?: string;
senderUuid?: string;
senderId?: string;
timestamp: number;
hasErrors: boolean;
};
export async function sendReadReceiptsFor(
conversationAttrs: ConversationAttributesType,
items: Array<unknown>
items: Array<ReceiptSpecType>
): Promise<void> {
// Only send read receipts for accepted conversations
if (
@ -22,7 +31,8 @@ export async function sendReadReceiptsFor(
await Promise.all(
map(receiptsBySender, async (receipts, senderId) => {
const timestamps = map(receipts, 'timestamp');
const timestamps = map(receipts, item => item.timestamp);
const messageIds = map(receipts, item => item.messageId);
const conversation = window.ConversationController.get(senderId);
if (conversation) {
@ -34,7 +44,8 @@ export async function sendReadReceiptsFor(
senderUuid: conversation.get('uuid')!,
timestamps,
options: sendOptions,
})
}),
{ messageIds, sendType: 'readReceipt' }
);
}
})