mirror of https://github.com/zulip/zulip.git
send_message: Fix 'sent_by_this_client' incorrectly set.
Messages that are not delivered locally like slash command messages, messages with backend only syntax, etc are processed by 'echo.process_from_server' function. Earlier, in 'echo.process_from_server' we were clearing out the local IDs of non-echoed messages and then a check to set 'sent_by_this_client' based on local_id. This led to 'sent_by_this_client' incorrectly set to False as the local_id is already deleted. This commit fixes the incorrect behavior. We first determine the 'sent_by_this_client' on the basis of local_id and then we delete.
This commit is contained in:
parent
7de527f3bc
commit
8d868ec149
|
@ -388,7 +388,6 @@ export function process_from_server(messages) {
|
|||
// the "main" codepath that doesn't have to id reconciliation.
|
||||
// We simply return non-echo messages to our caller.
|
||||
non_echo_messages.push(message);
|
||||
sent_messages.report_event_received(local_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,9 +106,13 @@ function get_events_success(events) {
|
|||
try {
|
||||
messages = echo.process_from_server(messages);
|
||||
if (messages.length > 0) {
|
||||
const sent_by_this_client = messages.some((msg) =>
|
||||
sent_messages.messages.has(msg.local_id),
|
||||
);
|
||||
let sent_by_this_client = false;
|
||||
for (const msg of messages) {
|
||||
if (sent_messages.messages.has(msg.local_id)) {
|
||||
sent_by_this_client = true;
|
||||
}
|
||||
sent_messages.report_event_received(msg.local_id);
|
||||
}
|
||||
// If some message in this batch of events was sent by this
|
||||
// client, almost every time, this message will be the only one
|
||||
// in messages, because multiple messages being returned by
|
||||
|
|
Loading…
Reference in New Issue