mirror of https://github.com/zulip/zulip.git
pm_list: Show DM row for empty conversations in left sidebar.
Earlier when a user narrowed to a new pm conversation, there was no highlighted DM row entry in the left sidebar. This commit introduces the feature to show highlighted pm thread in the left sidebar for a new conversation. It adds narrowed dm to the recent messages list if not already present. It disappears from the sidebar if no message was sent and unnarrowed from the DM. Fixes: zulip#22769.
This commit is contained in:
parent
4c5fa7aaf7
commit
e1a63d57a2
|
@ -51,6 +51,13 @@ export function get_conversations(): DisplayObject[] {
|
|||
// The user_ids_string for the current view, if any.
|
||||
const active_user_ids_string = get_active_user_ids_string();
|
||||
|
||||
if (
|
||||
active_user_ids_string !== undefined &&
|
||||
!private_messages.map((obj) => obj.user_ids_string).includes(active_user_ids_string)
|
||||
) {
|
||||
private_messages.unshift({user_ids_string: active_user_ids_string, max_message_id: -1});
|
||||
}
|
||||
|
||||
for (const conversation of private_messages) {
|
||||
const user_ids_string = conversation.user_ids_string;
|
||||
const reply_to = people.user_ids_string_to_emails_string(user_ids_string);
|
||||
|
|
|
@ -143,6 +143,22 @@ test("get_conversations", ({override}) => {
|
|||
|
||||
pm_data = pm_list_data.get_conversations();
|
||||
assert.deepEqual(pm_data, expected_data);
|
||||
|
||||
expected_data.unshift({
|
||||
recipients: "Iago",
|
||||
user_ids_string: "106",
|
||||
unread: 0,
|
||||
is_zero: true,
|
||||
is_active: true,
|
||||
url: "#narrow/dm/106-Iago",
|
||||
status_emoji_info: {emoji_code: "20"},
|
||||
user_circle_class: "user_circle_empty",
|
||||
is_group: false,
|
||||
is_bot: false,
|
||||
});
|
||||
set_pm_with_filter("iago@zulip.com");
|
||||
pm_data = pm_list_data.get_conversations();
|
||||
assert.deepEqual(pm_data, expected_data);
|
||||
});
|
||||
|
||||
test("get_conversations bot", ({override}) => {
|
||||
|
|
Loading…
Reference in New Issue