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.

message_list: Fix `just_unsubscribed` for empty views.

Aman Agrawalafbc6f251070
diff --git a/web/src/message_list.ts b/web/src/message_list.ts
index 8ccf74b4fdc..83dc74941ea 100644
--- a/web/src/message_list.ts
+++ b/web/src/message_list.ts
@@ -469,7 +469,7 @@ export class MessageList {
const is_web_public = sub?.is_web_public;
if (sub === undefined || sub.is_archived) {
deactivated = true;
- } else if (!subscribed && !this.last_message_historical) {
+ } else if (!subscribed && !this.last_message_historical && !this.empty()) {
just_unsubscribed = true;
}
diff --git a/web/tests/message_list.test.cjs b/web/tests/message_list.test.cjs
index 669e00200a2..c492c98b7da 100644
--- a/web/tests/message_list.test.cjs
+++ b/web/tests/message_list.test.cjs
@@ -387,6 +387,29 @@ run_test("bookend", ({override}) => {
list.last_message_historical = false;
is_subscribed = false;
+ {
+ const stub = make_stub();
+ list.view.render_trailing_bookend = stub.f;
+ list.update_trailing_bookend();
+ assert.equal(stub.num_calls, 1);
+ const bookend = stub.get_args(
+ "stream_id",
+ "stream_name",
+ "subscribed",
+ "deactivated",
+ "just_unsubscribed",
+ );
+ assert.equal(bookend.stream_id, 5);
+ assert.equal(bookend.stream_name, "IceCream");
+ assert.equal(bookend.subscribed, false);
+ assert.equal(bookend.deactivated, false);
+ assert.equal(bookend.just_unsubscribed, false);
+ }
+
+ list.last_message_historical = false;
+ is_subscribed = false;
+ list.empty = () => false;
+
{
const stub = make_stub();
list.view.render_trailing_bookend = stub.f;