2020-07-20 23:53:59 +02:00
|
|
|
"use strict";
|
|
|
|
|
2020-11-30 23:46:45 +01:00
|
|
|
const {strict: assert} = require("assert");
|
|
|
|
|
2021-06-28 00:41:05 +02:00
|
|
|
const {mock_esm, zrequire} = require("../zjsunit/namespace");
|
2020-12-01 00:39:47 +01:00
|
|
|
const {run_test} = require("../zjsunit/test");
|
2021-02-21 15:38:51 +01:00
|
|
|
const $ = require("../zjsunit/zjquery");
|
2021-07-28 16:00:58 +02:00
|
|
|
const {page_params, user_settings} = require("../zjsunit/zpage_params");
|
2020-12-01 00:02:16 +01:00
|
|
|
|
2020-07-20 23:53:59 +02:00
|
|
|
const noop = () => {};
|
2021-06-14 11:01:48 +02:00
|
|
|
|
2021-03-10 06:10:32 +01:00
|
|
|
const typeahead_helper = mock_esm("../../static/js/typeahead_helper");
|
|
|
|
const ui = mock_esm("../../static/js/ui", {
|
2021-03-07 13:57:14 +01:00
|
|
|
get_scroll_element: noop,
|
|
|
|
});
|
|
|
|
|
2021-03-22 16:09:12 +01:00
|
|
|
mock_esm("../../static/js/browser_history", {update: noop});
|
2021-03-10 06:10:32 +01:00
|
|
|
mock_esm("../../static/js/hash_util", {
|
2020-07-20 23:53:59 +02:00
|
|
|
stream_edit_uri: noop,
|
|
|
|
by_stream_uri: noop,
|
2021-03-15 06:57:14 +01:00
|
|
|
active_stream: noop,
|
2020-07-20 23:53:59 +02:00
|
|
|
});
|
2021-03-10 06:10:32 +01:00
|
|
|
mock_esm("../../static/js/list_widget", {
|
2020-07-20 23:53:59 +02:00
|
|
|
create: () => ({init: noop}),
|
|
|
|
});
|
2021-03-10 06:10:32 +01:00
|
|
|
mock_esm("../../static/js/stream_color", {
|
2020-07-20 23:53:59 +02:00
|
|
|
set_colorpicker_color: noop,
|
|
|
|
});
|
2021-06-26 15:28:24 +02:00
|
|
|
mock_esm("../../static/js/components", {
|
|
|
|
toggle: () => ({
|
|
|
|
get: () => [],
|
|
|
|
}),
|
|
|
|
});
|
2021-03-06 17:37:51 +01:00
|
|
|
|
2021-01-12 21:38:01 +01:00
|
|
|
const peer_data = zrequire("peer_data");
|
2020-08-20 21:24:06 +02:00
|
|
|
const people = zrequire("people");
|
2021-02-10 04:53:22 +01:00
|
|
|
const stream_data = zrequire("stream_data");
|
2021-03-07 13:57:14 +01:00
|
|
|
const stream_edit = zrequire("stream_edit");
|
2021-02-10 04:53:22 +01:00
|
|
|
const stream_pill = zrequire("stream_pill");
|
2021-04-05 12:54:38 +02:00
|
|
|
const user_groups = zrequire("user_groups");
|
|
|
|
const user_group_pill = zrequire("user_group_pill");
|
2021-02-10 04:53:22 +01:00
|
|
|
const user_pill = zrequire("user_pill");
|
2021-12-18 18:47:21 +01:00
|
|
|
const stream_subscribers_ui = zrequire("stream_subscribers_ui");
|
2021-06-26 15:28:24 +02:00
|
|
|
const stream_ui_updates = zrequire("stream_ui_updates");
|
2021-07-23 19:42:57 +02:00
|
|
|
const settings_config = zrequire("settings_config");
|
2020-07-20 23:53:59 +02:00
|
|
|
|
|
|
|
const jill = {
|
|
|
|
email: "jill@zulip.com",
|
|
|
|
user_id: 10,
|
|
|
|
full_name: "Jill Hill",
|
|
|
|
};
|
|
|
|
const mark = {
|
|
|
|
email: "mark@zulip.com",
|
|
|
|
user_id: 20,
|
|
|
|
full_name: "Marky Mark",
|
|
|
|
};
|
|
|
|
const fred = {
|
|
|
|
email: "fred@zulip.com",
|
|
|
|
user_id: 30,
|
|
|
|
full_name: "Fred Flintstone",
|
|
|
|
};
|
|
|
|
const me = {
|
|
|
|
email: "me@example.com",
|
|
|
|
user_id: 40,
|
|
|
|
full_name: "me",
|
|
|
|
};
|
|
|
|
|
|
|
|
const persons = [jill, mark, fred, me];
|
|
|
|
for (const person of persons) {
|
|
|
|
people.add_active_user(person);
|
|
|
|
}
|
|
|
|
|
2021-04-05 12:54:38 +02:00
|
|
|
const admins = {
|
|
|
|
name: "Admins",
|
|
|
|
description: "foo",
|
|
|
|
id: 1,
|
|
|
|
members: [jill.user_id, mark.user_id],
|
|
|
|
};
|
|
|
|
const testers = {
|
|
|
|
name: "Testers",
|
|
|
|
description: "bar",
|
|
|
|
id: 2,
|
|
|
|
members: [mark.user_id, fred.user_id, me.user_id],
|
|
|
|
};
|
|
|
|
|
|
|
|
const groups = [admins, testers];
|
|
|
|
for (const group of groups) {
|
|
|
|
user_groups.add(group);
|
|
|
|
}
|
|
|
|
|
2020-07-20 23:53:59 +02:00
|
|
|
const denmark = {
|
|
|
|
stream_id: 1,
|
|
|
|
name: "Denmark",
|
|
|
|
subscribed: true,
|
|
|
|
render_subscribers: true,
|
|
|
|
};
|
2021-01-13 22:03:25 +01:00
|
|
|
peer_data.set_subscribers(denmark.stream_id, [me.user_id, mark.user_id]);
|
2021-01-12 16:05:24 +01:00
|
|
|
|
2020-07-20 23:53:59 +02:00
|
|
|
const sweden = {
|
|
|
|
stream_id: 2,
|
|
|
|
name: "Sweden",
|
|
|
|
subscribed: false,
|
|
|
|
};
|
2021-01-13 22:03:25 +01:00
|
|
|
peer_data.set_subscribers(sweden.stream_id, [mark.user_id, jill.user_id]);
|
2020-07-20 23:53:59 +02:00
|
|
|
|
|
|
|
const subs = [denmark, sweden];
|
|
|
|
for (const sub of subs) {
|
|
|
|
stream_data.add_sub(sub);
|
|
|
|
}
|
|
|
|
|
2021-02-21 13:30:55 +01:00
|
|
|
function test_ui(label, f) {
|
2021-06-28 00:41:05 +02:00
|
|
|
run_test(label, ({override, mock_template}) => {
|
2021-04-03 19:07:13 +02:00
|
|
|
page_params.user_id = me.user_id;
|
2021-12-18 18:47:21 +01:00
|
|
|
stream_subscribers_ui.initialize();
|
2021-02-21 13:30:55 +01:00
|
|
|
stream_edit.initialize();
|
2021-06-28 00:41:05 +02:00
|
|
|
f({override, mock_template});
|
2021-02-21 13:30:55 +01:00
|
|
|
});
|
|
|
|
}
|
2020-07-20 23:53:59 +02:00
|
|
|
|
2021-06-28 00:41:05 +02:00
|
|
|
test_ui("subscriber_pills", ({override, mock_template}) => {
|
|
|
|
mock_template("input_pill.hbs", true, (data, html) => {
|
2021-06-27 15:55:51 +02:00
|
|
|
assert.equal(typeof data.display_value, "string");
|
|
|
|
return html;
|
|
|
|
});
|
2021-07-18 13:49:31 +02:00
|
|
|
mock_template("stream_settings/stream_settings.hbs", false, () => "stream_settings");
|
2021-06-30 22:57:50 +02:00
|
|
|
mock_template(
|
2021-07-19 12:12:30 +02:00
|
|
|
"stream_settings/stream_subscription_request_result.hbs",
|
2021-06-30 22:57:50 +02:00
|
|
|
false,
|
|
|
|
() => "stream_subscription_request_result",
|
|
|
|
);
|
2021-06-27 15:55:51 +02:00
|
|
|
|
2021-12-15 18:48:33 +01:00
|
|
|
override(people, "sort_but_pin_current_user_on_top", noop);
|
2021-03-13 20:06:12 +01:00
|
|
|
|
2021-12-21 19:41:13 +01:00
|
|
|
const subscriptions_table_selector = "#manage_streams_container";
|
2021-02-21 13:30:55 +01:00
|
|
|
const input_field_stub = $.create(".input");
|
|
|
|
|
2021-02-22 14:41:35 +01:00
|
|
|
input_field_stub.before = () => {};
|
|
|
|
|
2021-02-21 13:30:55 +01:00
|
|
|
const sub_settings_selector = `#subscription_overlay .subscription_settings[data-stream-id='${CSS.escape(
|
|
|
|
denmark.stream_id,
|
|
|
|
)}']`;
|
2020-07-20 23:53:59 +02:00
|
|
|
|
2021-12-15 15:33:56 +01:00
|
|
|
const pill_container_stub = $.create("pill-container-stub");
|
2021-02-23 14:37:26 +01:00
|
|
|
pill_container_stub.find = () => input_field_stub;
|
2020-07-20 23:53:59 +02:00
|
|
|
|
2021-12-15 15:33:56 +01:00
|
|
|
const $sub_settings_container = $.create(sub_settings_selector);
|
2021-12-21 17:39:05 +01:00
|
|
|
const $edit_subscribers_container = $.create("edit-subscribers-stub");
|
2021-12-22 14:28:40 +01:00
|
|
|
const $unused = $.create("unused");
|
2021-12-15 15:33:56 +01:00
|
|
|
|
2021-12-22 14:28:40 +01:00
|
|
|
$sub_settings_container.set_find_results(".colorpicker", $unused);
|
|
|
|
$sub_settings_container.set_find_results(
|
|
|
|
".edit_subscribers_for_stream",
|
|
|
|
$edit_subscribers_container,
|
|
|
|
);
|
|
|
|
|
|
|
|
$edit_subscribers_container.set_find_results(".pill-container", pill_container_stub);
|
|
|
|
$edit_subscribers_container.set_find_results(".search", $unused);
|
|
|
|
$edit_subscribers_container.set_find_results(".subscriber_table", $unused);
|
|
|
|
$edit_subscribers_container.set_find_results(".subscriber_list_container", $unused);
|
2021-12-15 15:33:56 +01:00
|
|
|
|
2021-02-21 13:30:55 +01:00
|
|
|
const $subscription_settings = $.create(".subscription_settings");
|
|
|
|
$subscription_settings.addClass = noop;
|
|
|
|
$subscription_settings.closest = () => $subscription_settings;
|
|
|
|
$subscription_settings.attr("data-stream-id", denmark.stream_id);
|
|
|
|
$subscription_settings.length = 0;
|
2020-07-20 23:53:59 +02:00
|
|
|
|
2021-12-21 17:39:05 +01:00
|
|
|
const $add_subscribers_form = $.create(
|
|
|
|
".edit_subscribers_for_stream .subscriber_list_add form",
|
|
|
|
);
|
2021-02-21 13:30:55 +01:00
|
|
|
$add_subscribers_form.closest = () => $subscription_settings;
|
2020-07-20 23:53:59 +02:00
|
|
|
|
|
|
|
let template_rendered = false;
|
|
|
|
ui.get_content_element = () => {
|
|
|
|
template_rendered = true;
|
|
|
|
return {html: noop};
|
|
|
|
};
|
|
|
|
|
|
|
|
let expected_user_ids = [];
|
|
|
|
let input_typeahead_called = false;
|
|
|
|
let add_subscribers_request = false;
|
2021-12-18 18:47:21 +01:00
|
|
|
override(stream_subscribers_ui, "invite_user_to_stream", (user_ids, sub) => {
|
2020-07-20 23:53:59 +02:00
|
|
|
assert.equal(sub.stream_id, denmark.stream_id);
|
2021-01-12 16:05:24 +01:00
|
|
|
assert.deepEqual(user_ids.sort(), expected_user_ids.sort());
|
2020-07-20 23:53:59 +02:00
|
|
|
add_subscribers_request = true;
|
2021-02-28 00:55:38 +01:00
|
|
|
});
|
2020-07-20 23:53:59 +02:00
|
|
|
|
2021-02-23 14:37:26 +01:00
|
|
|
input_field_stub.typeahead = (config) => {
|
2020-07-20 23:53:59 +02:00
|
|
|
assert.equal(config.items, 5);
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(config.fixed);
|
|
|
|
assert.ok(config.dropup);
|
|
|
|
assert.ok(config.stopAdvance);
|
2020-07-20 23:53:59 +02:00
|
|
|
|
|
|
|
assert.equal(typeof config.source, "function");
|
|
|
|
assert.equal(typeof config.highlighter, "function");
|
|
|
|
assert.equal(typeof config.matcher, "function");
|
|
|
|
assert.equal(typeof config.sorter, "function");
|
|
|
|
assert.equal(typeof config.updater, "function");
|
|
|
|
|
2021-04-05 12:54:38 +02:00
|
|
|
const fake_stream_this = {
|
2020-07-20 23:53:59 +02:00
|
|
|
query: "#Denmark",
|
|
|
|
};
|
2021-04-05 12:54:38 +02:00
|
|
|
const fake_person_this = {
|
|
|
|
query: "me",
|
|
|
|
};
|
|
|
|
const fake_group_this = {
|
|
|
|
query: "test",
|
|
|
|
};
|
2020-07-20 23:53:59 +02:00
|
|
|
|
|
|
|
(function test_highlighter() {
|
2021-04-05 12:54:38 +02:00
|
|
|
const fake_html = $.create("fake-html");
|
|
|
|
typeahead_helper.render_stream = function () {
|
|
|
|
return fake_html;
|
|
|
|
};
|
|
|
|
assert.equal(config.highlighter.call(fake_stream_this, denmark), fake_html);
|
|
|
|
|
2021-06-01 22:40:45 +02:00
|
|
|
typeahead_helper.render_user_group = function () {
|
2021-04-05 12:54:38 +02:00
|
|
|
return fake_html;
|
|
|
|
};
|
2021-06-01 22:40:45 +02:00
|
|
|
|
|
|
|
typeahead_helper.render_person = function () {
|
|
|
|
return fake_html;
|
|
|
|
};
|
|
|
|
|
2021-04-05 12:54:38 +02:00
|
|
|
assert.equal(config.highlighter.call(fake_group_this, testers), fake_html);
|
|
|
|
assert.equal(config.highlighter.call(fake_person_this, me), fake_html);
|
2020-07-20 23:53:59 +02:00
|
|
|
})();
|
|
|
|
|
|
|
|
(function test_matcher() {
|
2021-04-05 12:54:38 +02:00
|
|
|
let result = config.matcher.call(fake_stream_this, denmark);
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(result);
|
2021-04-05 12:54:38 +02:00
|
|
|
result = config.matcher.call(fake_stream_this, sweden);
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(!result);
|
2020-07-20 23:53:59 +02:00
|
|
|
|
2021-04-05 12:54:38 +02:00
|
|
|
result = config.matcher.call(fake_group_this, testers);
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(result);
|
2021-04-05 12:54:38 +02:00
|
|
|
result = config.matcher.call(fake_group_this, admins);
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(!result);
|
2021-04-05 12:54:38 +02:00
|
|
|
|
|
|
|
result = config.matcher.call(fake_person_this, me);
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(result);
|
2021-04-05 12:54:38 +02:00
|
|
|
result = config.matcher.call(fake_person_this, jill);
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(!result);
|
2020-07-20 23:53:59 +02:00
|
|
|
})();
|
|
|
|
|
|
|
|
(function test_sorter() {
|
|
|
|
let sort_streams_called = false;
|
2021-02-23 14:37:26 +01:00
|
|
|
typeahead_helper.sort_streams = () => {
|
2020-07-20 23:53:59 +02:00
|
|
|
sort_streams_called = true;
|
|
|
|
};
|
2021-04-05 12:54:38 +02:00
|
|
|
config.sorter.call(fake_stream_this);
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(sort_streams_called);
|
2021-04-05 12:54:38 +02:00
|
|
|
|
|
|
|
let sort_recipients_called = false;
|
|
|
|
typeahead_helper.sort_recipients = function () {
|
|
|
|
sort_recipients_called = true;
|
|
|
|
};
|
|
|
|
config.sorter.call(fake_group_this, [testers]);
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(sort_recipients_called);
|
2021-04-05 12:54:38 +02:00
|
|
|
|
|
|
|
sort_recipients_called = false;
|
|
|
|
config.sorter.call(fake_person_this, [me]);
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(sort_recipients_called);
|
2020-07-20 23:53:59 +02:00
|
|
|
})();
|
|
|
|
|
|
|
|
(function test_updater() {
|
|
|
|
function number_of_pills() {
|
2021-12-18 18:47:21 +01:00
|
|
|
const pills = stream_subscribers_ui.pill_widget.items();
|
2020-07-20 23:53:59 +02:00
|
|
|
return pills.length;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(number_of_pills(), 0);
|
2021-04-05 12:54:38 +02:00
|
|
|
config.updater.call(fake_stream_this, denmark);
|
2020-07-20 23:53:59 +02:00
|
|
|
assert.equal(number_of_pills(), 1);
|
2021-04-05 12:54:38 +02:00
|
|
|
config.updater.call(fake_person_this, me);
|
2020-07-20 23:53:59 +02:00
|
|
|
assert.equal(number_of_pills(), 2);
|
2021-04-05 12:54:38 +02:00
|
|
|
config.updater.call(fake_group_this, testers);
|
|
|
|
assert.equal(number_of_pills(), 3);
|
2020-07-20 23:53:59 +02:00
|
|
|
})();
|
|
|
|
|
|
|
|
(function test_source() {
|
2021-04-05 12:54:38 +02:00
|
|
|
let result = config.source.call(fake_stream_this);
|
|
|
|
const stream_ids = result.map((stream) => stream.stream_id);
|
|
|
|
const expected_stream_ids = [sweden.stream_id];
|
|
|
|
assert.deepEqual(stream_ids, expected_stream_ids);
|
|
|
|
|
|
|
|
result = config.source.call(fake_group_this);
|
|
|
|
const group_ids = result.map((group) => group.id).filter(Boolean);
|
|
|
|
const expected_group_ids = [admins.id];
|
|
|
|
assert.deepEqual(group_ids, expected_group_ids);
|
|
|
|
|
|
|
|
result = config.source.call(fake_person_this);
|
|
|
|
const user_ids = result.map((user) => user.user_id).filter(Boolean);
|
|
|
|
const expected_user_ids = [jill.user_id, fred.user_id];
|
|
|
|
assert.deepEqual(user_ids, expected_user_ids);
|
2020-07-20 23:53:59 +02:00
|
|
|
})();
|
|
|
|
|
|
|
|
input_typeahead_called = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Initialize pill widget upon displaying subscription settings page.
|
|
|
|
const stream_row_handler = $(subscriptions_table_selector).get_on_handler(
|
|
|
|
"click",
|
|
|
|
".stream-row",
|
|
|
|
);
|
|
|
|
|
|
|
|
let fake_this = $subscription_settings;
|
|
|
|
let event = {target: fake_this};
|
2021-06-26 15:28:24 +02:00
|
|
|
|
|
|
|
override(stream_ui_updates, "update_toggler_for_sub", noop);
|
|
|
|
override(stream_ui_updates, "update_add_subscriptions_elements", noop);
|
2021-07-23 19:42:57 +02:00
|
|
|
|
|
|
|
const {stream_notification_settings, pm_mention_notification_settings} = settings_config;
|
|
|
|
for (const setting of [...stream_notification_settings, ...pm_mention_notification_settings]) {
|
2021-07-28 16:00:58 +02:00
|
|
|
user_settings[setting] = true;
|
2021-07-23 19:42:57 +02:00
|
|
|
}
|
|
|
|
|
2020-07-20 23:53:59 +02:00
|
|
|
stream_row_handler.call(fake_this, event);
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(template_rendered);
|
|
|
|
assert.ok(input_typeahead_called);
|
2020-07-20 23:53:59 +02:00
|
|
|
|
|
|
|
let add_subscribers_handler = $(subscriptions_table_selector).get_on_handler(
|
|
|
|
"submit",
|
2021-12-21 17:39:05 +01:00
|
|
|
".edit_subscribers_for_stream .subscriber_list_add form",
|
2020-07-20 23:53:59 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
fake_this = $add_subscribers_form;
|
|
|
|
fake_this.closest = () => $subscription_settings;
|
|
|
|
event = {
|
|
|
|
target: fake_this,
|
|
|
|
preventDefault: () => {},
|
|
|
|
};
|
|
|
|
|
2020-10-10 11:12:46 +02:00
|
|
|
// We cannot subscribe ourselves (`me`) as
|
|
|
|
// we are already subscribed to denmark stream.
|
2021-01-12 16:05:24 +01:00
|
|
|
const potential_denmark_stream_subscribers = Array.from(
|
2021-01-12 21:38:01 +01:00
|
|
|
peer_data.get_subscribers(denmark.stream_id),
|
2021-01-12 16:05:24 +01:00
|
|
|
).filter((id) => id !== me.user_id);
|
2020-10-10 11:12:46 +02:00
|
|
|
|
2021-04-05 12:54:38 +02:00
|
|
|
// `denmark` stream pill, `me` user pill and
|
|
|
|
// `testers` user group pill are stubbed.
|
|
|
|
// Thus request is sent to add all the users.
|
|
|
|
expected_user_ids = [mark.user_id, fred.user_id];
|
2020-07-20 23:53:59 +02:00
|
|
|
add_subscribers_handler(event);
|
|
|
|
|
|
|
|
add_subscribers_handler = $(subscriptions_table_selector).get_on_handler(
|
|
|
|
"keyup",
|
2021-12-21 17:39:05 +01:00
|
|
|
".edit_subscribers_for_stream .subscriber_list_add form",
|
2020-07-20 23:53:59 +02:00
|
|
|
);
|
2021-05-31 19:16:18 +02:00
|
|
|
event.key = "Enter";
|
2020-07-20 23:53:59 +02:00
|
|
|
|
|
|
|
// Only Denmark stream pill is created and a
|
|
|
|
// request is sent to add all it's subscribers.
|
2021-03-07 17:01:11 +01:00
|
|
|
override(user_pill, "get_user_ids", () => []);
|
2021-04-05 12:54:38 +02:00
|
|
|
override(user_group_pill, "get_user_ids", () => []);
|
2020-10-10 11:12:46 +02:00
|
|
|
expected_user_ids = potential_denmark_stream_subscribers;
|
2020-07-20 23:53:59 +02:00
|
|
|
add_subscribers_handler(event);
|
|
|
|
|
|
|
|
// No request is sent when there are no users to subscribe.
|
|
|
|
stream_pill.get_user_ids = () => [];
|
|
|
|
add_subscribers_request = false;
|
|
|
|
add_subscribers_handler(event);
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(!add_subscribers_request);
|
2020-07-20 23:53:59 +02:00
|
|
|
|
|
|
|
// No request is sent if we try to subscribe ourselves
|
|
|
|
// only and are already subscribed to the stream.
|
2021-03-07 17:01:11 +01:00
|
|
|
override(user_pill, "get_user_ids", () => [me.user_id]);
|
2020-07-20 23:53:59 +02:00
|
|
|
add_subscribers_handler(event);
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(!add_subscribers_request);
|
2020-07-20 23:53:59 +02:00
|
|
|
|
|
|
|
// Denmark stream pill and fred and mark user pills are created.
|
|
|
|
// But only one request for mark is sent even though a mark user
|
|
|
|
// pill is created and mark is also a subscriber of Denmark stream.
|
2021-03-07 17:01:11 +01:00
|
|
|
override(user_pill, "get_user_ids", () => [mark.user_id, fred.user_id]);
|
2021-01-12 21:38:01 +01:00
|
|
|
stream_pill.get_user_ids = () => peer_data.get_subscribers(denmark.stream_id);
|
2020-10-10 11:12:46 +02:00
|
|
|
expected_user_ids = potential_denmark_stream_subscribers.concat(fred.user_id);
|
2020-07-20 23:53:59 +02:00
|
|
|
add_subscribers_handler(event);
|
2021-06-22 21:18:36 +02:00
|
|
|
|
|
|
|
function is_person_active(user_id) {
|
|
|
|
return user_id === mark.user_id;
|
|
|
|
}
|
|
|
|
// Deactivated user_id is not included in request.
|
|
|
|
override(user_pill, "get_user_ids", () => [mark.user_id, fred.user_id]);
|
|
|
|
override(people, "is_person_active", is_person_active);
|
|
|
|
expected_user_ids = [mark.user_id];
|
|
|
|
add_subscribers_handler(event);
|
2020-07-20 23:53:59 +02:00
|
|
|
});
|