Commit 387bb6f3 authored by JC Brand's avatar JC Brand

Bugfix. Custom status message form does not submit/disappear.

parent a603913a
...@@ -4320,6 +4320,7 @@ ...@@ -4320,6 +4320,7 @@
setStatusMessage: function (status_message) { setStatusMessage: function (status_message) {
this.sendPresence(this.getStatus(), status_message); this.sendPresence(this.getStatus(), status_message);
var prev_status = this.get('status_message');
this.save({'status_message': status_message}); this.save({'status_message': status_message});
if (this.xhr_custom_status) { if (this.xhr_custom_status) {
$.ajax({ $.ajax({
...@@ -4328,6 +4329,9 @@ ...@@ -4328,6 +4329,9 @@
data: {'msg': status_message} data: {'msg': status_message}
}); });
} }
if (prev_status === status_message) {
this.trigger("update-status-ui", this);
}
} }
}); });
...@@ -4342,7 +4346,9 @@ ...@@ -4342,7 +4346,9 @@
}, },
initialize: function () { 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 () { render: function () {
...@@ -4393,8 +4399,7 @@ ...@@ -4393,8 +4399,7 @@
setStatusMessage: function (ev) { setStatusMessage: function (ev) {
ev.preventDefault(); ev.preventDefault();
var status_message = $(ev.target).find('input').val(); this.model.setStatusMessage($(ev.target).find('input').val());
this.model.setStatusMessage(status_message);
}, },
setStatus: function (ev) { setStatus: function (ev) {
...@@ -4427,9 +4432,6 @@ ...@@ -4427,9 +4432,6 @@
}, },
updateStatusUI: function (model) { updateStatusUI: function (model) {
if (!(_.has(model.changed, 'status')) && !(_.has(model.changed, 'status_message'))) {
return;
}
var stat = model.get('status'); var stat = model.get('status');
// # For translators: the %1$s part gets replaced with the status // # For translators: the %1$s part gets replaced with the status
// # Example, I am online // # Example, I am online
......
...@@ -4,6 +4,7 @@ Changelog ...@@ -4,6 +4,7 @@ Changelog
0.9.0 (Unreleased) 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 ``chats.open`` to open chat boxes. [jcbrand]
* Add new API method to set and get configuration settings. [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] * Add responsiveness to CSS. We now use Sass preprocessor for generating CSS. [jcbrand]
......
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