diff --git a/js/models/conversations.js b/js/models/conversations.js index 36edf6e87..eb724f58f 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -1900,25 +1900,28 @@ window.console.warn('sendGroupInfo invalid pubkey:', recipient); return; } - await libsession - .getMessageQueue() - .send(recipientPubKey, groupUpdateMessage) - .catch(log.error); - const expireUpdate = { - timestamp: Date.now(), - expireTimer: this.get('expireTimer'), - groupId: this.get('id'), - }; + try { + await libsession + .getMessageQueue() + .send(recipientPubKey, groupUpdateMessage); - const expirationTimerMessage = new libsession.Messages.Outgoing.ExpirationTimerUpdateMessage( - expireUpdate - ); + const expireUpdate = { + timestamp: Date.now(), + expireTimer: this.get('expireTimer'), + groupId: this.get('id'), + }; - await libsession - .getMessageQueue() - .sendUsingMultiDevice(recipientPubKey, expirationTimerMessage) - .catch(log.error); + const expirationTimerMessage = new libsession.Messages.Outgoing.ExpirationTimerUpdateMessage( + expireUpdate + ); + + await libsession + .getMessageQueue() + .sendUsingMultiDevice(recipientPubKey, expirationTimerMessage); + } catch (e) { + log.error('Failed to send groupInfo:', e); + } } }, diff --git a/ts/receiver/dataMessage.ts b/ts/receiver/dataMessage.ts index ff01c07c3..6b17e006f 100644 --- a/ts/receiver/dataMessage.ts +++ b/ts/receiver/dataMessage.ts @@ -435,15 +435,9 @@ export function initIncomingMessage(data: MessageCreationData): MessageModel { } = data; const type = 'incoming'; - if ( - message && - message.group && - message.group.id && - message.group.id.length === 0 - ) { - message.group.id = null; - } - const groupId = message?.group?.id; + const messageGroupId = message?.group?.id; + const groupId = + messageGroupId && messageGroupId.length > 0 ? messageGroupId : null; const messageData: any = { source, diff --git a/ts/session/utils/Protobuf.ts b/ts/session/utils/Protobuf.ts index 4356022f8..5a7470b2f 100644 --- a/ts/session/utils/Protobuf.ts +++ b/ts/session/utils/Protobuf.ts @@ -8,11 +8,7 @@ import ByteBuffer from 'bytebuffer'; */ export function convertToTS(object: any): any { // No idea why js `ByteBuffer` and ts `ByteBuffer` differ ... - if ( - object && - object.constructor && - object.constructor.name === 'Uint8Array' - ) { + if (object instanceof Uint8Array) { return object; } else if ( object &&