mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
sidebars: Show "(you)" after user's own name in user lists.
Co-authored-by: Lauryn Menard <lauryn@zulip.com>
This commit is contained in:
@@ -38,6 +38,7 @@ export function get_active_user_ids_string(): string | undefined {
|
|||||||
type DisplayObject = {
|
type DisplayObject = {
|
||||||
recipients: string;
|
recipients: string;
|
||||||
user_ids_string: string;
|
user_ids_string: string;
|
||||||
|
is_current_user: boolean;
|
||||||
unread: number;
|
unread: number;
|
||||||
is_zero: boolean;
|
is_zero: boolean;
|
||||||
is_active: boolean;
|
is_active: boolean;
|
||||||
@@ -94,6 +95,7 @@ export function get_conversations(search_string = ""): DisplayObject[] {
|
|||||||
let user_circle_class;
|
let user_circle_class;
|
||||||
let status_emoji_info;
|
let status_emoji_info;
|
||||||
let is_bot = false;
|
let is_bot = false;
|
||||||
|
let is_current_user = false;
|
||||||
|
|
||||||
if (!is_group) {
|
if (!is_group) {
|
||||||
const user_id = Number.parseInt(user_ids_string, 10);
|
const user_id = Number.parseInt(user_ids_string, 10);
|
||||||
@@ -104,6 +106,7 @@ export function get_conversations(search_string = ""): DisplayObject[] {
|
|||||||
// We display the bot icon rather than a user circle for bots.
|
// We display the bot icon rather than a user circle for bots.
|
||||||
is_bot = true;
|
is_bot = true;
|
||||||
} else {
|
} else {
|
||||||
|
is_current_user = people.is_my_user_id(user_id);
|
||||||
status_emoji_info = user_status.get_status_emoji(user_id);
|
status_emoji_info = user_status.get_status_emoji(user_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,6 +124,7 @@ export function get_conversations(search_string = ""): DisplayObject[] {
|
|||||||
is_bot,
|
is_bot,
|
||||||
has_unread_mention,
|
has_unread_mention,
|
||||||
is_deactivated,
|
is_deactivated,
|
||||||
|
is_current_user,
|
||||||
};
|
};
|
||||||
display_objects.push(display_object);
|
display_objects.push(display_object);
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,9 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<a href="{{url}}" class="conversation-partners">
|
<a href="{{url}}" class="conversation-partners">
|
||||||
<span class="conversation-partners-list">{{recipients}} {{> status_emoji status_emoji_info}}
|
<span class="conversation-partners-list">{{recipients}}
|
||||||
|
{{#if is_current_user}}<span class="my_user_status">{{t '(you)'}}</span>{{/if}}
|
||||||
|
{{> status_emoji status_emoji_info}}
|
||||||
{{#if is_bot}}
|
{{#if is_bot}}
|
||||||
<i class="zulip-icon zulip-icon-bot" aria-label="{{t 'Bot' }}"></i>
|
<i class="zulip-icon zulip-icon-bot" aria-label="{{t 'Bot' }}"></i>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@@ -3,3 +3,4 @@
|
|||||||
{{else}}
|
{{else}}
|
||||||
<span class="user-name">{{name}}</span>
|
<span class="user-name">{{name}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#if is_current_user}} <span class="my_user_status">{{t '(you)'}}</span>{{/if}}
|
||||||
|
@@ -119,6 +119,7 @@ test("get_conversations", ({override}) => {
|
|||||||
const expected_data = [
|
const expected_data = [
|
||||||
{
|
{
|
||||||
is_bot: false,
|
is_bot: false,
|
||||||
|
is_current_user: true,
|
||||||
is_active: false,
|
is_active: false,
|
||||||
is_deactivated: false,
|
is_deactivated: false,
|
||||||
is_group: false,
|
is_group: false,
|
||||||
@@ -135,6 +136,7 @@ test("get_conversations", ({override}) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
recipients: "Alice, Bob",
|
recipients: "Alice, Bob",
|
||||||
|
is_current_user: false,
|
||||||
user_ids_string: "101,102",
|
user_ids_string: "101,102",
|
||||||
unread: 1,
|
unread: 1,
|
||||||
is_zero: false,
|
is_zero: false,
|
||||||
@@ -171,6 +173,7 @@ test("get_conversations", ({override}) => {
|
|||||||
is_zero: true,
|
is_zero: true,
|
||||||
is_active: true,
|
is_active: true,
|
||||||
is_deactivated: false,
|
is_deactivated: false,
|
||||||
|
is_current_user: false,
|
||||||
url: "#narrow/dm/106-Iago",
|
url: "#narrow/dm/106-Iago",
|
||||||
status_emoji_info: {emoji_code: "20"},
|
status_emoji_info: {emoji_code: "20"},
|
||||||
user_circle_class: "user-circle-offline",
|
user_circle_class: "user-circle-offline",
|
||||||
@@ -208,6 +211,7 @@ test("get_conversations bot", ({override}) => {
|
|||||||
{
|
{
|
||||||
recipients: "Outgoing webhook",
|
recipients: "Outgoing webhook",
|
||||||
user_ids_string: "314",
|
user_ids_string: "314",
|
||||||
|
is_current_user: false,
|
||||||
unread: 1,
|
unread: 1,
|
||||||
is_zero: false,
|
is_zero: false,
|
||||||
is_active: false,
|
is_active: false,
|
||||||
@@ -222,6 +226,7 @@ test("get_conversations bot", ({override}) => {
|
|||||||
{
|
{
|
||||||
recipients: "Alice, Bob",
|
recipients: "Alice, Bob",
|
||||||
user_ids_string: "101,102",
|
user_ids_string: "101,102",
|
||||||
|
is_current_user: false,
|
||||||
unread: 1,
|
unread: 1,
|
||||||
is_zero: false,
|
is_zero: false,
|
||||||
is_active: false,
|
is_active: false,
|
||||||
|
Reference in New Issue
Block a user