diff --git a/converse.js b/converse.js index 7ae0cacbb..0c713464d 100644 --- a/converse.js +++ b/converse.js @@ -304,6 +304,7 @@ auto_login: false, // Currently only used in connection with anonymous login auto_reconnect: false, auto_subscribe: false, + auto_join_on_invite: false, // Auto-join chatroom on invite bosh_service_url: undefined, // The BOSH connection manager URL. cache_otr_key: false, csi_waiting_time: 0, // Support for XEP-0352. Seconds before client is considered idle and CSI is sent out. @@ -3633,15 +3634,19 @@ contact = converse.roster.get(from), result; - if (!reason) { - result = confirm( - __(___("%1$s has invited you to join a chat room: %2$s"), contact.get('fullname'), room_jid) - ); + if (converse.auto_join_on_invite) { + result = true; } else { - result = confirm( - __(___('%1$s has invited you to join a chat room: %2$s, and left the following reason: "%3$s"'), - contact.get('fullname'), room_jid, reason) - ); + contact = contact? contact.get('fullname'): Strophe.getNodeFromJid(from); // Invite request might come from someone not your roster list + if (!reason) { + result = confirm( + __(___("%1$s has invited you to join a chat room: %2$s"), contact, room_jid) + ); + } else { + result = confirm( + __(___('%1$s has invited you to join a chat room: %2$s, and left the following reason: "%3$s"'), contact, room_jid, reason) + ); + } } if (result === true) { var chatroom = converse.chatboxviews.showChat({ diff --git a/docs/CHANGES.md b/docs/CHANGES.md index 8d80d3e55..fed9e47f2 100644 --- a/docs/CHANGES.md +++ b/docs/CHANGES.md @@ -1,5 +1,10 @@ # Changelog +## 0.10.1 (2015-12-02) + +- #524 Added auto_join_on_invite parameter for automatically joining chatrooms. [ben] +- FIX: A chatroom invite might come from someone not in your roster list. [ben] + ## 0.10.0 (2015-11-05) **Note:** @@ -16,6 +21,7 @@ - Add the ability to also drag-resize chat boxes horizontally. [jcbrand] - Updated Sass files and created a new style. [jcbrand] + ## 0.9.6 (2015-10-12) - Bugfix. Spinner doesn't disappear when scrolling up (when server doesn't support XEP-0313). [jcbrand] diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 714b365fb..3809b96b4 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -244,6 +244,13 @@ auto_subscribe If true, the user will automatically subscribe back to any contact requests. +auto_join_on_invite +-------------- + +* Default: ``false`` + +If true, the user will automatically join a chatroom on invite without any confirm. + .. _`bosh-service-url`: bosh_service_url