[polari/wip/carlosg/tracker: 4/16] chatView: Use unix timestamps for comparisons



commit 7faa8b8edf72f1cdc591b14a024225f313e6d0ae
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Feb 24 22:43:55 2019 +0100

    chatView: Use unix timestamps for comparisons
    
    This is weird, but even though the compared objects are GDateTime, it
    sometimes fail with:
    
    JS ERROR: TypeError: logs[pos].get_time(...).equal is not a function
    
    However fetching unix timestamps and comparing those works, so let's
    go with it...

 src/chatView.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 00b9bff..043d509 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -581,7 +581,7 @@ var ChatView = GObject.registerClass({
             if (logs[pos].get_sender() == firstPending.get_sender() &&
                 logs[pos].get_text() == firstPending.get_text() &&
                 logs[pos].is_action() == firstPending.is_action() &&
-                logs[pos].get_time().equal(firstPending.get_time()))
+                logs[pos].get_time().to_unix() == firstPending.get_time().to_unix())
                 break;
         // Remove entries that are also in pending (if any), then
         // add the entries from pending


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]