From 3998bbc97d4627d8f32a58d6448c42f5822c253f Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Fri, 16 Oct 2020 14:55:12 +1100 Subject: [PATCH] fix more typing errors of conversation object --- ts/components/conversation/Message.tsx | 5 ++-- ts/receiver/multidevice.ts | 2 +- ts/receiver/queuedJob.ts | 32 +++++++++++++++++--------- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/ts/components/conversation/Message.tsx b/ts/components/conversation/Message.tsx index 71f6420cd..eac5884c7 100644 --- a/ts/components/conversation/Message.tsx +++ b/ts/components/conversation/Message.tsx @@ -615,16 +615,15 @@ export class Message extends React.PureComponent { const { conversationType, direction, - i18n, quote, - text, isPublic, convoId, } = this.props; - if (!quote) { + if (!quote || !quote.authorPhoneNumber) { return null; } + // console.warn('quote render ' , quote) const withContentAbove = conversationType === 'group' && direction === 'incoming'; diff --git a/ts/receiver/multidevice.ts b/ts/receiver/multidevice.ts index cadc1ab05..6fab7fa41 100644 --- a/ts/receiver/multidevice.ts +++ b/ts/receiver/multidevice.ts @@ -437,7 +437,7 @@ async function onContactReceived(details: any) { } conversation.updateTextInputState(); - await conversation.trigger('change', conversation); + conversation.trigger('change', conversation); } catch (error) { window.log.error('onContactReceived error:', Errors.toLogFormat(error)); } diff --git a/ts/receiver/queuedJob.ts b/ts/receiver/queuedJob.ts index 52915e512..48026b6fd 100644 --- a/ts/receiver/queuedJob.ts +++ b/ts/receiver/queuedJob.ts @@ -207,7 +207,7 @@ async function copyFromQuotedMessage( } // Handle expiration timer as part of a regular message -function handleExpireTimer( +async function handleExpireTimer( source: string, message: MessageModel, expireTimer: number, @@ -219,7 +219,7 @@ function handleExpireTimer( message.set({ expireTimer }); if (expireTimer !== oldValue) { - conversation.updateExpirationTimer( + await conversation.updateExpirationTimer( expireTimer, source, message.get('received_at'), @@ -230,7 +230,7 @@ function handleExpireTimer( } } else if (oldValue && !message.isGroupUpdate()) { // We only turn off timers if it's not a group update - conversation.updateExpirationTimer( + await conversation.updateExpirationTimer( null, source, message.get('received_at'), @@ -262,7 +262,7 @@ function handleLinkPreviews( message.set({ preview }); } -function processProfileKey( +async function processProfileKey( source: string, conversation: ConversationModel, sendingDeviceConversation: ConversationModel, @@ -274,9 +274,9 @@ function processProfileKey( if (source === ourNumber) { conversation.set({ profileSharing: true }); } else if (conversation.isPrivate()) { - conversation.setProfileKey(profileKey); + await conversation.setProfileKey(profileKey); } else { - sendingDeviceConversation.setProfileKey(profileKey); + await sendingDeviceConversation.setProfileKey(profileKey); } } @@ -428,7 +428,12 @@ async function handleRegularMessage( conversation.updateTextInputState(); // Handle expireTimer found directly as part of a regular message - handleExpireTimer(source, message, dataMessage.expireTimer, conversation); + await handleExpireTimer( + source, + message, + dataMessage.expireTimer, + conversation + ); const ourPrimary = await MultiDeviceProtocol.getPrimaryDevice(ourNumber); @@ -459,7 +464,7 @@ async function handleRegularMessage( ); if (dataMessage.profileKey) { - processProfileKey( + await processProfileKey( source, conversation, sendingDeviceConversation, @@ -472,7 +477,7 @@ async function handleRegularMessage( } } -function handleExpirationTimerUpdate( +async function handleExpirationTimerUpdate( conversation: ConversationModel, message: MessageModel, source: string, @@ -494,7 +499,7 @@ function handleExpirationTimerUpdate( source: 'handleDataMessage', }); - conversation.updateExpirationTimer( + await conversation.updateExpirationTimer( expireTimer, source, message.get('received_at'), @@ -534,7 +539,12 @@ export async function handleMessageJob( ); return; } - handleExpirationTimerUpdate(conversation, message, source, expireTimer); + await handleExpirationTimerUpdate( + conversation, + message, + source, + expireTimer + ); } else { await handleRegularMessage( conversation,