mirror of https://github.com/zulip/zulip.git
input_pill: Pass user_id and group_id to render pill.
While rendering input pills in input_pills.create function, pass in the user_id or group_id accordingly. Display the id as an html attribute in input_pill.hbs. Co-authored-by: Pieter CK <pieterceka123@gmail.com>.
This commit is contained in:
parent
3b46d0e53c
commit
30ede1cc80
|
@ -19,6 +19,8 @@ export type InputPillItem<T> = {
|
|||
deactivated?: boolean;
|
||||
status_emoji_info?: (EmojiRenderingDetails & {emoji_alt_code?: boolean}) | undefined; // TODO: Move this in user_status.js
|
||||
should_add_guest_user_indicator?: boolean;
|
||||
user_id?: number;
|
||||
group_id?: number;
|
||||
} & T;
|
||||
|
||||
export type InputPillConfig = {
|
||||
|
@ -63,6 +65,8 @@ type InputPillRenderingDetails = {
|
|||
has_status?: boolean;
|
||||
status_emoji_info?: (EmojiRenderingDetails & {emoji_alt_code?: boolean}) | undefined;
|
||||
should_add_guest_user_indicator: boolean | undefined;
|
||||
user_id?: number | undefined;
|
||||
group_id?: number | undefined;
|
||||
};
|
||||
|
||||
// These are the functions that are exposed to other modules.
|
||||
|
@ -158,6 +162,13 @@ export function create<T>(opts: InputPillCreateOptions<T>): InputPillContainer<T
|
|||
should_add_guest_user_indicator: item.should_add_guest_user_indicator,
|
||||
};
|
||||
|
||||
if (item.user_id) {
|
||||
opts.user_id = item.user_id;
|
||||
}
|
||||
if (item.group_id) {
|
||||
opts.group_id = item.group_id;
|
||||
}
|
||||
|
||||
if (has_image) {
|
||||
opts.img_src = item.img_src;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class='pill {{#if deactivated}} deactivated-pill {{/if}}' tabindex=0>
|
||||
<div class='pill {{#if deactivated}} deactivated-pill {{/if}}'{{#if user_id}}data-user-id="{{user_id}}"{{/if}}{{#if group_id}}data-user-group-id="{{group_id}}"{{/if}} tabindex=0>
|
||||
{{#if has_image}}
|
||||
<img class="pill-image" src="{{img_src}}" />
|
||||
{{/if}}
|
||||
|
|
Loading…
Reference in New Issue