mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
be sure to register outgoing message for medium groups when created
This commit is contained in:
parent
184b1984c3
commit
727261b36a
|
@ -2,6 +2,8 @@ import React from 'react';
|
|||
import { Provider } from 'react-redux';
|
||||
import { bindActionCreators } from 'redux';
|
||||
import { getMessageQueue } from '../../session';
|
||||
import { OpenGroupMessage } from '../../session/messages/outgoing';
|
||||
import { RawMessage } from '../../session/types';
|
||||
import { createStore } from '../../state/createStore';
|
||||
import { actions as conversationActions } from '../../state/ducks/conversations';
|
||||
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
|
||||
const tmpMsg = await window.Signal.Data.getMessageById(m.identifier, {
|
||||
Message: window.Whisper.Message,
|
||||
|
@ -146,7 +148,7 @@ export class SessionInboxView extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
private async handleMessageSentSuccess(
|
||||
sentMessage: any,
|
||||
sentMessage: RawMessage | OpenGroupMessage,
|
||||
wrappedEnvelope: any
|
||||
) {
|
||||
const fetchedData = await this.fetchHandleMessageSentData(sentMessage);
|
||||
|
@ -155,10 +157,12 @@ export class SessionInboxView extends React.Component<Props, State> {
|
|||
}
|
||||
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);
|
||||
if (!fetchedData) {
|
||||
return;
|
||||
|
|
|
@ -117,6 +117,8 @@ export async function createMediumGroup(
|
|||
};
|
||||
|
||||
const dbMessage = await addUpdateMessage(convo, groupDiff, 'outgoing');
|
||||
window.MessageController.register(dbMessage.id, dbMessage);
|
||||
|
||||
|
||||
// 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
|
||||
|
@ -175,6 +177,7 @@ export async function createLegacyGroup(
|
|||
};
|
||||
|
||||
const dbMessage = await addUpdateMessage(convo, diff, 'outgoing');
|
||||
window.MessageController.register(dbMessage.id, dbMessage);
|
||||
|
||||
await sendGroupUpdate(convo, diff, groupDetails, dbMessage.id);
|
||||
|
||||
|
@ -214,6 +217,7 @@ export async function leaveMediumGroup(groupId: string) {
|
|||
sent_at: now,
|
||||
received_at: now,
|
||||
});
|
||||
window.MessageController.register(dbMessage.id, dbMessage);
|
||||
const ourPrimary = await UserUtil.getPrimary();
|
||||
|
||||
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');
|
||||
window.MessageController.register(dbMessage.id, dbMessage);
|
||||
|
||||
await sendGroupUpdate(convo, diff, updateObj, dbMessage.id);
|
||||
}
|
||||
|
|
|
@ -2,14 +2,14 @@ import { EncryptionType } from './EncryptionType';
|
|||
|
||||
// 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
|
||||
export interface RawMessage {
|
||||
export type RawMessage = {
|
||||
identifier: string;
|
||||
plainTextBuffer: Uint8Array;
|
||||
timestamp: number;
|
||||
device: string;
|
||||
ttl: number;
|
||||
encryption: EncryptionType;
|
||||
}
|
||||
};
|
||||
|
||||
// For building RawMessages from JSON
|
||||
export interface PartialRawMessage {
|
||||
|
|
Loading…
Reference in a new issue