Additional PR changes

This commit is contained in:
warrickct 2022-02-15 15:00:23 +11:00
parent efa482b002
commit abc188e889
4 changed files with 7 additions and 19 deletions

View File

@ -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';

View File

@ -1493,7 +1493,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
}
}
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

View File

@ -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,
},

View File

@ -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,
},