Commit c4c154cf authored by JC Brand's avatar JC Brand

Fixes #1022 Include stored status message in presences.

parent 38dfc7b6
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
- Avatars weren't being shown. - Avatars weren't being shown.
- Bookmarks list and open rooms list weren't recreated after logging in for a 2nd time (without reloading the browser). - Bookmarks list and open rooms list weren't recreated after logging in for a 2nd time (without reloading the browser).
- #1022 Status message not sent out on subsequent presences
- #1024 null reference on MUC Invite - #1024 null reference on MUC Invite
- #1025 OTR lock icon disappears - #1025 OTR lock icon disappears
- #1027 `new Event` not supported in IE11 - #1027 `new Event` not supported in IE11
......
...@@ -45,6 +45,33 @@ ...@@ -45,6 +45,33 @@
"</presence>" "</presence>"
); );
})); }));
it("includes the saved status message",
mock.initConverseWithPromises(
null, ['rosterGroupsFetched'], {},
function (done, _converse) {
test_utils.openControlBox();
var view = _converse.xmppstatusview;
spyOn(view.model, 'sendPresence').and.callThrough();
spyOn(_converse.connection, 'send').and.callThrough();
view.el.querySelector('a.change-xmpp-status-message').click();
var msg = 'My custom status';
view.el.querySelector('input.custom-xmpp-status').value = msg;
view.el.querySelector('[type="submit"]').click();
expect(view.model.sendPresence).toHaveBeenCalled();
expect(_converse.connection.send.calls.mostRecent().args[0].toLocaleString())
.toBe("<presence xmlns='jabber:client'><status>My custom status</status><priority>0</priority></presence>")
view.el.querySelector('a.choose-xmpp-status').click();
view.el.querySelectorAll('.dropdown dd ul li a')[1].click(); // Change status to "dnd"
expect(_converse.connection.send.calls.mostRecent().args[0].toLocaleString())
.toBe("<presence xmlns='jabber:client'><show>dnd</show><status>My custom status</status><priority>0</priority></presence>")
done();
}));
}); });
describe("A received presence stanza", function () { describe("A received presence stanza", function () {
......
...@@ -1503,7 +1503,7 @@ ...@@ -1503,7 +1503,7 @@
constructPresence (type, status_message) { constructPresence (type, status_message) {
let presence; let presence;
type = _.isString(type) ? type : (this.get('status') || _converse.default_state); type = _.isString(type) ? type : (this.get('status') || _converse.default_state);
status_message = _.isString(status_message) ? status_message : undefined; status_message = _.isString(status_message) ? status_message : this.get('status_message');
// Most of these presence types are actually not explicitly sent, // Most of these presence types are actually not explicitly sent,
// but I add all of them here for reference and future proofing. // but I add all of them here for reference and future proofing.
if ((type === 'unavailable') || if ((type === 'unavailable') ||
......
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