From 8d999b2802488f4d3b6e67e1501ff5f85d851217 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Wed, 10 Jan 2018 13:26:35 +0000 Subject: [PATCH] Explicit plugin dependencies. Make hide_open_bookmarks false by default --- CHANGES.md | 3 +++ package-lock.json | 2 +- src/converse-bookmarks.js | 17 +++++++++++++---- src/converse-chatview.js | 10 ++++------ src/converse-controlbox.js | 11 +++++++++++ src/converse-dragresize.js | 12 +++++------- src/converse-headline.js | 11 +++++++++++ src/converse-minimize.js | 2 +- src/converse-otr.js | 11 +++++++++++ 9 files changed, 60 insertions(+), 19 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b1acb039a..f24f05d50 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -43,6 +43,9 @@ - New API method `_converse.api.vcard.get` which fetches the VCard for a particular JID. +### Configuration changes +- `hide_open_bookmarks` is now by default `true`. + ### UX/UI changes - Use CSS3 fade transitions to render various elements. - Remove `Login` and `Registration` tabs and consolidate into one panel. diff --git a/package-lock.json b/package-lock.json index 9fe2b3b5e..ae79e4b9a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6825,7 +6825,7 @@ } }, "pluggable.js": { - "version": "git+https://github.com/jcbrand/pluggable.js.git#4677f759c270edda4ce987a8565b817a1d15973b", + "version": "git+https://github.com/jcbrand/pluggable.js.git#a281e7207b62c5cc5fad084337fd32c003928e86", "dev": true, "requires": { "lodash": "4.17.4" diff --git a/src/converse-bookmarks.js b/src/converse-bookmarks.js index 344f62e8d..4415f3765 100644 --- a/src/converse-bookmarks.js +++ b/src/converse-bookmarks.js @@ -10,8 +10,7 @@ * in XEP-0048. */ (function (root, factory) { - define(["utils", - "converse-core", + define(["converse-core", "converse-muc", "tpl!chatroom_bookmark_form", "tpl!chatroom_bookmark_toggle", @@ -20,7 +19,6 @@ ], factory); }(this, function ( - u, converse, muc, tpl_chatroom_bookmark_form, @@ -30,9 +28,20 @@ ) { const { Backbone, Promise, Strophe, $iq, b64_sha1, sizzle, _ } = converse.env; + const u = converse.env.utils; converse.plugins.add('converse-bookmarks', { + /* Plugin dependencies are other plugins which might be + * overridden or relied upon, and therefore need to be loaded before + * this plugin. + * + * If the setting "strict_plugin_dependencies" is set to true, + * an error will be raised if the plugin is not found. By default it's + * false, which means these plugins are only loaded opportunistically. + * + * NB: These plugins need to have already been loaded via require.js. + */ dependencies: ["converse-chatboxes", "converse-muc"], overrides: { @@ -203,7 +212,7 @@ // configuration settings. _converse.api.settings.update({ allow_bookmarks: true, - hide_open_bookmarks: false + hide_open_bookmarks: true }); // Promises exposed by this plugin _converse.api.promises.add('bookmarksInitialized'); diff --git a/src/converse-chatview.js b/src/converse-chatview.js index 4a4329a75..88a8a24e4 100644 --- a/src/converse-chatview.js +++ b/src/converse-chatview.js @@ -48,15 +48,13 @@ }; converse.plugins.add('converse-chatview', { - /* Optional dependencies are other plugins which might be + /* Plugin dependencies are other plugins which might be * overridden or relied upon, and therefore need to be loaded before - * this plugin. They are called "optional" because they might not be - * available, in which case any overrides applicable to them will be - * ignored. + * this plugin. * - * It's possible however to make optional dependencies non-optional. * If the setting "strict_plugin_dependencies" is set to true, - * an error will be raised if the plugin is not found. + * an error will be raised if the plugin is not found. By default it's + * false, which means these plugins are only loaded opportunistically. * * NB: These plugins need to have already been loaded via require.js. */ diff --git a/src/converse-controlbox.js b/src/converse-controlbox.js index 8dd3e70ca..7d75dcad8 100644 --- a/src/converse-controlbox.js +++ b/src/converse-controlbox.js @@ -81,6 +81,17 @@ ]; converse.plugins.add('converse-controlbox', { + /* Plugin dependencies are other plugins which might be + * overridden or relied upon, and therefore need to be loaded before + * this plugin. + * + * If the setting "strict_plugin_dependencies" is set to true, + * an error will be raised if the plugin is not found. By default it's + * false, which means these plugins are only loaded opportunistically. + * + * NB: These plugins need to have already been loaded via require.js. + */ + dependencies: ["converse-chatboxes"], overrides: { // Overrides mentioned here will be picked up by converse.js's diff --git a/src/converse-dragresize.js b/src/converse-dragresize.js index 77b7a4b10..33875e298 100644 --- a/src/converse-dragresize.js +++ b/src/converse-dragresize.js @@ -29,19 +29,17 @@ converse.plugins.add('converse-dragresize', { - /* Optional dependencies are other plugins which might be + /* Plugin dependencies are other plugins which might be * overridden or relied upon, and therefore need to be loaded before - * this plugin. They are called "optional" because they might not be - * available, in which case any overrides applicable to them will be - * ignored. + * this plugin. * - * It's possible however to make optional dependencies non-optional. * If the setting "strict_plugin_dependencies" is set to true, - * an error will be raised if the plugin is not found. + * an error will be raised if the plugin is not found. By default it's + * false, which means these plugins are only loaded opportunistically. * * NB: These plugins need to have already been loaded via require.js. */ - dependencies: ["converse-headline"], + dependencies: ["converse-chatview", "converse-headline"], enabled (_converse) { return _converse.view_mode == 'overlayed'; diff --git a/src/converse-headline.js b/src/converse-headline.js index 5f2359c75..6e48099e4 100644 --- a/src/converse-headline.js +++ b/src/converse-headline.js @@ -18,6 +18,17 @@ const HEADLINES_TYPE = 'headline'; converse.plugins.add('converse-headline', { + /* Plugin dependencies are other plugins which might be + * overridden or relied upon, and therefore need to be loaded before + * this plugin. + * + * If the setting "strict_plugin_dependencies" is set to true, + * an error will be raised if the plugin is not found. By default it's + * false, which means these plugins are only loaded opportunistically. + * + * NB: These plugins need to have already been loaded via require.js. + */ + dependencies: ["converse-chatview"], overrides: { // Overrides mentioned here will be picked up by converse.js's diff --git a/src/converse-minimize.js b/src/converse-minimize.js index e6590d809..93f0d3b01 100644 --- a/src/converse-minimize.js +++ b/src/converse-minimize.js @@ -39,7 +39,7 @@ * * NB: These plugins need to have already been loaded via require.js. */ - dependencies: ["converse-controlbox", "converse-muc"], + dependencies: ["converse-chatview", "converse-controlbox", "converse-muc", "converse-headline"], enabled (_converse) { return _converse.view_mode == 'overlayed'; diff --git a/src/converse-otr.js b/src/converse-otr.js index 55c2d00d6..e2d4b8b04 100644 --- a/src/converse-otr.js +++ b/src/converse-otr.js @@ -44,6 +44,17 @@ converse.plugins.add('converse-otr', { + /* Plugin dependencies are other plugins which might be + * overridden or relied upon, and therefore need to be loaded before + * this plugin. + * + * If the setting "strict_plugin_dependencies" is set to true, + * an error will be raised if the plugin is not found. By default it's + * false, which means these plugins are only loaded opportunistically. + * + * NB: These plugins need to have already been loaded via require.js. + */ + dependencies: ["converse-chatview"], overrides: { // Overrides mentioned here will be picked up by converse.js's