Keeping the .last_seen message marker in place until window blurs again
authorDarren <darren@darrenwhitlen.com>
Sun, 30 Nov 2014 03:43:34 +0000 (03:43 +0000)
committerDarren <darren@darrenwhitlen.com>
Sun, 30 Nov 2014 03:43:34 +0000 (03:43 +0000)
client/src/views/application.js
client/src/views/channel.js

index c13fea2749f0d3a0eff2080375e6fd6ff41c1699..125430f4fefa78f84f31c3b7a275e8779ce0d716 100644 (file)
@@ -51,7 +51,7 @@ _kiwi.view.Application = Backbone.View.extend({
         $(window).on('blur', function windowOnBlur() {
             var active_panel = that.model.panels().active;
             if (active_panel && active_panel.view.updateLastSeenMarker) {
-                _kiwi.global.connections.active.view.updateLastSeenMarker();
+                active_panel.view.updateLastSeenMarker();
             }
 
             that.has_focus = false;
index 14630ab8df17f581899df63caa21286687a90d0e..f7a0655e3c7b56a915814969d54070e995e3fdff 100644 (file)
@@ -81,8 +81,6 @@ _kiwi.view.Channel = _kiwi.view.Panel.extend({
             line_msg = '<div class="msg <%= type %> <%= css_classes %>"><div class="time"><%- time_string %></div><div class="nick" style="<%= nick_style %>"><%- nick %></div><div class="text" style="<%= style %>"><%= msg %> </div></div>';
             this.$messages.append($(_.template(line_msg, display_obj)).data('message', msg));
 
-            this.updateLastSeenMarker();
-
             // Activity/alerts based on the type of new message
             if (msg.type.match(/^action /)) {
                 this.alert('action');
@@ -404,19 +402,12 @@ _kiwi.view.Channel = _kiwi.view.Panel.extend({
 
 
     updateLastSeenMarker: function() {
-        var last_seen, last_message;
-        if (this.model.isActive() && _kiwi.app.view.has_focus) {
+        if (this.model.isActive()) {
             // Remove the previous last seen classes
-            last_seen = this.$(".last_seen");
-            if (last_seen && last_seen.length) {
-                last_seen.removeClass("last_seen");
-            }
+            this.$(".last_seen").removeClass("last_seen");
 
             // Mark the last message the user saw
-            last_message = this.$messages.children().last();
-            if (last_message) {
-                last_message.addClass("last_seen");
-            }
+            this.$messages.children().last().addClass("last_seen");
         }
     },