[Messaging] tct fixes for sms part 3
authorMaciek Blim <m.blim@samsung.com>
Thu, 15 Jan 2015 14:24:20 +0000 (15:24 +0100)
committerMaciek Blim <m.blim@samsung.com>
Thu, 15 Jan 2015 14:24:41 +0000 (15:24 +0100)
tct:
    pass: 170
    fail: 0
    timeout: 12

pass rate: ~94.5%

Change-Id: If013a0d9574971025ae25c9d4eae6aa308cdb11d
Signed-off-by: Maciek Blim <m.blim@samsung.com>
src/messaging/change_listener_container.h
src/messaging/messaging_api.js
src/messaging/messaging_util.cc

index 895d5f7..0598a97 100644 (file)
@@ -130,10 +130,6 @@ class ChangeListenerContainer {
                 itr->second->setActive(false);
                 collection.erase(id);
                 return true;
-            } else {
-                LoggerE("Removing callback which does not belong to the current context is not allowed.");
-                throw common::NotFoundException(
-                        "Removing callback which does not belong to the current context is not allowed.");
             }
             return false;
         }
index 9e566d1..3005e09 100644 (file)
@@ -180,7 +180,7 @@ function Message(type, data) {
         folderId: folderId || null,
         type: type,
         timestamp: timestamp || null,
-        from: from || '',
+        from: from,
         to: to || [],
         cc: cc || [],
         bcc: bcc || [],
@@ -250,8 +250,9 @@ function Message(type, data) {
                 return _internal.timestamp ? new Date(_internal.timestamp) : _internal.timestamp;
             },
             set: function (value) {
-                if (value instanceof InternalValues_) value = value.timestamp;
-                _internal.timestamp = value;
+                if (value instanceof InternalValues_) {
+                    _internal.timestamp = value.timestamp;
+                }
             },
             enumerable: true
         }
@@ -469,7 +470,7 @@ function MessageInit_(data) {
     this.conversationId = data.conversationId || null;
     this.folderId       = data.folderId       || null;
     this.timestamp      = data.timestamp      || null;
-    this.from           = data.from           || null;
+    this.from           = data.from           || '';
     this.to             = data.to             || [];
     this.cc             = data.cc             || [];
     this.bcc            = data.bcc            || [];
index 1fcdb63..fe87e11 100644 (file)
@@ -342,7 +342,7 @@ picojson::value MessagingUtil::messageToJson(std::shared_ptr<Message> message)
     o[MESSAGE_ATTRIBUTE_FROM] =
             message->is_from_set()
             ? picojson::value(message->getFrom())
-            : picojson::value();
+            : picojson::value(std::string(""));
 
     std::vector<std::string> to = message->getTO();
     for_each(to.begin(), to.end(), vectorToArray);
@@ -409,6 +409,11 @@ picojson::value MessagingUtil::conversationToJson(std::shared_ptr<MessageConvers
         array.push_back(picojson::value(s));
     };
 
+    std::vector<std::string> to = conversation->getTo();
+    for_each(to.begin(), to.end(), vectorToArray);
+    o[MESSAGE_ATTRIBUTE_TO] = picojson::value(array);
+    array.clear();
+
     switch (conversation->getType()) {
         case MessageType::SMS:
             break;
@@ -418,11 +423,6 @@ picojson::value MessagingUtil::conversationToJson(std::shared_ptr<MessageConvers
         case MessageType::EMAIL:
             o[MESSAGE_ATTRIBUTE_SUBJECT] = picojson::value(conversation->getSubject());
 
-            std::vector<std::string> to = conversation->getTo();
-            for_each(to.begin(), to.end(), vectorToArray);
-            o[MESSAGE_ATTRIBUTE_TO] = picojson::value(array);
-            array.clear();
-
             std::vector<std::string> cc = conversation->getCC();
             for_each(cc.begin(), cc.end(), vectorToArray);
             o[MESSAGE_ATTRIBUTE_CC] = picojson::value(array);