Commit 4472fd8d authored by leiminghuan's avatar leiminghuan

verify using this

parent bfce0ad8
......@@ -27,9 +27,10 @@ function UsersSelect(currentUser, els, options = {}) {
}
const { handleClick } = options;
const userSelect = this;
$els.each( (i, dropdown) => {
const _this = this;
const userSelect = this;
const options = {};
const $dropdown = $(dropdown);
options.projectId = $dropdown.data('projectId');
......@@ -74,7 +75,7 @@ function UsersSelect(currentUser, els, options = {}) {
// Save current selected user to the DOM
const currentUserInfo = $dropdown.data('currentUserInfo') || {};
const currentUser = _this.currentUser || {};
const currentUser = userSelect.currentUser || {};
const fieldName = $dropdown.data('fieldName');
const userName = currentUserInfo.name;
const userId = currentUserInfo.id || currentUser.id;
......@@ -180,7 +181,7 @@ function UsersSelect(currentUser, els, options = {}) {
$block.on('click', '.js-assign-yourself', e => {
e.preventDefault();
return assignTo(_this.currentUser.id);
return assignTo(userSelect.currentUser.id);
});
assignTo = function(selected) {
......@@ -228,7 +229,7 @@ function UsersSelect(currentUser, els, options = {}) {
return $dropdown.glDropdown({
showMenuAbove,
data(term, callback) {
return _this.users(term, options, users => {
return userSelect.users(term, options, users => {
// GitLabDropdownFilter returns this.instance
// GitLabDropdownRemote returns this.options.instance
const glDropdown = this.instance || this.options.instance;
......@@ -550,7 +551,7 @@ function UsersSelect(currentUser, els, options = {}) {
img = `<img src='${avatar}' class='avatar avatar-inline m-0' width='32' />`;
}
return _this.renderRow(options.issuableType, user, selected, username, img);
return userSelect.renderRow(options.issuableType, user, selected, username, img);
},
});
});
......@@ -558,7 +559,6 @@ function UsersSelect(currentUser, els, options = {}) {
.then(() => {
$('.ajax-users-select').each(
(i, select) => {
const _this = this;
const options = {};
options.skipLdap = $(select).hasClass('skip_ldap');
options.projectId = $(select).data('projectId');
......@@ -575,7 +575,7 @@ function UsersSelect(currentUser, els, options = {}) {
multiple: $(select).hasClass('multiselect'),
minimumInputLength: 0,
query(query) {
return _this.users(query.term, options, users => {
return userSelect.users(query.term, options, users => {
let name;
const data = {
results: users,
......@@ -632,15 +632,15 @@ function UsersSelect(currentUser, els, options = {}) {
},
initSelection() {
const args = 1 <= arguments.length ? [].slice.call(arguments, 0) : [];
return _this.initSelection.apply(_this, args);
return userSelect.initSelection.apply(userSelect, args);
},
formatResult() {
const args = 1 <= arguments.length ? [].slice.call(arguments, 0) : [];
return _this.formatResult.apply(_this, args);
return userSelect.formatResult.apply(userSelect, args);
},
formatSelection() {
const args = 1 <= arguments.length ? [].slice.call(arguments, 0) : [];
return _this.formatSelection.apply(_this, args);
return userSelect.formatSelection.apply(userSelect, args);
},
dropdownCssClass: 'ajax-users-dropdown',
// we do not want to escape markup since we are displaying html in results
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment