Fixes #1022 Include stored status message in presences.

This commit is contained in:
JC Brand 2018-03-02 19:35:06 +01:00
parent 38dfc7b65b
commit c4c154cfa1
3 changed files with 29 additions and 1 deletions

View File

@ -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

View File

@ -45,6 +45,33 @@
"</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 () {

View File

@ -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') ||