be sure to register outgoing message for medium groups when created

pull/1381/head
Audric Ackermann 5 years ago
parent 184b1984c3
commit 727261b36a
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -2,6 +2,8 @@ import React from 'react';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { getMessageQueue } from '../../session'; import { getMessageQueue } from '../../session';
import { OpenGroupMessage } from '../../session/messages/outgoing';
import { RawMessage } from '../../session/types';
import { createStore } from '../../state/createStore'; import { createStore } from '../../state/createStore';
import { actions as conversationActions } from '../../state/ducks/conversations'; import { actions as conversationActions } from '../../state/ducks/conversations';
import { actions as userActions } from '../../state/ducks/user'; import { actions as userActions } from '../../state/ducks/user';
@ -117,7 +119,7 @@ export class SessionInboxView extends React.Component<Props, State> {
); );
} }
private async fetchHandleMessageSentData(m: any) { private async fetchHandleMessageSentData(m: RawMessage | OpenGroupMessage) {
// nobody is listening to this freshly fetched message .trigger calls // nobody is listening to this freshly fetched message .trigger calls
const tmpMsg = await window.Signal.Data.getMessageById(m.identifier, { const tmpMsg = await window.Signal.Data.getMessageById(m.identifier, {
Message: window.Whisper.Message, Message: window.Whisper.Message,
@ -146,7 +148,7 @@ export class SessionInboxView extends React.Component<Props, State> {
} }
private async handleMessageSentSuccess( private async handleMessageSentSuccess(
sentMessage: any, sentMessage: RawMessage | OpenGroupMessage,
wrappedEnvelope: any wrappedEnvelope: any
) { ) {
const fetchedData = await this.fetchHandleMessageSentData(sentMessage); const fetchedData = await this.fetchHandleMessageSentData(sentMessage);
@ -155,10 +157,12 @@ export class SessionInboxView extends React.Component<Props, State> {
} }
const { msg } = fetchedData; const { msg } = fetchedData;
msg.handleMessageSentSuccess(sentMessage, wrappedEnvelope); void msg.handleMessageSentSuccess(sentMessage, wrappedEnvelope);
} }
private async handleMessageSentFailure(sentMessage: any, error: any) { private async handleMessageSentFailure(
sentMessage: RawMessage | OpenGroupMessage,
error: any) {
const fetchedData = await this.fetchHandleMessageSentData(sentMessage); const fetchedData = await this.fetchHandleMessageSentData(sentMessage);
if (!fetchedData) { if (!fetchedData) {
return; return;

@ -117,6 +117,8 @@ export async function createMediumGroup(
}; };
const dbMessage = await addUpdateMessage(convo, groupDiff, 'outgoing'); const dbMessage = await addUpdateMessage(convo, groupDiff, 'outgoing');
window.MessageController.register(dbMessage.id, dbMessage);
// be sure to call this before sending the message. // be sure to call this before sending the message.
// the sending pipeline needs to know from GroupUtils when a message is for a medium group // the sending pipeline needs to know from GroupUtils when a message is for a medium group
@ -175,6 +177,7 @@ export async function createLegacyGroup(
}; };
const dbMessage = await addUpdateMessage(convo, diff, 'outgoing'); const dbMessage = await addUpdateMessage(convo, diff, 'outgoing');
window.MessageController.register(dbMessage.id, dbMessage);
await sendGroupUpdate(convo, diff, groupDetails, dbMessage.id); await sendGroupUpdate(convo, diff, groupDetails, dbMessage.id);
@ -214,6 +217,7 @@ export async function leaveMediumGroup(groupId: string) {
sent_at: now, sent_at: now,
received_at: now, received_at: now,
}); });
window.MessageController.register(dbMessage.id, dbMessage);
const ourPrimary = await UserUtil.getPrimary(); const ourPrimary = await UserUtil.getPrimary();
const members = convo.get('members').filter(m => m !== ourPrimary.key); const members = convo.get('members').filter(m => m !== ourPrimary.key);
@ -407,6 +411,7 @@ export async function initiateGroupUpdate(
} }
const dbMessage = await addUpdateMessage(convo, diff, 'outgoing'); const dbMessage = await addUpdateMessage(convo, diff, 'outgoing');
window.MessageController.register(dbMessage.id, dbMessage);
await sendGroupUpdate(convo, diff, updateObj, dbMessage.id); await sendGroupUpdate(convo, diff, updateObj, dbMessage.id);
} }

@ -2,14 +2,14 @@ import { EncryptionType } from './EncryptionType';
// TODO: Should we store failure count on raw messages?? // TODO: Should we store failure count on raw messages??
// Might be better to have a seperate interface which takes in a raw message aswell as a failure count // Might be better to have a seperate interface which takes in a raw message aswell as a failure count
export interface RawMessage { export type RawMessage = {
identifier: string; identifier: string;
plainTextBuffer: Uint8Array; plainTextBuffer: Uint8Array;
timestamp: number; timestamp: number;
device: string; device: string;
ttl: number; ttl: number;
encryption: EncryptionType; encryption: EncryptionType;
} };
// For building RawMessages from JSON // For building RawMessages from JSON
export interface PartialRawMessage { export interface PartialRawMessage {

Loading…
Cancel
Save