From d02f7f84c682223c3473499b45687f1c894326e7 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Wed, 12 May 2021 10:23:58 +0200 Subject: [PATCH] Do not open media manager dialog after replacing media file MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit … and always reload the media list page in the ACP after editing/replacing media file to ensure updated data. --- .../files/js/WoltLabSuite/Core/Controller/Media/List.js | 4 ++-- .../install/files/js/WoltLabSuite/Core/Media/Editor.js | 2 +- .../files/js/WoltLabSuite/Core/Media/Manager/Base.js | 7 +++++-- .../install/files/js/WoltLabSuite/Core/Media/Replace.js | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Media/List.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Media/List.js index 5613bdf52d..acd351382c 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Media/List.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Media/List.js @@ -65,8 +65,8 @@ define([ deleteAction.setCallback(this._deleteCallback); _mediaEditor = new MediaEditor({ - _editorSuccess: function(media, oldCategoryId) { - if (media.categoryID != oldCategoryId) { + _editorSuccess: function(media, oldCategoryId, closedEditorDialog = true) { + if (media.categoryID != oldCategoryId || closedEditorDialog) { window.setTimeout(function() { window.location.reload(); }, 500); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Editor.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Editor.js index da5f85b473..1f7f7a3293 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Editor.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Editor.js @@ -416,7 +416,7 @@ define( */ updateData: function(data) { if (this._callbackObject._editorSuccess) { - this._callbackObject._editorSuccess(data); + this._callbackObject._editorSuccess(data, undefined, false); } } }; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js index b290ffc880..7e05686744 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js @@ -265,8 +265,9 @@ define( * * @param {object} media updated media file data * @param {integer} oldCategoryId old category id + * @param {boolean} closedEditorDialog */ - _editorSuccess: function(media, oldCategoryId) { + _editorSuccess: function(media, oldCategoryId, closedEditorDialog = true) { // if the category changed of media changed and category // is selected, check if media list needs to be refreshed if (this._mediaCategorySelect) { @@ -281,7 +282,9 @@ define( } } - UiDialog.open(this); + if (closedEditorDialog) { + UiDialog.open(this); + } this._media.set(~~media.mediaID, media); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Replace.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Replace.js index c77c8c152d..fec149a654 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Replace.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Replace.js @@ -4,7 +4,7 @@ * @author Matthias Schmidt * @copyright 2001-2020 WoltLab GmbH * @license GNU Lesser General Public License - * @module WoltLabSuite/Core/Media/Upload + * @module WoltLabSuite/Core/Media/Replace * @since 5.3 */ define( -- 2.20.1