diff --git a/ts/components/conversation/ConversationRequestButtons.tsx b/ts/components/conversation/ConversationRequestButtons.tsx index d0115f0d0..f31a40338 100644 --- a/ts/components/conversation/ConversationRequestButtons.tsx +++ b/ts/components/conversation/ConversationRequestButtons.tsx @@ -7,7 +7,6 @@ import { declineConversation, } from '../../interactions/conversationInteractions'; import { forceSyncConfigurationNowIfNeeded } from '../../session/utils/syncUtils'; -import { ReduxConversationType } from '../../state/ducks/conversations'; import { updateConfirmModal } from '../../state/ducks/modalDialog'; import { getSelectedConversation } from '../../state/selectors/conversations'; import { SessionButton, SessionButtonColor, SessionButtonType } from '../basic/SessionButton'; diff --git a/ts/models/conversation.ts b/ts/models/conversation.ts index e7ff7943d..7df5f5e5c 100644 --- a/ts/models/conversation.ts +++ b/ts/models/conversation.ts @@ -1493,7 +1493,7 @@ export class ConversationModel extends Backbone.Model { } } - public async addSingleMessage(messageAttributes: MessageAttributesOptionals) { + private async addSingleMessage(messageAttributes: MessageAttributesOptionals) { const model = new MessageModel(messageAttributes); // no need to trigger a UI update now, we trigger a messagesAdded just below diff --git a/ts/receiver/configMessage.ts b/ts/receiver/configMessage.ts index 60d7dc43f..0c70c1a5a 100644 --- a/ts/receiver/configMessage.ts +++ b/ts/receiver/configMessage.ts @@ -146,13 +146,8 @@ const handleContactReceived = async ( if (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 - await contactConvo.addSingleMessage({ - conversationId: contactConvo.get('id'), - source: envelope.source, - type: 'outgoing', // mark it as outgoing just so it appears below our sent attachment - sent_at: _.toNumber(envelope.timestamp), // TODO: maybe add timestamp to messageRequestResponse? confirm it doesn't exist first - received_at: Date.now(), + await contactConvo.addSingleOutgoingMessage({ + sent_at: _.toNumber(envelope.timestamp), messageRequestResponse: { isApproved: 1, }, diff --git a/ts/receiver/contentMessage.ts b/ts/receiver/contentMessage.ts index 3914e0ed2..650fcda30 100644 --- a/ts/receiver/contentMessage.ts +++ b/ts/receiver/contentMessage.ts @@ -389,12 +389,9 @@ export async function innerHandleSwarmContentMessage( if (!convo.didApproveMe() && convo.isPrivate() && convo.isApproved()) { await convo.setDidApproveMe(true); // Conversation was not approved before so a sync is needed - await convo.addSingleMessage({ - conversationId: convo.get('id'), + await convo.addSingleIncomingMessage({ + sent_at: _.toNumber(envelope.timestamp), source: envelope.source, - type: 'outgoing', // mark it as outgoing just so it appears below our sent attachment - sent_at: _.toNumber(envelope.timestamp), // TODO: maybe add timestamp to messageRequestResponse? confirm it doesn't exist first - received_at: Date.now(), messageRequestResponse: { isApproved: 1, }, @@ -609,12 +606,9 @@ async function handleMessageRequestResponse( await conversationToApprove.setDidApproveMe(isApproved); if (isApproved === true) { // Conversation was not approved before so a sync is needed - await conversationToApprove.addSingleMessage({ - conversationId: conversationToApprove.get('id'), - source: envelope.source, - type: 'outgoing', // mark it as outgoing just so it appears below our sent attachment + await conversationToApprove.addSingleIncomingMessage({ sent_at: _.toNumber(envelope.timestamp), // TODO: maybe add timestamp to messageRequestResponse? confirm it doesn't exist first - received_at: Date.now(), + source: envelope.source, messageRequestResponse: { isApproved: 1, },