From: Alexander Ebert Date: Thu, 10 Aug 2017 10:53:18 +0000 (+0200) Subject: Fixed guest comment interaction X-Git-Tag: 3.1.0_Alpha_1~56 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a9defcf47e78b987dafb3e4d527c45624c70f558;p=GitHub%2FWoltLab%2FWCF.git Fixed guest comment interaction Fixes #2364 --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Comment/Add.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Comment/Add.js index 92d4a42795..254e4de164 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Comment/Add.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Comment/Add.js @@ -101,11 +101,7 @@ define(['Ajax', 'Core', 'EventHandler', 'Language', 'Dom/ChangeListener', 'Dom/U } }; - //noinspection JSCheckFunctionSignatures - var captchaId = elData(event.currentTarget, 'captcha-id'); - if (ControllerCaptcha.has(captchaId)) { - parameters = Core.extend(parameters, ControllerCaptcha.getData(captchaId)); - } + parameters = Core.extend(parameters, ControllerCaptcha.getData('commentAdd')); this._submit(undefined, parameters); }, @@ -290,21 +286,17 @@ define(['Ajax', 'Core', 'EventHandler', 'Language', 'Dom/ChangeListener', 'Dom/U }, /** - * @param {{returnValues:{guestDialog:string,guestDialogID:string}}} data + * @param {{returnValues:{guestDialog:string}}} data * @protected */ _ajaxSuccess: function(data) { - if (!User.userId && !data.returnValues.guestDialogID) { - throw new Error("Missing 'guestDialogID' return value for guest."); - } - if (!User.userId && data.returnValues.guestDialog) { - UiDialog.openStatic(data.returnValues.guestDialogID, data.returnValues.guestDialog, { + UiDialog.openStatic('jsDialogGuestComment', data.returnValues.guestDialog, { closable: false, title: Language.get('wcf.global.confirmation.title') }); - var dialog = UiDialog.getDialog(data.returnValues.guestDialogID); + var dialog = UiDialog.getDialog('jsDialogGuestComment'); elBySel('input[type=submit]', dialog.content).addEventListener(WCF_CLICK_EVENT, this._submitGuestDialog.bind(this)); elBySel('input[type=text]', dialog.content).addEventListener('keypress', this._submitGuestDialog.bind(this)); } @@ -312,7 +304,7 @@ define(['Ajax', 'Core', 'EventHandler', 'Language', 'Dom/ChangeListener', 'Dom/U this._insertMessage(data); if (!User.userId) { - UiDialog.close(data.returnValues.guestDialogID); + UiDialog.close('jsDialogGuestComment'); } this._reset();