mirror of
https://github.com/zulip/zulip.git
synced 2025-10-29 11:03:54 +00:00
This commit was originally automatically generated using `tools/lint --only=eslint --fix`. It was then modified by tabbott to contain only changes to a set of files that are unlikely to result in significant merge conflicts with any open pull request, excluding about 20 files. His plan is to merge the remaining changes with more precise care, potentially involving merging parts of conflicting pull requests before running the `eslint --fix` operation. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
64 lines
1.7 KiB
JavaScript
64 lines
1.7 KiB
JavaScript
exports.initialize_pill = function () {
|
|
const container = $("#private_message_recipient").parent();
|
|
|
|
const pill = input_pill.create({
|
|
container: container,
|
|
create_item_from_text: user_pill.create_item_from_email,
|
|
get_text_from_item: user_pill.get_email_from_item,
|
|
});
|
|
|
|
return pill;
|
|
};
|
|
|
|
exports.initialize = function () {
|
|
exports.widget = exports.initialize_pill();
|
|
};
|
|
|
|
exports.clear = function () {
|
|
exports.widget.clear();
|
|
};
|
|
|
|
exports.set_from_typeahead = function (person) {
|
|
// We expect person to be an object returned from people.js.
|
|
user_pill.append_person({
|
|
pill_widget: exports.widget,
|
|
person: person,
|
|
});
|
|
};
|
|
|
|
exports.set_from_emails = function (value) {
|
|
// value is something like "alice@example.com,bob@example.com"
|
|
exports.clear();
|
|
exports.widget.appendValue(value);
|
|
};
|
|
|
|
exports.get_user_ids = function () {
|
|
return user_pill.get_user_ids(exports.widget);
|
|
};
|
|
|
|
exports.has_unconverted_data = function () {
|
|
return user_pill.has_unconverted_data(exports.widget);
|
|
};
|
|
|
|
exports.get_user_ids_string = function () {
|
|
const user_ids = exports.get_user_ids();
|
|
const sorted_user_ids = util.sorted_ids(user_ids);
|
|
const user_ids_string = sorted_user_ids.join(',');
|
|
return user_ids_string;
|
|
};
|
|
|
|
exports.get_emails = function () {
|
|
// return something like "alice@example.com,bob@example.com"
|
|
const user_ids = exports.get_user_ids();
|
|
const emails = user_ids.map(function (id) {
|
|
return people.get_person_from_user_id(id).email;
|
|
}).join(",");
|
|
return emails;
|
|
};
|
|
|
|
exports.get_typeahead_items = function () {
|
|
return user_pill.typeahead_source(exports.widget);
|
|
};
|
|
|
|
window.compose_pm_pill = exports;
|