compose_state: Rename compost_state.recipient to be about PMs only.

The compose_state.recipient field was only actually the recipient for
the message if it was a private_message_recipient (in the sense of
other code); we store the stream in compose_state.stream instead.

As a result, the name was quite confusing, resulting in the
possibility of problematic correctness bugs where code assumes this
field has a valid value for stream messages.  Fix this by changing it
to compose_state.private_message_recipient for clarity.
This commit is contained in:
Tim Abbott
2019-12-02 08:53:55 -08:00
parent 65270419b9
commit ea7c6d395f
13 changed files with 34 additions and 33 deletions

View File

@@ -41,7 +41,7 @@ exports.topic = get_or_set('stream_message_recipient_topic');
// We can't trim leading whitespace in `compose_textarea` because
// of the indented syntax for multi-line code blocks.
exports.message_content = get_or_set('compose-textarea', true);
exports.recipient = function (value) {
exports.private_message_recipient = function (value) {
if (typeof value === "string") {
compose_pm_pill.set_from_emails(value);
} else {