narrow_banner: Fix message view banner for dm with deactivated user.

Previously the empty view banner for DM with any recipients
contained "Why not start the conversation".

For deactivated users/bots, we are now not displaying it.
This commit is contained in:
adnan-td
2024-08-13 23:02:06 +05:30
committed by Tim Abbott
parent 120cfa8987
commit e23d863981
4 changed files with 49 additions and 1 deletions

View File

@@ -346,12 +346,23 @@ export function pick_empty_narrow_banner(): NarrowBannerData {
}),
};
}
// If the recipient is deactivated, we cannot start the conversation.
if (!people.is_person_active(recipient_user.user_id)) {
return {
title: $t(
{
defaultMessage: "You have no direct messages with {person}.",
},
{person: recipient_user.full_name},
),
};
}
return {
title: $t(
{
defaultMessage: "You have no direct messages with {person} yet.",
},
{person: people.get_by_user_id(user_ids[0]).full_name},
{person: recipient_user.full_name},
),
html: $t_html(
{
@@ -366,6 +377,11 @@ export function pick_empty_narrow_banner(): NarrowBannerData {
),
};
}
if (people.get_non_active_user_ids_count(user_ids) !== 0) {
return {
title: $t({defaultMessage: "You have no direct messages with these users."}),
};
}
return {
title: $t({defaultMessage: "You have no direct messages with these users yet."}),
html: $t_html(