Do not open media manager dialog after replacing media file
authorMatthias Schmidt <gravatronics@live.com>
Wed, 12 May 2021 08:23:58 +0000 (10:23 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Wed, 12 May 2021 08:23:58 +0000 (10:23 +0200)
… and always reload the media list page in the ACP after editing/replacing media file to ensure updated data.

wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Media/List.js
wcfsetup/install/files/js/WoltLabSuite/Core/Media/Editor.js
wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js
wcfsetup/install/files/js/WoltLabSuite/Core/Media/Replace.js

index 5613bdf52de9ff5dbd703c7ff8f71566b3ef8e0a..acd351382cef58ca073016ed96c423f97b1577e6 100644 (file)
@@ -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);
index da5f85b473a014ac866fcdb79a7fa5048d078a61..1f7f7a32930324931e8f43355db7bbde3fffa977 100644 (file)
@@ -416,7 +416,7 @@ define(
                 */
                updateData: function(data) {
                        if (this._callbackObject._editorSuccess) {
-                               this._callbackObject._editorSuccess(data);
+                               this._callbackObject._editorSuccess(data, undefined, false);
                        }
                }
        };
index b290ffc880a7ce04e4df40c1457d1c3739f23c8e..7e05686744d495ec55ce5455e6de84ff2b52aa62 100644 (file)
@@ -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);
                        
index c77c8c152d6d26a88ad2252458d3daafd73d193a..fec149a65449b450859dc34d6aefca868d85fc8a 100644 (file)
@@ -4,7 +4,7 @@
  * @author      Matthias Schmidt
  * @copyright   2001-2020 WoltLab GmbH
  * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @module      WoltLabSuite/Core/Media/Upload
+ * @module      WoltLabSuite/Core/Media/Replace
  * @since       5.3
  */
 define(