|
|
@ -251,8 +251,6 @@ async function handleRegularMessage(
|
|
|
|
if (type === 'incoming') {
|
|
|
|
if (type === 'incoming') {
|
|
|
|
updateReadStatus(message, conversation);
|
|
|
|
updateReadStatus(message, conversation);
|
|
|
|
if (conversation.isPrivate()) {
|
|
|
|
if (conversation.isPrivate()) {
|
|
|
|
await conversation.setDidApproveMe(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const incomingMessageCount = await getMessageCountByType(
|
|
|
|
const incomingMessageCount = await getMessageCountByType(
|
|
|
|
conversation.id,
|
|
|
|
conversation.id,
|
|
|
|
MessageDirection.incoming
|
|
|
|
MessageDirection.incoming
|
|
|
@ -267,14 +265,16 @@ async function handleRegularMessage(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// For edge case when messaging a client that's unable to explicitly send request approvals
|
|
|
|
// For edge case when messaging a client that's unable to explicitly send request approvals
|
|
|
|
if (!conversation.didApproveMe() && conversation.isPrivate() && conversation.isApproved()) {
|
|
|
|
if (conversation.isOutgoingRequest()) {
|
|
|
|
await conversation.setDidApproveMe(true);
|
|
|
|
|
|
|
|
// Conversation was not approved before so a sync is needed
|
|
|
|
// Conversation was not approved before so a sync is needed
|
|
|
|
await conversation.addIncomingApprovalMessage(
|
|
|
|
await conversation.addIncomingApprovalMessage(
|
|
|
|
_.toNumber(message.get('sent_at')) - 1,
|
|
|
|
_.toNumber(message.get('sent_at')) - 1,
|
|
|
|
source
|
|
|
|
source
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// should only occur after isOutgoing request as it relies on didApproveMe being false.
|
|
|
|
|
|
|
|
await conversation.setDidApproveMe(true);
|
|
|
|
|
|
|
|
// edge case end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|