Stop sending sync messages to public chats and mark messages from any of our devices as outgoing

pull/539/head
Beaudan Brown 6 years ago
parent ac762d43d5
commit f1c155b943

@ -1441,7 +1441,8 @@
return handleProfileUpdate({ data, confirm, messageDescriptor }); return handleProfileUpdate({ data, confirm, messageDescriptor });
} }
const ourNumber = textsecure.storage.user.getNumber(); const primaryDeviceKey = window.storage.get('primaryDevicePubKey');
const allOurDevices = await libloki.storage.getAllDevicePubKeysForPrimaryPubKey(primaryDeviceKey);
const descriptorId = await textsecure.MessageReceiver.arrayBufferToString( const descriptorId = await textsecure.MessageReceiver.arrayBufferToString(
messageDescriptor.id messageDescriptor.id
); );
@ -1449,7 +1450,7 @@
if ( if (
messageDescriptor.type === 'group' && messageDescriptor.type === 'group' &&
descriptorId.match(/^publicChat:/) && descriptorId.match(/^publicChat:/) &&
data.source === ourNumber allOurDevices.includes(data.source)
) { ) {
// Public chat messages from ourselves should be outgoing // Public chat messages from ourselves should be outgoing
message = await createSentMessage(data); message = await createSentMessage(data);

@ -1270,7 +1270,11 @@
this.trigger('sent', this); this.trigger('sent', this);
if (this.get('type') !== 'friend-request') { if (this.get('type') !== 'friend-request') {
this.sendSyncMessage(); const c = this.getConversation();
// Don't bother sending sync messages to public chats
if (!c.isPublic()) {
this.sendSyncMessage();
}
} }
}) })
.catch(result => { .catch(result => {

Loading…
Cancel
Save