Commit 9ce315de authored by JC Brand's avatar JC Brand

Bugfix. Handle stanza that clears the MUC subject

parent 5128bc9e
# Changelog # Changelog
## 6.0.1 (Unreleased)
- Bugfix. Handle stanza that clears the MUC subject
- #1313: Stylistic improvements to the send button - #1313: Stylistic improvements to the send button
- #1793: Send button doesn't appear in Firefox in 1:1 chats - #1793: Send button doesn't appear in Firefox in 1:1 chats
- #1822: Don't log error if user has no bookmarks - #1822: Don't log error if user has no bookmarks
......
...@@ -2167,12 +2167,22 @@ ...@@ -2167,12 +2167,22 @@
</message>`); </message>`);
_converse.connection._dataRecv(test_utils.createRequest(stanza)); _converse.connection._dataRecv(test_utils.createRequest(stanza));
await new Promise(resolve => view.once('messageInserted', resolve)); await new Promise(resolve => view.once('messageInserted', resolve));
expect(sizzle('.chat-topic').length).toBe(1); expect(sizzle('.chat-topic', view.el).length).toBe(1);
expect(sizzle('.chat-msg__subject').length).toBe(1); expect(sizzle('.chat-msg__subject', view.el).length).toBe(1);
expect(sizzle('.chat-msg__subject').pop().textContent.trim()).toBe('This is a message subject'); expect(sizzle('.chat-msg__subject', view.el).pop().textContent.trim()).toBe('This is a message subject');
expect(sizzle('.chat-msg__text').length).toBe(1); expect(sizzle('.chat-msg__text').length).toBe(1);
expect(sizzle('.chat-msg__text').pop().textContent.trim()).toBe('This is a message'); expect(sizzle('.chat-msg__text').pop().textContent.trim()).toBe('This is a message');
expect(view.el.querySelector('.chatroom-description').textContent.trim()).toBe(text); expect(view.el.querySelector('.chatroom-description').textContent.trim()).toBe(text);
// Removes current topic
stanza = u.toStanza(
`<message xmlns="jabber:client" to="jc@opkode.com/_converse.js-60429116" type="groupchat" from="jdev@conference.jabber.org/ralphm">
<subject/>
</message>`);
_converse.connection._dataRecv(test_utils.createRequest(stanza));
await new Promise(resolve => view.model.once('change:subject', resolve));
expect(view.el.querySelector('.chatroom-description').textContent.trim()).toBe("");
expect(view.el.querySelector('.chat-info:last-child').textContent.trim()).toBe("Topic cleared by ralphm");
done(); done();
})); }));
...@@ -3266,6 +3276,18 @@ ...@@ -3266,6 +3276,18 @@
'<message from="romeo@montague.lit/orchard" to="lounge@montague.lit" type="groupchat" xmlns="jabber:client">'+ '<message from="romeo@montague.lit/orchard" to="lounge@montague.lit" type="groupchat" xmlns="jabber:client">'+
'<subject xmlns="jabber:client">This is yet another subject</subject>'+ '<subject xmlns="jabber:client">This is yet another subject</subject>'+
'</message>'); '</message>');
// Check unsetting the topic
textarea.value = '/topic';
view.onKeyDown({
target: textarea,
preventDefault: function preventDefault () {},
keyCode: 13
});
expect(Strophe.serialize(sent_stanza).toLocaleString()).toBe(
'<message from="romeo@montague.lit/orchard" to="lounge@montague.lit" type="groupchat" xmlns="jabber:client">'+
'<subject xmlns="jabber:client"></subject>'+
'</message>');
done(); done();
})); }));
......
...@@ -1477,7 +1477,7 @@ converse.plugins.add('converse-muc', { ...@@ -1477,7 +1477,7 @@ converse.plugins.add('converse-muc', {
* @param { object } attrs - The message attributes * @param { object } attrs - The message attributes
*/ */
subjectChangeHandled (attrs) { subjectChangeHandled (attrs) {
if (attrs.subject && !attrs.thread && !attrs.message) { if (isString(attrs.subject) && !attrs.thread && !attrs.message) {
// https://xmpp.org/extensions/xep-0045.html#subject-mod // https://xmpp.org/extensions/xep-0045.html#subject-mod
// ----------------------------------------------------- // -----------------------------------------------------
// The subject is changed by sending a message of type "groupchat" to the <room@service>, // The subject is changed by sending a message of type "groupchat" to the <room@service>,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment