compose: Distinguish get_message_type() from composing().

We now only call compose_state.composing() in a boolean context,
where we simply care whether or not the compose box is open.  The
function now also returns true/false.

Callers who need to know the actual message type (e.g. "stream" or
"private") now call compose_state.get_message_type().
This commit is contained in:
Steve Howell
2017-04-24 11:35:26 -07:00
committed by Tim Abbott
parent 2adf641b72
commit c999bdf823
8 changed files with 18 additions and 19 deletions

View File

@@ -13,14 +13,9 @@ exports.get_message_type = function () {
};
exports.composing = function () {
// For legacy reasons, this is the same as get_message_type.
// Most callers use this in a boolean context, but there are
// some stragglers that inspect the string value.
//
// TODO: Fix callers who care about stream/private to use
// get_message_type(), and then convert this to return
// `!!message_type` or something like that.
return message_type;
// This is very similar to get_message_type(), but it returns
// a boolean.
return !!message_type;
};
function get_or_set(fieldname, keep_leading_whitespace) {