Populate stream_id when composing messages.

This commit is contained in:
Steve Howell 2017-02-22 19:08:05 -08:00 committed by Tim Abbott
parent 98a627cba8
commit 49ab8035f8
1 changed files with 10 additions and 3 deletions

View File

@ -321,12 +321,12 @@ function create_message_object() {
// Changes here must also be kept in sync with echo.try_deliver_locally
var message = {
type: compose.composing(),
subject: subject,
stream: compose.stream_name(),
private_message_recipient: compose.recipient(),
content: content,
sender_id: page_params.user_id,
queue_id: page_params.event_queue_id,
stream: '',
subject: '',
};
if (message.type === "private") {
@ -334,7 +334,14 @@ function create_message_object() {
message.to = util.extract_pm_recipients(compose.recipient());
message.reply_to = compose.recipient();
} else {
message.to = compose.stream_name();
var stream_name = compose.stream_name();
message.to = stream_name;
message.stream = stream_name;
var sub = stream_data.get_sub(stream_name);
if (sub) {
message.stream_id = sub.stream_id;
}
message.subject = subject;
}
return message;
}