diff --git a/CHANGES.md b/CHANGES.md index 239beeaf1..f5425ecc7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,7 @@ - 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). +- #1022 Status message not sent out on subsequent presences - #1024 null reference on MUC Invite - #1025 OTR lock icon disappears - #1027 `new Event` not supported in IE11 diff --git a/spec/presence.js b/spec/presence.js index 289afd95e..f48cea17b 100644 --- a/spec/presence.js +++ b/spec/presence.js @@ -45,6 +45,33 @@ "" ); })); + + 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("My custom status0") + + 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("dndMy custom status0") + done(); + })); }); describe("A received presence stanza", function () { diff --git a/src/converse-core.js b/src/converse-core.js index c9577e85b..f66fb4a71 100644 --- a/src/converse-core.js +++ b/src/converse-core.js @@ -1503,7 +1503,7 @@ constructPresence (type, status_message) { let presence; 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, // but I add all of them here for reference and future proofing. if ((type === 'unavailable') ||