markdown: Simulate message flags in frontend markdown processor.

This eliminates an annoying bundle of complexity that caused the
frontend markdown processor's interface with the rest of Zulip's new
message processing code paths being more similar to that of a new
message from the server.

It also cuts down on code duplication.
This commit is contained in:
Tim Abbott
2022-03-23 23:01:47 -07:00
committed by Tim Abbott
parent 2dd0b386fe
commit 00332fd49d
4 changed files with 61 additions and 65 deletions

View File

@@ -79,20 +79,6 @@ export function set_message_booleans(message) {
delete message.flags;
}
export function init_booleans(message) {
// This initializes booleans for the local-echo path where
// we don't have flags from the server yet. (We want to
// explicitly set flags to false to be consistent with other
// codepaths.)
message.unread = false;
message.historical = false;
message.starred = false;
message.mentioned = false;
message.mentioned_me_directly = false;
message.collapsed = false;
message.alerted = false;
}
export function update_booleans(message, flags) {
// When we get server flags for local echo or message edits,
// we are vulnerable to race conditions, so only update flags