From 9c33f4b2fefb9f039c485b8b144f4a9c19d7edcf Mon Sep 17 00:00:00 2001 From: Olivier Bossaer Date: Mon, 31 Aug 2020 22:25:09 +0200 Subject: [PATCH] Fix #7672 - Image can be added to root of Media when AllowAtRoot is false (#7853) --- .../mediapicker/mediapicker.controller.js | 18 ++++++++++-------- .../Umbraco/config/lang/en_us.xml | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js index bf2822184b36..a022657e7c7b 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js @@ -1,7 +1,7 @@ //used for the media picker dialog angular.module("umbraco") .controller("Umbraco.Editors.MediaPickerController", - function ($scope, $timeout, mediaResource, entityResource, userService, mediaHelper, mediaTypeHelper, eventsService, treeService, localStorageService, localizationService, editorService, umbSessionStorage) { + function ($scope, $timeout, mediaResource, entityResource, userService, mediaHelper, mediaTypeHelper, eventsService, treeService, localStorageService, localizationService, editorService, umbSessionStorage, notificationsService) { var vm = this; @@ -166,8 +166,14 @@ angular.module("umbraco") } } - function upload() { - $(".umb-file-dropzone .file-select").trigger("click"); + function upload(v) { + var fileSelect = $(".umb-file-dropzone .file-select"); + if (fileSelect.length === 0){ + localizationService.localize('media_uploadNotAllowed').then(function (message) { notificationsService.warning(message); }); + } + else{ + fileSelect.trigger("click"); + } } function dragLeave() { @@ -227,11 +233,7 @@ angular.module("umbraco") $scope.path = []; } - mediaTypeHelper.getAllowedImagetypes(folder.id) - .then(function (types) { - vm.acceptedMediatypes = types; - }); - + mediaTypeHelper.getAllowedImagetypes(folder.id).then(function (types) { vm.acceptedMediatypes = types; }); $scope.lockedFolder = (folder.id === -1 && $scope.model.startNodeIsVirtual) || hasFolderAccess(folder) === false; $scope.currentFolder = folder; diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml index 9a297e424b6c..4341c3a3ac45 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -354,6 +354,7 @@ Failed to create a folder under parent id %0% Failed to rename the folder with id %0% Drag and drop your file(s) into the area + Upload is not allowed in this location. Create a new member