mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
typing: Fix invalid typing notifications for stream messages.
In e42c3f7418, we made the assumption
that compose_pm_pill.get_recipient() would return no users for stream
messages. It turns out, due to the confusing name of
compose_state.recipient (which we just renamed to
compose_state.private_message_recipient), this assumption was wrong.
As a result, when composing a stream message using the reply hotkeys,
we'd end up sending typing notiifcations to the person who sent the
message we're replying to as though a PM was being composed.
We fix this by avoiding passing an (expected to be unused) value for
private_message_recipient to compose_state.start.
This commit is contained in:
@@ -227,6 +227,13 @@ exports.start = function (msg_type, opts) {
|
||||
clear_box();
|
||||
}
|
||||
|
||||
// We set the stream/topic/private_message_recipient
|
||||
// unconditionally here, which assumes the caller will have passed
|
||||
// '' or undefined for these values if they are not appropriate
|
||||
// for this message.
|
||||
//
|
||||
// TODO: Move these into a conditional on message_type, using an
|
||||
// explicit "clear" function for compose_state.
|
||||
compose_state.stream_name(opts.stream);
|
||||
compose_state.topic(opts.topic);
|
||||
|
||||
@@ -313,15 +320,23 @@ exports.respond_to_message = function (opts) {
|
||||
unread_ops.notify_server_message_read(message);
|
||||
}
|
||||
|
||||
let stream = '';
|
||||
let topic = '';
|
||||
if (message.type === "stream") {
|
||||
stream = message.stream;
|
||||
topic = util.get_message_topic(message);
|
||||
// Important note: A reply_type of 'personal' is for the R hotkey
|
||||
// (replying to a message's sender with a private message). All
|
||||
// other replies can just copy message.type.
|
||||
if (opts.reply_type === 'personal' || message.type === 'private') {
|
||||
msg_type = 'private';
|
||||
} else {
|
||||
msg_type = message.type;
|
||||
}
|
||||
|
||||
let pm_recipient = message.reply_to;
|
||||
if (message.type === "private") {
|
||||
let stream = '';
|
||||
let topic = '';
|
||||
let pm_recipient = '';
|
||||
if (msg_type === "stream") {
|
||||
stream = message.stream;
|
||||
topic = util.get_message_topic(message);
|
||||
} else {
|
||||
pm_recipient = message.reply_to;
|
||||
if (opts.reply_type === "personal") {
|
||||
// reply_to for private messages is everyone involved, so for
|
||||
// personals replies we need to set the private message
|
||||
@@ -331,11 +346,7 @@ exports.respond_to_message = function (opts) {
|
||||
pm_recipient = people.pm_reply_to(message);
|
||||
}
|
||||
}
|
||||
if (opts.reply_type === 'personal' || message.type === 'private') {
|
||||
msg_type = 'private';
|
||||
} else {
|
||||
msg_type = message.type;
|
||||
}
|
||||
|
||||
exports.start(msg_type, {stream: stream, topic: topic,
|
||||
private_message_recipient: pm_recipient,
|
||||
trigger: opts.trigger});
|
||||
|
||||
Reference in New Issue
Block a user