minor renaming.

pull/2170/head
warrickct 3 years ago
parent d627b8e11d
commit 11e6d80419

@ -124,18 +124,18 @@ export async function unblockConvoById(conversationId: string) {
* marks the conversation's approval fields, sends messageRequestResponse, syncs to linked devices
*/
export const acceptConversation = async (conversationId: string, syncToDevices: boolean = true) => {
const conversationToApprove = getConversationController().get(conversationId);
const convoToApprove = getConversationController().get(conversationId);
if (!conversationToApprove || conversationToApprove.isApproved()) {
if (!convoToApprove || convoToApprove.isApproved()) {
window?.log?.info('Conversation is already approved.');
return;
}
Promise.all([
await conversationToApprove.setIsApproved(true),
await conversationToApprove.setDidApproveMe(true),
await convoToApprove.setIsApproved(true),
await convoToApprove.setDidApproveMe(true),
]);
await conversationToApprove.sendMessageRequestResponse(true);
await convoToApprove.sendMessageRequestResponse(true);
// Conversation was not approved before so a sync is needed
if (syncToDevices) {

@ -148,8 +148,7 @@ const handleContactReceived = async (
await contactConvo.setIsApproved(Boolean(contactReceived.isApproved));
if (contactReceived.didApproveMe) {
await contactConvo.setDidApproveMe(Boolean(contactReceived.didApproveMe));
// TODO: add message search in convo for pre-existing msgRequestResponse msg only happens once per convo
// if source of the sync matches conversationId
contactConvo.addSingleMessage({
conversationId: contactConvo.get('id'),
@ -165,6 +164,7 @@ const handleContactReceived = async (
expireTimer: 0,
});
contactConvo.updateLastMessage();
await contactConvo.setDidApproveMe(Boolean(contactReceived.didApproveMe));
}
}

Loading…
Cancel
Save