mirror of https://github.com/zulip/zulip.git
typing_data: Rename get_all_typists to get_all_direct_message_typists.
We use this function to show who's typing in the direct messages narrow. Renamed it because, with the addition of stream typists to `typist_dct` in the next commit, this might be confusing. This commit addresses the discussed issue by renaming 'get_all_typists()' to 'get_all_direct_message_typists'.
This commit is contained in:
parent
91f03e0d38
commit
c453a784e2
|
@ -133,7 +133,7 @@ like the following:
|
|||
- `add_typist`
|
||||
- `remove_typist`
|
||||
- `get_group_typists`
|
||||
- `get_all_typists`
|
||||
- `get_all_direct_message_typists`
|
||||
|
||||
One subtle thing that the client has to do here is to maintain
|
||||
timers for typing notifications. The value of
|
||||
|
|
|
@ -45,7 +45,7 @@ export function get_group_typists(group: number[]): number[] {
|
|||
return muted_users.filter_muted_user_ids(user_ids);
|
||||
}
|
||||
|
||||
export function get_all_typists(): number[] {
|
||||
export function get_all_direct_message_typists(): number[] {
|
||||
let typists = [...typist_dct.values()].flat();
|
||||
typists = util.sorted_ids(typists);
|
||||
return muted_users.filter_muted_user_ids(typists);
|
||||
|
|
|
@ -47,8 +47,8 @@ function get_users_typing_for_narrow() {
|
|||
const group = [...narrow_user_ids, page_params.user_id];
|
||||
return typing_data.get_group_typists(group);
|
||||
}
|
||||
// Get all users typing (in all private conversations with current user)
|
||||
return typing_data.get_all_typists();
|
||||
// Get all users typing (in all direct message conversations with current user)
|
||||
return typing_data.get_all_direct_message_typists();
|
||||
}
|
||||
|
||||
export function render_notifications_for_narrow() {
|
||||
|
|
|
@ -34,8 +34,8 @@ test("basics", () => {
|
|||
typing_data.add_typist([7, 15], 7);
|
||||
typing_data.add_typist([7, 15], 15);
|
||||
|
||||
// test get_all_typists
|
||||
assert.deepEqual(typing_data.get_all_typists(), [7, 10, 15]);
|
||||
// test get_all_direct_message_typists
|
||||
assert.deepEqual(typing_data.get_all_direct_message_typists(), [7, 10, 15]);
|
||||
|
||||
// test basic removal
|
||||
assert.ok(typing_data.remove_typist([15, 7], 7));
|
||||
|
@ -44,16 +44,16 @@ test("basics", () => {
|
|||
// test removing an id that is not there
|
||||
assert.ok(!typing_data.remove_typist([15, 7], 7));
|
||||
assert.deepEqual(typing_data.get_group_typists([7, 15]), [15]);
|
||||
assert.deepEqual(typing_data.get_all_typists(), [10, 15]);
|
||||
assert.deepEqual(typing_data.get_all_direct_message_typists(), [10, 15]);
|
||||
|
||||
// remove user from one group, but "15" will still be among
|
||||
// "all typists"
|
||||
assert.ok(typing_data.remove_typist([15, 7], 15));
|
||||
assert.deepEqual(typing_data.get_all_typists(), [10, 15]);
|
||||
assert.deepEqual(typing_data.get_all_direct_message_typists(), [10, 15]);
|
||||
|
||||
// now remove from the other group
|
||||
assert.ok(typing_data.remove_typist([5, 15, 10], 15));
|
||||
assert.deepEqual(typing_data.get_all_typists(), [10]);
|
||||
assert.deepEqual(typing_data.get_all_direct_message_typists(), [10]);
|
||||
|
||||
// test duplicate ids in a groups
|
||||
typing_data.add_typist([20, 40, 20], 20);
|
||||
|
@ -66,12 +66,12 @@ test("muted_typists_excluded", () => {
|
|||
|
||||
// Nobody is muted.
|
||||
assert.deepEqual(typing_data.get_group_typists([5, 10, 15]), [5, 10]);
|
||||
assert.deepEqual(typing_data.get_all_typists(), [5, 10]);
|
||||
assert.deepEqual(typing_data.get_all_direct_message_typists(), [5, 10]);
|
||||
|
||||
// Mute a user, and test that the get_* functions exclude that user.
|
||||
muted_users.add_muted_user(10);
|
||||
assert.deepEqual(typing_data.get_group_typists([5, 10, 15]), [5]);
|
||||
assert.deepEqual(typing_data.get_all_typists(), [5]);
|
||||
assert.deepEqual(typing_data.get_all_direct_message_typists(), [5]);
|
||||
});
|
||||
|
||||
test("timers", () => {
|
||||
|
|
Loading…
Reference in New Issue