Bug 855968 - B2G MMS: delivery is not correctly indexed in DB. r=vicamo, a=leo+
authorVicamo Yang <vyang@mozilla.com>
Thu, 18 Apr 2013 09:09:29 +0800
changeset 119087 23f909c9bff203b8ddb61118a043cdd00ed22ac1
parent 119086 b1d335593453dd02153cab7761054e16f633f341
child 119088 51c4987b8206b7ffb22b1fe364b73a1b775f34ba
push id680
push uservyang@mozilla.com
push dateThu, 18 Apr 2013 01:11:41 +0000
reviewersvicamo, leo
bugs855968
milestone18.0
Bug 855968 - B2G MMS: delivery is not correctly indexed in DB. r=vicamo, a=leo+
dom/mobilemessage/src/ril/MobileMessageDatabaseService.js
--- a/dom/mobilemessage/src/ril/MobileMessageDatabaseService.js
+++ b/dom/mobilemessage/src/ril/MobileMessageDatabaseService.js
@@ -1163,25 +1163,24 @@ MobileMessageDatabaseService.prototype =
         threadParticipants = threadParticipants.concat(slicedReceivers);
       }
     }
 
     let timestamp = aMessage.timestamp;
 
     // Adding needed indexes and extra attributes for internal use.
     // threadIdIndex & participantIdsIndex are filled in saveRecord().
-    aMessage.deliveryIndex = [DELIVERY_RECEIVED, timestamp];
     aMessage.readIndex = [FILTER_READ_UNREAD, timestamp];
+    aMessage.read = FILTER_READ_UNREAD;
 
     if (aMessage.type == "sms") {
+      aMessage.delivery = DELIVERY_RECEIVED;
       aMessage.deliveryStatus = DELIVERY_STATUS_SUCCESS;
-      aMessage.delivery = DELIVERY_RECEIVED;
     }
-
-    aMessage.read = FILTER_READ_UNREAD;
+    aMessage.deliveryIndex = [aMessage.delivery, timestamp];
 
     return this.saveRecord(aMessage, threadParticipants, aCallback);
   },
 
   saveSendingMessage: function saveSendingMessage(aMessage, aCallback) {
     if ((aMessage.type != "sms" && aMessage.type != "mms") ||
         (aMessage.type == "sms" && !aMessage.receiver) ||
         (aMessage.type == "mms" && !Array.isArray(aMessage.receivers)) ||