From 2cf67fd434a777ef38edadcb4ac1020ee264c2e6 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 10 Jul 2020 22:53:04 +0200 Subject: [PATCH] Simplify code by not checking for the "enable thunbnails" option --- wcfsetup/install/files/js/WCF.Attachment.js | 14 ++++++-------- wcfsetup/install/files/lib/system/WCF.class.php | 1 + 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.Attachment.js b/wcfsetup/install/files/js/WCF.Attachment.js index 41a2bf6349..80c031f577 100644 --- a/wcfsetup/install/files/js/WCF.Attachment.js +++ b/wcfsetup/install/files/js/WCF.Attachment.js @@ -489,9 +489,10 @@ WCF.Attachment.Upload = WCF.Upload.extend({ * * @return {boolean} * @protected + * @deprecated 5.3 */ _useThumbnail: function() { - return elDataBool(this._fileListSelector[0], 'enable-thumbnails'); + return true; }, /** @@ -552,7 +553,7 @@ WCF.Attachment.Upload = WCF.Upload.extend({ $li.data('objectID', attachmentData.attachmentID); if (this._editorId) { - if (attachmentData.tinyURL || (!this._useThumbnail() && attachmentData.isImage)) { + if (attachmentData.tinyURL) { if (attachmentData.thumbnailURL) { $('
  • ' + WCF.Language.get('wcf.attachment.insertThumbnail') + '
  • ').appendTo($buttonList); } @@ -660,15 +661,12 @@ WCF.Attachment.Upload = WCF.Upload.extend({ * Inserts all attachments at once. */ _insertAll: function () { - var attachment, button, preferThumbnail = this._useThumbnail(); + var attachment, button; for (var i = 0, length = this._fileListSelector[0].childNodes.length; i < length; i++) { attachment = this._fileListSelector[0].childNodes[i]; if (attachment.nodeName === 'LI' && !attachment.classList.contains('uploadFailed')) { - button = null; - if (preferThumbnail) { - button = elBySel('.jsButtonAttachmentInsertThumbnail, .jsButtonAttachmentInsertPlain', attachment); - } - + button = elBySel('.jsButtonAttachmentInsertThumbnail, .jsButtonAttachmentInsertPlain', attachment); + if (button === null) { button = elBySel('.jsButtonAttachmentInsertFull, .jsButtonAttachmentInsertPlain', attachment); } diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index 95aacb3cd5..683455934d 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -369,6 +369,7 @@ class WCF { define('LIKE_ENABLE_DISLIKE', 0); // Thumbnails for attachments are already enabled since 5.3. + // https://github.com/WoltLab/WCF/pull/3444 define('ATTACHMENT_ENABLE_THUMBNAILS', 1); // User markings are always applied in sidebars since 5.3. -- 2.20.1