refactor: Add type field to pill items.

Item field is added to the pill items, this is done to utilize
it wherever possible, to distinguish between diffrent types
of pill items(stream|user_groups|users).

It is also a preparatory commit to support expanding of stream
and user group pills.
This commit is contained in:
m-e-l-u-h-a-n
2021-04-27 20:26:20 +05:30
committed by Tim Abbott
parent 0a9678980f
commit a2c7f35e5c
8 changed files with 32 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ export function create_item_from_email(email, current_items) {
// so we just create a pill where the display value
// is the email itself.
return {
type: "user",
display_value: email,
email,
};
@@ -42,6 +43,7 @@ export function create_item_from_email(email, current_items) {
// We must supply display_value for the widget to work. Everything
// else is for our own use in callbacks.
const item = {
type: "user",
display_value: user.full_name,
user_id: user.user_id,
email: user.email,
@@ -61,6 +63,7 @@ export function append_person(opts) {
const avatar_url = people.small_avatar_url_for_person(person);
pill_widget.appendValidatedData({
type: "user",
display_value: person.full_name,
user_id: person.user_id,
email: person.email,