compose: Don't clear compose box on narrow if it matches compose.

If we're entering a topic narrow, and the compose topic is the same as
narrowed topic, then leave the compose box open.

This is important if you open compose in a topic narrow, click on a
narrow, and then use the back button to return to that original
narrow.  Before this change, we'd close the compose box for no reason.

Fixes #6510.
This commit is contained in:
Aastha Gupta 2017-12-15 01:32:49 +05:30 committed by Tim Abbott
parent 25d9731a3c
commit dc60b3a44b
1 changed files with 6 additions and 1 deletions

View File

@ -354,7 +354,12 @@ exports.on_topic_narrow = function () {
// appropriate (after all, they were starting to
// compose on the old topic and may now be looking
// for info), so we punt and cancel.
exports.cancel();
// If subject is not same as topic narrowed to then
// stop composing
if (compose_state.subject().toLowerCase() !== narrow_state.topic().toLowerCase()) {
exports.cancel();
}
return;
}