From f857744e88e5fa6b0d61f9c1a4a24e2b774f1c01 Mon Sep 17 00:00:00 2001
From: Beaudan <beau@loki.network>
Date: Fri, 9 Aug 2019 13:33:48 +1000
Subject: [PATCH] Revert sending id

---
 js/background.js                   | 1 -
 js/models/conversations.js         | 1 -
 js/models/messages.js              | 2 --
 js/modules/loki_message_api.js     | 2 --
 js/modules/loki_public_chat_api.js | 4 +---
 libtextsecure/outgoing_message.js  | 3 ---
 6 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/js/background.js b/js/background.js
index b7e5fd804..c8674a4cd 100644
--- a/js/background.js
+++ b/js/background.js
@@ -1411,7 +1411,6 @@
     const { isError } = options;
 
     let messageData = {
-      id: data.id,
       source: data.source,
       sourceDevice: data.sourceDevice,
       sent_at: data.timestamp,
diff --git a/js/models/conversations.js b/js/models/conversations.js
index 3715a3aba..fd887826b 100644
--- a/js/models/conversations.js
+++ b/js/models/conversations.js
@@ -1357,7 +1357,6 @@
         options.messageType = message.get('type');
         if (this.isPublic()) {
           options.publicEndpoint = this.getEndpoint();
-          options.messageId = id;
         }
 
         const groupNumbers = this.getRecipients();
diff --git a/js/models/messages.js b/js/models/messages.js
index cc6c885ef..d1f77a3a5 100644
--- a/js/models/messages.js
+++ b/js/models/messages.js
@@ -2014,9 +2014,7 @@
           } else {
             await conversation.onFriendRequestAccepted();
           }
-          // Force save if the message already has an id, used for public channels
           const id = await window.Signal.Data.saveMessage(message.attributes, {
-            forceSave: !!message.id,
             Message: Whisper.Message,
           });
           message.set({ id });
diff --git a/js/modules/loki_message_api.js b/js/modules/loki_message_api.js
index 8216ca084..87c3ec0d3 100644
--- a/js/modules/loki_message_api.js
+++ b/js/modules/loki_message_api.js
@@ -80,7 +80,6 @@ class LokiMessageAPI {
       isPing = false,
       numConnections = DEFAULT_CONNECTIONS,
       publicEndpoint = null,
-      messageId = null,
     } = options;
     // Data required to identify a message in a conversation
     const messageEventData = {
@@ -106,7 +105,6 @@ class LokiMessageAPI {
               timestamp: messageTimeStamp,
               from: displayName,
               source: this.ourKey,
-              id: messageId,
             },
           },
         ],
diff --git a/js/modules/loki_public_chat_api.js b/js/modules/loki_public_chat_api.js
index 17d8e004d..d9ebde10f 100644
--- a/js/modules/loki_public_chat_api.js
+++ b/js/modules/loki_public_chat_api.js
@@ -161,14 +161,12 @@ class LokiPublicChannelAPI {
         let timestamp = new Date(adnMessage.created_at).getTime();
         let from = adnMessage.user.username;
         let source;
-        let id;
         if (adnMessage.annotations.length) {
           const noteValue = adnMessage.annotations[0].value;
-          ({ from, timestamp, source, id } = noteValue);
+          ({ from, timestamp, source } = noteValue);
         }
 
         const messageData = {
-          id,
           friendRequest: false,
           source,
           sourceDevice: 1,
diff --git a/libtextsecure/outgoing_message.js b/libtextsecure/outgoing_message.js
index 02d8fc77d..a0ab663a4 100644
--- a/libtextsecure/outgoing_message.js
+++ b/libtextsecure/outgoing_message.js
@@ -50,12 +50,10 @@ function OutgoingMessage(
     messageType,
     isPing,
     publicEndpoint,
-    messageId,
   } =
     options || {};
   this.numberInfo = numberInfo;
   this.publicEndpoint = publicEndpoint;
-  this.messageId = messageId;
   this.senderCertificate = senderCertificate;
   this.online = online;
   this.messageType = messageType || 'outgoing';
@@ -205,7 +203,6 @@ OutgoingMessage.prototype = {
       };
       if (this.publicEndpoint) {
         options.publicEndpoint = this.publicEndpoint;
-        options.messageId = this.messageId;
       }
       await lokiMessageAPI.sendMessage(pubKey, data, timestamp, ttl, options);
     } catch (e) {