Sfoglia il codice sorgente

Fixes #967. Rooms list not shown when server doesn't support bookmarks

JC Brand 7 anni fa
parent
commit
21241c5cff
3 ha cambiato i file con 7 aggiunte e 3 eliminazioni
  1. 1 0
      CHANGES.md
  2. 5 2
      src/converse-bookmarks.js
  3. 1 1
      src/converse-roomslist.js

+ 1 - 0
CHANGES.md

@@ -6,6 +6,7 @@
 - #800 Could not register successfully in ejabberd 17.01
 - #800 Could not register successfully in ejabberd 17.01
 - #949 Don't flash the roster contacts filter (i.e. hide by default)
 - #949 Don't flash the roster contacts filter (i.e. hide by default)
 - #953 MUC "Features" displayed when exiting configuration
 - #953 MUC "Features" displayed when exiting configuration
+- #967 Rooms list doesn't show when the server doesn't support bookmarks
 - Don't require `auto_login` to be `true` when using the API to log in.
 - Don't require `auto_login` to be `true` when using the API to log in.
 - Moment locale wasn't being set to the value passed via the `i18n` option.
 - Moment locale wasn't being set to the value passed via the `i18n` option.
 - In the chat heading, two avatars sometimes get rendered.
 - In the chat heading, two avatars sometimes get rendered.

+ 5 - 2
src/converse-bookmarks.js

@@ -385,7 +385,7 @@
                     _converse.log('Error while fetching bookmarks', Strophe.LogLevel.WARN);
                     _converse.log('Error while fetching bookmarks', Strophe.LogLevel.WARN);
                     _converse.log(iq.outerHTML, Strophe.LogLevel.DEBUG);
                     _converse.log(iq.outerHTML, Strophe.LogLevel.DEBUG);
                     if (!_.isNil(deferred)) {
                     if (!_.isNil(deferred)) {
-                        return deferred.reject();
+                        return deferred.reject(new Error("Could not fetch bookmarks"));
                     }
                     }
                 }
                 }
             });
             });
@@ -517,10 +517,13 @@
                     return;
                     return;
                 }
                 }
                 _converse.bookmarks = new _converse.Bookmarks();
                 _converse.bookmarks = new _converse.Bookmarks();
-                _converse.bookmarks.fetchBookmarks().then(function () {
+                _converse.bookmarks.fetchBookmarks().then(() => {
                     _converse.bookmarksview = new _converse.BookmarksView(
                     _converse.bookmarksview = new _converse.BookmarksView(
                         {'model': _converse.bookmarks}
                         {'model': _converse.bookmarks}
                     );
                     );
+                })
+                .catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR))
+                .then(() => {
                     _converse.emit('bookmarksInitialized');
                     _converse.emit('bookmarksInitialized');
                 });
                 });
             };
             };

+ 1 - 1
src/converse-roomslist.js

@@ -33,7 +33,7 @@
          *
          *
          * NB: These plugins need to have already been loaded via require.js.
          * NB: These plugins need to have already been loaded via require.js.
          */
          */
-        optional_dependencies: ["converse-bookmarks"],
+        optional_dependencies: ["converse-controlbox", "converse-muc", "converse-bookmarks"],
 
 
         initialize () {
         initialize () {
             /* The initialize function gets called as soon as the plugin is
             /* The initialize function gets called as soon as the plugin is