From 387bb6f3a4f56d7a2f70661975a90e08e422b1e4 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Fri, 27 Feb 2015 18:32:23 +0100 Subject: [PATCH] Bugfix. Custom status message form does not submit/disappear. --- converse.js | 14 ++++++++------ docs/CHANGES.rst | 1 + 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/converse.js b/converse.js index 0ed157a44..b83b4a489 100644 --- a/converse.js +++ b/converse.js @@ -4320,6 +4320,7 @@ setStatusMessage: function (status_message) { this.sendPresence(this.getStatus(), status_message); + var prev_status = this.get('status_message'); this.save({'status_message': status_message}); if (this.xhr_custom_status) { $.ajax({ @@ -4328,6 +4329,9 @@ data: {'msg': status_message} }); } + if (prev_status === status_message) { + this.trigger("update-status-ui", this); + } } }); @@ -4342,7 +4346,9 @@ }, initialize: function () { - this.model.on("change", this.updateStatusUI, this); + this.model.on("change:status", this.updateStatusUI, this); + this.model.on("change:status_message", this.updateStatusUI, this); + this.model.on("update-status-ui", this.updateStatusUI, this); }, render: function () { @@ -4393,8 +4399,7 @@ setStatusMessage: function (ev) { ev.preventDefault(); - var status_message = $(ev.target).find('input').val(); - this.model.setStatusMessage(status_message); + this.model.setStatusMessage($(ev.target).find('input').val()); }, setStatus: function (ev) { @@ -4427,9 +4432,6 @@ }, updateStatusUI: function (model) { - if (!(_.has(model.changed, 'status')) && !(_.has(model.changed, 'status_message'))) { - return; - } var stat = model.get('status'); // # For translators: the %1$s part gets replaced with the status // # Example, I am online diff --git a/docs/CHANGES.rst b/docs/CHANGES.rst index 90b0fb260..a1114f421 100644 --- a/docs/CHANGES.rst +++ b/docs/CHANGES.rst @@ -4,6 +4,7 @@ Changelog 0.9.0 (Unreleased) ------------------ +* Bugfix. Custom status message form doesn't submit/disappear. [jcbrand] * Add new API method ``chats.open`` to open chat boxes. [jcbrand] * Add new API method to set and get configuration settings. [jcbrand] * Add responsiveness to CSS. We now use Sass preprocessor for generating CSS. [jcbrand]