diff --git a/CHANGES.md b/CHANGES.md
index 8efc66f74..a201f290c 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -9,6 +9,7 @@
- Rudimentary support for XEP-0333 chat markers
- Better support for XEP-0359 `stanza-id` and `origin-id` elements.
- Bugfix: restore textarea size after sending a message
+- Bugfix: MUC invite form not appearing
- #1369 Don't wrongly interpret message with `subject` as a topic change.
- #1405 Status of contacts list are not displayed properly
- #1408 New config option `roomconfig_whitelist`
diff --git a/dist/converse.js b/dist/converse.js
index 21bd63869..1a9ecb9a3 100644
--- a/dist/converse.js
+++ b/dist/converse.js
@@ -55146,8 +55146,8 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins
initialize() {
Backbone.OrderedListView.prototype.initialize.apply(this, arguments);
this.chatroomview = this.model.chatroomview;
- this.chatroomview.model.on('change:open', this.renderInviteWidget, this);
this.chatroomview.model.on('change:affiliation', this.renderInviteWidget, this);
+ this.chatroomview.model.features.on('change:open', this.renderInviteWidget, this);
this.chatroomview.model.features.on('change', this.renderRoomFeatures, this);
this.render();
this.model.fetch({
@@ -55251,7 +55251,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins
},
shouldInviteWidgetBeShown() {
- return _converse.allow_muc_invitations && (this.chatroomview.model.get('open') || this.chatroomview.model.get('affiliation') === "owner");
+ return _converse.allow_muc_invitations && (this.chatroomview.model.features.get('open') || this.chatroomview.model.get('affiliation') === "owner");
},
initInviteWidget() {
diff --git a/spec/muc.js b/spec/muc.js
index 71d478887..7c333be2a 100644
--- a/spec/muc.js
+++ b/spec/muc.js
@@ -1725,20 +1725,31 @@
// cheat here and emit the event.
_converse.emit('rosterContactsFetched');
- await test_utils.openChatRoom(_converse, 'lounge', 'localhost', 'dummy');
- spyOn(_converse, 'emit');
- spyOn(window, 'prompt').and.callFake(function () {
- return "Please join!";
- });
+ const features = [
+ 'http://jabber.org/protocol/muc',
+ 'jabber:iq:register',
+ 'muc_passwordprotected',
+ 'muc_hidden',
+ 'muc_temporary',
+ 'muc_membersonly',
+ 'muc_unmoderated',
+ 'muc_anonymous'
+ ]
+ await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'localhost', 'dummy', features);
+ spyOn(_converse, 'emit').and.callThrough();
+ spyOn(window, 'prompt').and.callFake(() => "Please join!");
const view = _converse.chatboxviews.get('lounge@localhost');
-
- // XXX: cheating a lttle bit, normally this'll be set after
- // receiving the features for the groupchat.
- view.model.set('open', 'true');
-
- spyOn(view.model, 'directInvite').and.callThrough();
const chat_area = view.el.querySelector('.chat-area');
- chat_area.parentElement.removeChild(chat_area);
+
+ expect(view.model.get('affiliation')).toBe('owner');
+ expect(view.model.features.get('open')).toBe(false);
+ expect(view.el.querySelectorAll('input.invited-contact').length).toBe(1);
+
+ view.model.set('affiliation', 'member');
+ await test_utils.waitUntil(() => view.el.querySelectorAll('input.invited-contact').length === 0);
+
+ view.model.features.set('open', 'true');
+ spyOn(view.model, 'directInvite').and.callThrough();
await test_utils.waitUntil(() => view.el.querySelectorAll('input.invited-contact').length);
const input = view.el.querySelector('input.invited-contact');
expect(input.getAttribute('placeholder')).toBe('Invite');
@@ -1755,22 +1766,19 @@
expect(hint.textContent).toBe('Felix Amsel');
expect(input.nextSibling.childNodes.length).toBe(1);
- if (typeof(Event) === 'function') {
- // Not working on PhantomJS
- evt = new Event('mousedown', {'bubbles': true});
- evt.button = 0; // For some reason awesomplete wants this
- hint.dispatchEvent(evt);
- expect(window.prompt).toHaveBeenCalled();
- expect(view.model.directInvite).toHaveBeenCalled();
- expect(sent_stanza.toLocaleString()).toBe(
- ``+
- ``+
- ``
- );
- }
+ evt = new Event('mousedown', {'bubbles': true});
+ evt.button = 0; // For some reason awesomplete wants this
+ hint.dispatchEvent(evt);
+ expect(window.prompt).toHaveBeenCalled();
+ expect(view.model.directInvite).toHaveBeenCalled();
+ expect(sent_stanza.toLocaleString()).toBe(
+ ``+
+ ``+
+ ``
+ );
done();
}));
diff --git a/src/converse-muc-views.js b/src/converse-muc-views.js
index c7d4522c8..4128c2854 100644
--- a/src/converse-muc-views.js
+++ b/src/converse-muc-views.js
@@ -1849,8 +1849,8 @@ converse.plugins.add('converse-muc-views', {
Backbone.OrderedListView.prototype.initialize.apply(this, arguments);
this.chatroomview = this.model.chatroomview;
- this.chatroomview.model.on('change:open', this.renderInviteWidget, this);
this.chatroomview.model.on('change:affiliation', this.renderInviteWidget, this);
+ this.chatroomview.model.features.on('change:open', this.renderInviteWidget, this);
this.chatroomview.model.features.on('change', this.renderRoomFeatures, this);
this.render();
@@ -1955,7 +1955,7 @@ converse.plugins.add('converse-muc-views', {
shouldInviteWidgetBeShown () {
return _converse.allow_muc_invitations &&
- (this.chatroomview.model.get('open') ||
+ (this.chatroomview.model.features.get('open') ||
this.chatroomview.model.get('affiliation') === "owner"
);
},