Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

unread_ops: Handle mark as unread when below messages are not loaded.

Pratik Chanda50ffc12b4fd8
diff --git a/web/src/unread_ops.ts b/web/src/unread_ops.ts
index 80403b2f834..a233f38f49b 100644
--- a/web/src/unread_ops.ts
+++ b/web/src/unread_ops.ts
@@ -433,16 +433,20 @@ export function mark_as_unread_from_here(message_id: number): void {
return;
}
- display_count = locally_available_message_count.toString();
- } else if (locally_available_message_count < UNREAD_COUNT_STEP_SIZE) {
display_count = locally_available_message_count.toString();
} else {
- // Otherwise, we round down to the nearest
- // UNREAD_COUNT_STEP_SIZE and display as, e.g., `25+`.
- const rounded_count =
- Math.floor(locally_available_message_count / UNREAD_COUNT_STEP_SIZE) *
- UNREAD_COUNT_STEP_SIZE;
- display_count = `${rounded_count}+`;
+ // We don't have all the newest messages, so there are likely more
+ // available messages that will be marked as unread.
+ if (locally_available_message_count < UNREAD_COUNT_STEP_SIZE) {
+ display_count = `${locally_available_message_count.toString()}+`;
+ } else {
+ // Otherwise, we round down to the nearest
+ // UNREAD_COUNT_STEP_SIZE and display as, e.g., `25+`.
+ const rounded_count =
+ Math.floor(locally_available_message_count / UNREAD_COUNT_STEP_SIZE) *
+ UNREAD_COUNT_STEP_SIZE;
+ display_count = `${rounded_count}+`;
+ }
}
// If we don't know how many messages will be affected, but