diff --git a/web/src/buddy_data.ts b/web/src/buddy_data.ts index 57eaff0daa..5d040eb442 100644 --- a/web/src/buddy_data.ts +++ b/web/src/buddy_data.ts @@ -240,6 +240,7 @@ export function get_title_data( second_line: string | undefined; third_line: string; show_you?: boolean; + is_deactivated?: boolean; } { if (is_group) { // For groups, just return a string with recipient names. @@ -253,6 +254,7 @@ export function get_title_data( // Since it's not a group, user_ids_string is a single user ID. const user_id = Number.parseInt(user_ids_string, 10); const person = people.get_by_user_id(user_id); + const is_deactivated = !people.is_person_active(user_id); if (person.is_bot) { const bot_owner = people.get_bot_owner_user(person); @@ -266,7 +268,10 @@ export function get_title_data( return { first_line: person.full_name, second_line: bot_owner_name, - third_line: "", + third_line: is_deactivated + ? $t({defaultMessage: "This bot has been deactivated."}) + : "", + is_deactivated, }; } @@ -283,6 +288,16 @@ export function get_title_data( const last_seen = user_last_seen_time_status(user_id); const is_my_user = people.is_my_user_id(user_id); + if (is_deactivated) { + return { + first_line: person.full_name, + second_line: $t({defaultMessage: "This user has been deactivated."}), + third_line: "", + show_you: is_my_user, + is_deactivated, + }; + } + // Users has a status. if (user_status.get_status_text(user_id)) { return { diff --git a/web/templates/buddy_list_tooltip_content.hbs b/web/templates/buddy_list_tooltip_content.hbs index cb53e8201b..a266f26c68 100644 --- a/web/templates/buddy_list_tooltip_content.hbs +++ b/web/templates/buddy_list_tooltip_content.hbs @@ -6,9 +6,9 @@ {{/if}} {{#if second_line}} -
{{second_line}}
+
{{second_line}}
{{/if}} {{#if third_line}} -
{{third_line}}
+
{{third_line}}
{{/if}} diff --git a/web/tests/buddy_data.test.cjs b/web/tests/buddy_data.test.cjs index 515edc46f7..75edc82442 100644 --- a/web/tests/buddy_data.test.cjs +++ b/web/tests/buddy_data.test.cjs @@ -192,6 +192,7 @@ test("title_data", ({override}) => { first_line: "Blue Herring Bot", second_line: "translated: Owner: Human Myself", third_line: "", + is_deactivated: false, }; assert.deepEqual( buddy_data.get_title_data(bot_with_owner.user_id, is_group), @@ -228,6 +229,30 @@ test("title_data", ({override}) => { show_you: false, }; assert.deepEqual(buddy_data.get_title_data(old_user.user_id, is_group), expected_data); + + // Deactivated users. + people.deactivate(selma); + expected_data = { + first_line: "Human Selma", + second_line: "translated: This user has been deactivated.", + third_line: "", + show_you: false, + is_deactivated: true, + }; + assert.deepEqual(buddy_data.get_title_data(selma.user_id, is_group), expected_data); + + // Deactivated bots. + people.deactivate(bot_with_owner); + expected_group_data = { + first_line: "Blue Herring Bot", + second_line: "translated: Owner: Human Myself", + third_line: "translated: This bot has been deactivated.", + is_deactivated: true, + }; + assert.deepEqual( + buddy_data.get_title_data(bot_with_owner.user_id, is_group), + expected_group_data, + ); }); test("filters deactivated users", () => {