Selaa lähdekoodia

Bugfix. Wrong number of online contacts shown. Fixes #97

JC Brand 11 vuotta sitten
vanhempi
commit
478653aebd
2 muutettua tiedostoa jossa 8 lisäystä ja 1 poistoa
  1. 5 1
      converse.js
  2. 3 0
      docs/CHANGES.rst

+ 5 - 1
converse.js

@@ -2707,11 +2707,15 @@
 
             getNumOnlineContacts: function () {
                 var count = 0,
+                    ignored = ['offline', 'unavailable'],
                     models = this.models,
                     models_length = models.length,
                     i;
+                if (converse.show_only_online_users) {
+                    ignored = _.union(ignored, ['dnd', 'xa', 'away']);
+                }
                 for (i=0; i<models_length; i++) {
-                    if (_.indexOf(['offline', 'unavailable'], models[i].get('chat_status')) === -1) {
+                    if (_.indexOf(ignored, models[i].get('chat_status')) === -1) {
                         count++;
                     }
                 }

+ 3 - 0
docs/CHANGES.rst

@@ -4,7 +4,10 @@ Changelog
 0.7.2 (Unreleased)
 ------------------
 
+.. note:: This release contains an important security fix.
+
 * #48 Add event emitter support and emit events. [jcbrand]
+* #97 Wrong number of online contacts shown with config option ``show_only_online_users``. [jcbrand]
 * #100 Make the fetching of vCards optional (enabled by default). [jcbrand]
 * Sanitize message text to avoid Javascript injection attacks. Thanks to hejsan for reporting. [jcbrand]