Fix send sync message bugs
This commit is contained in:
parent
4b92e12f83
commit
8449f343a6
3 changed files with 59 additions and 59 deletions
|
@ -3212,7 +3212,7 @@ export async function startApp(): Promise<void> {
|
||||||
return {
|
return {
|
||||||
...result,
|
...result,
|
||||||
[conversationId]: {
|
[conversationId]: {
|
||||||
status: SendStatus.Pending,
|
status: SendStatus.Sent,
|
||||||
updatedAt: timestamp,
|
updatedAt: timestamp,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,7 +13,11 @@ import { isOutgoing } from '../state/selectors/message';
|
||||||
import { isDirectConversation } from '../util/whatTypeOfConversation';
|
import { isDirectConversation } from '../util/whatTypeOfConversation';
|
||||||
import { getOwn } from '../util/getOwn';
|
import { getOwn } from '../util/getOwn';
|
||||||
import { missingCaseError } from '../util/missingCaseError';
|
import { missingCaseError } from '../util/missingCaseError';
|
||||||
import { SendActionType, sendStateReducer } from '../messages/MessageSendState';
|
import {
|
||||||
|
SendActionType,
|
||||||
|
SendStatus,
|
||||||
|
sendStateReducer,
|
||||||
|
} from '../messages/MessageSendState';
|
||||||
import dataInterface from '../sql/Client';
|
import dataInterface from '../sql/Client';
|
||||||
|
|
||||||
const { deleteSentProtoRecipient } = dataInterface;
|
const { deleteSentProtoRecipient } = dataInterface;
|
||||||
|
@ -107,7 +111,7 @@ export class MessageReceipts extends Collection<MessageReceiptModel> {
|
||||||
ids.includes(receipt.get('sourceConversationId'))
|
ids.includes(receipt.get('sourceConversationId'))
|
||||||
);
|
);
|
||||||
if (receipts.length) {
|
if (receipts.length) {
|
||||||
window.log.info('Found early read receipts for message');
|
window.log.info('Found early receipts for message');
|
||||||
this.remove(receipts);
|
this.remove(receipts);
|
||||||
}
|
}
|
||||||
return receipts;
|
return receipts;
|
||||||
|
@ -142,8 +146,8 @@ export class MessageReceipts extends Collection<MessageReceiptModel> {
|
||||||
const oldSendState = getOwn(
|
const oldSendState = getOwn(
|
||||||
oldSendStateByConversationId,
|
oldSendStateByConversationId,
|
||||||
sourceConversationId
|
sourceConversationId
|
||||||
);
|
) ?? { status: SendStatus.Sent, updatedAt: undefined };
|
||||||
if (oldSendState) {
|
|
||||||
let sendActionType: SendActionType;
|
let sendActionType: SendActionType;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MessageReceiptType.Delivery:
|
case MessageReceiptType.Delivery:
|
||||||
|
@ -185,15 +189,6 @@ export class MessageReceipts extends Collection<MessageReceiptModel> {
|
||||||
updateLeftPane();
|
updateLeftPane();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
window.log.warn(
|
|
||||||
`Got a receipt from someone (${sourceConversationId}), but the message (sent at ${message.get(
|
|
||||||
'sent_at'
|
|
||||||
)}) wasn't sent to them. It was sent to ${
|
|
||||||
Object.keys(oldSendStateByConversationId).length
|
|
||||||
} recipients`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(type === MessageReceiptType.Delivery &&
|
(type === MessageReceiptType.Delivery &&
|
||||||
|
|
|
@ -2579,20 +2579,25 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updatedAt: number = isNormalNumber(data.timestamp)
|
||||||
|
? data.timestamp
|
||||||
|
: Date.now();
|
||||||
|
|
||||||
const previousSendState = getOwn(
|
const previousSendState = getOwn(
|
||||||
sendStateByConversationId,
|
sendStateByConversationId,
|
||||||
destinationConversationId
|
destinationConversationId
|
||||||
);
|
);
|
||||||
if (previousSendState) {
|
|
||||||
sendStateByConversationId[
|
sendStateByConversationId[
|
||||||
destinationConversationId
|
destinationConversationId
|
||||||
] = sendStateReducer(previousSendState, {
|
] = previousSendState
|
||||||
|
? sendStateReducer(previousSendState, {
|
||||||
type: SendActionType.Sent,
|
type: SendActionType.Sent,
|
||||||
updatedAt: isNormalNumber(data.timestamp)
|
updatedAt,
|
||||||
? data.timestamp
|
})
|
||||||
: Date.now(),
|
: {
|
||||||
});
|
status: SendStatus.Sent,
|
||||||
}
|
updatedAt,
|
||||||
|
};
|
||||||
|
|
||||||
if (unidentified) {
|
if (unidentified) {
|
||||||
unidentifiedDeliveriesSet.add(identifier);
|
unidentifiedDeliveriesSet.add(identifier);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue