Expand the compose box in the correct mode when narrowed to PMs.

(imported from commit 68e4bb3091b855dafda8df3ca10737abb5d2f337)
This commit is contained in:
Jessica McKellar
2013-05-24 16:00:23 -04:00
parent c1a067857b
commit 1ac44f0356
2 changed files with 18 additions and 1 deletions

View File

@@ -555,7 +555,11 @@ $(function () {
$("#new_message_content").click(function (e) {
// If we click in the composebox, start up a new message
if (!compose.composing()) {
if (narrow.narrowed_to_pms()) {
compose.set_mode('private');
} else {
compose.set_mode('stream');
}
e.stopPropagation();
}
});

View File

@@ -603,6 +603,19 @@ exports.by_stream_subject_uri = function (stream, subject) {
"/subject/" + hashchange.encodeHashComponent(subject);
};
exports.narrowed_to_pms = function () {
// Are we narrowed to PMs: all PMs or PMs with particular people.
var operators = narrow.operators();
if (!operators) {
return false;
}
if ((operators[0][0] === "pm-with") ||
((operators[0][0] === "is") && (operators[0][1] === "private-message"))) {
return true;
}
return false;
};
return exports;
}());