mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
message_list: Fix just_unsubscribed for empty views.
This fixes a bug where wrong bookend is shown in empty views in the next commit.
This commit is contained in:
@@ -469,7 +469,7 @@ export class MessageList {
|
|||||||
const is_web_public = sub?.is_web_public;
|
const is_web_public = sub?.is_web_public;
|
||||||
if (sub === undefined || sub.is_archived) {
|
if (sub === undefined || sub.is_archived) {
|
||||||
deactivated = true;
|
deactivated = true;
|
||||||
} else if (!subscribed && !this.last_message_historical) {
|
} else if (!subscribed && !this.last_message_historical && !this.empty()) {
|
||||||
just_unsubscribed = true;
|
just_unsubscribed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -387,6 +387,29 @@ run_test("bookend", ({override}) => {
|
|||||||
list.last_message_historical = false;
|
list.last_message_historical = false;
|
||||||
is_subscribed = 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();
|
const stub = make_stub();
|
||||||
list.view.render_trailing_bookend = stub.f;
|
list.view.render_trailing_bookend = stub.f;
|
||||||
|
|||||||
Reference in New Issue
Block a user