From: Tim Düsterhus Date: Fri, 3 Jul 2020 14:46:26 +0000 (+0200) Subject: Properly support multiple instances of WoltLabSuite/Core/Ui/ItemList/User X-Git-Tag: 5.2.8~19^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f1b562d617c46b936ced5b4af85220566c07c66c;p=GitHub%2FWoltLab%2FWCF.git Properly support multiple instances of WoltLabSuite/Core/Ui/ItemList/User WoltLabSuite/Core/Ui/ItemList/User is a singleton and thus only has a single instance of each object member. This lead to the `_shadowGroups` value being fixed to the first input used. Move the `_shadowGroups` into the existing `data` object (where the regular `shadow` resides) to fix this issue. Introduced in 8faf6ea10ac894b87b3e357f5248f67b4fd7b716. Fixes #3433. --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList/User.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList/User.js index 24c3316775..1bd570be77 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList/User.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList/User.js @@ -2,7 +2,7 @@ * Provides an item list for users and groups. * * @author Alexander Ebert - * @copyright 2001-2019 WoltLab GmbH + * @copyright 2001-2020 WoltLab GmbH * @license GNU Lesser General Public License * @module WoltLabSuite/Core/Ui/ItemList/User */ @@ -22,8 +22,6 @@ define(['WoltLabSuite/Core/Ui/ItemList'], function(UiItemList) { * @exports WoltLabSuite/Core/Ui/ItemList/User */ return { - _shadowGroups: null, - /** * Initializes user suggestion support for an element. * @@ -31,8 +29,6 @@ define(['WoltLabSuite/Core/Ui/ItemList'], function(UiItemList) { * @param {object} options option list */ init: function(elementId, options) { - this._shadowGroups = null; - UiItemList.init(elementId, [], { ajax: { className: 'wcf\\data\\user\\UserAction', @@ -70,13 +66,13 @@ define(['WoltLabSuite/Core/Ui/ItemList'], function(UiItemList) { }); data.shadow.value = users.join(','); - if (!this._shadowGroups) { - this._shadowGroups = elCreate('input'); - this._shadowGroups.type = 'hidden'; - this._shadowGroups.name = data.shadow.name + 'GroupIDs'; - data.shadow.parentNode.insertBefore(this._shadowGroups, data.shadow); + if (!data._shadowGroups) { + data._shadowGroups = elCreate('input'); + data._shadowGroups.type = 'hidden'; + data._shadowGroups.name = data.shadow.name + 'GroupIDs'; + data.shadow.parentNode.insertBefore(data._shadowGroups, data.shadow); } - this._shadowGroups.value = groups.join(','); + data._shadowGroups.value = groups.join(','); return values; }