unread: Rename function name for clarity.

Renamed get_msg_ids_for_person to get_msg_ids_for_user_ids_string.
This commit is contained in:
Aman Agrawal 2022-10-22 05:13:57 +00:00 committed by Tim Abbott
parent 4bc80c30e7
commit 284c86212c
3 changed files with 13 additions and 11 deletions

View File

@ -422,9 +422,9 @@ test("private_messages", () => {
assert.equal(unread.num_unread_for_person(alice.user_id.toString()), 0);
assert.equal(unread.num_unread_for_person(bob.user_id.toString()), 0);
assert.deepEqual(unread.get_msg_ids_for_person(alice.user_id.toString()), []);
assert.deepEqual(unread.get_msg_ids_for_person(bob.user_id.toString()), []);
assert.deepEqual(unread.get_msg_ids_for_person(), []);
assert.deepEqual(unread.get_msg_ids_for_user_ids_string(alice.user_id.toString()), []);
assert.deepEqual(unread.get_msg_ids_for_user_ids_string(bob.user_id.toString()), []);
assert.deepEqual(unread.get_msg_ids_for_user_ids_string(), []);
assert.deepEqual(unread.get_msg_ids_for_private(), []);
const message = {
@ -443,16 +443,18 @@ test("private_messages", () => {
assert.equal(unread.num_unread_for_person(""), 0);
assert.deepEqual(unread.get_msg_ids_for_person(alice.user_id.toString()), [message.id]);
assert.deepEqual(unread.get_msg_ids_for_person(bob.user_id.toString()), []);
assert.deepEqual(unread.get_msg_ids_for_user_ids_string(alice.user_id.toString()), [
message.id,
]);
assert.deepEqual(unread.get_msg_ids_for_user_ids_string(bob.user_id.toString()), []);
assert.deepEqual(unread.get_msg_ids_for_private(), [message.id]);
assert.deepEqual(unread.get_all_msg_ids(), [message.id]);
unread.mark_as_read(message.id);
assert.equal(unread.num_unread_for_person(alice.user_id.toString()), 0);
assert.equal(unread.num_unread_for_person(""), 0);
assert.deepEqual(unread.get_msg_ids_for_person(alice.user_id.toString()), []);
assert.deepEqual(unread.get_msg_ids_for_person(bob.user_id.toString()), []);
assert.deepEqual(unread.get_msg_ids_for_user_ids_string(alice.user_id.toString()), []);
assert.deepEqual(unread.get_msg_ids_for_user_ids_string(bob.user_id.toString()), []);
assert.deepEqual(unread.get_msg_ids_for_private(), []);
assert.deepEqual(unread.get_all_msg_ids(), []);
const counts = unread.get_counts();

View File

@ -247,7 +247,7 @@ export function _possible_unread_message_ids() {
if (current_filter_pm_string === undefined) {
return [];
}
return unread.get_msg_ids_for_person(current_filter_pm_string);
return unread.get_msg_ids_for_user_ids_string(current_filter_pm_string);
}
if (current_filter.can_bucket_by("is-private")) {

View File

@ -207,7 +207,7 @@ class UnreadPMCounter {
return util.sorted_ids(ids);
}
get_msg_ids_for_person(user_ids_string) {
get_msg_ids_for_user_ids_string(user_ids_string) {
if (!user_ids_string) {
return [];
}
@ -728,8 +728,8 @@ export function get_msg_ids_for_topic(stream_id, topic_name) {
return unread_topic_counter.get_msg_ids_for_topic(stream_id, topic_name);
}
export function get_msg_ids_for_person(user_ids_string) {
return unread_pm_counter.get_msg_ids_for_person(user_ids_string);
export function get_msg_ids_for_user_ids_string(user_ids_string) {
return unread_pm_counter.get_msg_ids_for_user_ids_string(user_ids_string);
}
export function get_msg_ids_for_private() {