Sfoglia il codice sorgente

Remove `show_only_online_users` config setting.

Doesn't appear to be very useful. IIRC it was added as a workaround for
slow roster issues.
JC Brand 5 anni fa
parent
commit
f7a57f272e

+ 2 - 0
CHANGES.md

@@ -24,6 +24,8 @@
   * `_converse.api.rooms.get`
   * `_converse.api.rooms.get`
   * `_converse.api.rooms.create`
   * `_converse.api.rooms.create`
 
 
+- The `show_only_online_users` setting has been removed.
+
 ## 5.0.4 (2019-10-08)
 ## 5.0.4 (2019-10-08)
 - New config option [allow_message_corrections](https://conversejs.org/docs/html/configuration.html#allow-message-corrections)
 - New config option [allow_message_corrections](https://conversejs.org/docs/html/configuration.html#allow-message-corrections)
   which, if set to `last`, limits editing of sent messages to the last message sent.
   which, if set to `last`, limits editing of sent messages to the last message sent.

+ 1 - 15
docs/source/configuration.rst

@@ -788,7 +788,7 @@ hide_offline_users
 
 
 * Default:  ``false``
 * Default:  ``false``
 
 
-If set to ``true``, then don't show offline users.
+If set to ``true``, then offline users aren't shown in the roster.
 
 
 hide_open_bookmarks
 hide_open_bookmarks
 -------------------
 -------------------
@@ -1491,20 +1491,6 @@ show_images_inline
 
 
 If set to false, images won't be rendered in chats, instead only their links will be shown.
 If set to false, images won't be rendered in chats, instead only their links will be shown.
 
 
-show_only_online_users
-----------------------
-
-* Default:  ``false``
-
-If set to ``true``, only online users will be shown in the contacts roster.
-Users with any other status (e.g. away, busy etc.) will not be shown.
-
-show_send_button
-----------------
-
-* Default:  ``false``
-
-If set to ``true``, a button will be visible which can be clicked to send a message.
 
 
 singleton
 singleton
 ---------
 ---------

+ 9 - 9
src/converse-rosterview.js

@@ -42,7 +42,6 @@ converse.plugins.add('converse-rosterview', {
             'allow_contact_removal': true,
             'allow_contact_removal': true,
             'hide_offline_users': false,
             'hide_offline_users': false,
             'roster_groups': true,
             'roster_groups': true,
-            'show_only_online_users': false,
             'show_toolbar': true,
             'show_toolbar': true,
             'xhr_user_search_url': null,
             'xhr_user_search_url': null,
         });
         });
@@ -461,16 +460,17 @@ converse.plugins.add('converse-rosterview', {
                 return this;
                 return this;
             },
             },
 
 
+            /**
+             * Returns a boolean indicating whether this contact should
+             * generally be visible in the roster.
+             * It doesn't check for the more specific case of whether
+             * the group it's in is collapsed.
+             * @private
+             * @method _converse.RosterContactView#mayBeShown
+             */
             mayBeShown () {
             mayBeShown () {
-                /* Return a boolean indicating whether this contact should
-                 * generally be visible in the roster.
-                 *
-                 * It doesn't check for the more specific case of whether
-                 * the group it's in is collapsed.
-                 */
                 const chatStatus = this.model.presence.get('show');
                 const chatStatus = this.model.presence.get('show');
-                if ((_converse.show_only_online_users && chatStatus !== 'online') ||
-                    (_converse.hide_offline_users && chatStatus === 'offline')) {
+                if (_converse.hide_offline_users && chatStatus === 'offline') {
                     // If pending or requesting, show
                     // If pending or requesting, show
                     if ((this.model.get('ask') === 'subscribe') ||
                     if ((this.model.get('ask') === 'subscribe') ||
                             (this.model.get('subscription') === 'from') ||
                             (this.model.get('subscription') === 'from') ||

+ 2 - 5
src/headless/converse-roster.js

@@ -569,11 +569,8 @@ converse.plugins.add('converse-roster', {
             },
             },
 
 
             getNumOnlineContacts () {
             getNumOnlineContacts () {
-                let ignored = ['offline', 'unavailable'];
-                if (_converse.show_only_online_users) {
-                    ignored = _.union(ignored, ['dnd', 'xa', 'away']);
-                }
-                return _.sum(this.models.filter((model) => !_.includes(ignored, model.presence.get('show'))));
+                const ignored = ['offline', 'unavailable'];
+                return _.sum(this.models.filter(m => !ignored.includes(m.presence.get('show'))));
             },
             },
 
 
             /**
             /**