[polari/wip/carlosg/tracker: 2/15] chatView: Use unix timestamps for comparisons



commit 718484cc05ae7467ba36c1902f78d341610dd2d3
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 babd145..7efb52a 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]