snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
This commit is contained in:
62
web/tests/conversation_participants.test.cjs
Normal file
62
web/tests/conversation_participants.test.cjs
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {make_user, make_bot} = require("./lib/example_user.cjs");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const people = zrequire("people");
|
||||
const {ConversationParticipants} = zrequire("../src/conversation_participants.ts");
|
||||
|
||||
const user1 = make_user();
|
||||
const user2 = make_user();
|
||||
const bot1 = make_bot();
|
||||
const bot2 = make_bot();
|
||||
|
||||
people._add_user(user1);
|
||||
people._add_user(user2);
|
||||
people._add_user(bot1);
|
||||
people._add_user(bot2);
|
||||
|
||||
const human_messages = [
|
||||
{
|
||||
id: 1,
|
||||
sender_id: user1.user_id,
|
||||
sent_by_me: true,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
sender_id: user2.user_id,
|
||||
sent_by_me: false,
|
||||
},
|
||||
];
|
||||
|
||||
const bot_messages = [
|
||||
{
|
||||
id: 4,
|
||||
sender_id: bot1.user_id,
|
||||
sent_by_me: false,
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
sender_id: bot2.user_id,
|
||||
sent_by_me: false,
|
||||
},
|
||||
];
|
||||
|
||||
const all_messages = [...human_messages, ...bot_messages];
|
||||
|
||||
run_test("Add participants", () => {
|
||||
const participants = new ConversationParticipants(all_messages);
|
||||
assert.ok(_.isEqual(participants.humans, new Set([user1.user_id, user2.user_id])));
|
||||
assert.ok(_.isEqual(participants.bots, new Set([bot1.user_id, bot2.user_id])));
|
||||
// None since they were not added as active users.
|
||||
assert.equal(participants.visible().size, 0);
|
||||
|
||||
// Add user1 as active user.
|
||||
people.add_active_user(user1);
|
||||
assert.ok(_.isEqual(participants.visible(), new Set([user1.user_id])));
|
||||
});
|
||||
Reference in New Issue
Block a user