-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ported over the fixes in #11858 "Check media Parent for permissions when setting correct MediaType" to target v8 #12233
Conversation
…for permissions when setting correct MediaType" to v8
Hi there @OwainJ, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @OwainJ for porting the fix to Umbraco 8 🙌 I reviewed and tested it and left a few comments for you. I will push the needed changes and once the build pipeline succeeds I will make sure to merge it 😉
var notificationModel = new SimpleNotificationModel(); | ||
notificationModel.AddErrorNotification(Services.TextService.Localize("speechBubbles", "folderCreationNotAllowed"), ""); | ||
throw new HttpResponseException(Request.CreateValidationErrorResponse(notificationModel)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we can just use the CreateNotificationValidationErrorResponse()
that we already have and pass in the error msg. It is doing exactly what you are trying to do here. I will fix up
var saveResult = mediaService.Save(f, Security.CurrentUser.Id); | ||
if (saveResult == false) | ||
{ | ||
AddCancelMessage(tempFiles, Services.TextService.Localize("speechBubbles", "operationCancelledText") + " -- " + mediaItemName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifying the message
param is needed here because otherwise, the AddCancelMessage()
will interpret the passed text as the header and the message displayed will end up being just the default operationCancelledText
. Will fix up!
@@ -644,6 +652,11 @@ public async Task<HttpResponseMessage> PostAddFile() | |||
//in case we pass a path with a folder in it, we will create it and upload media to it. | |||
if (result.FormData.ContainsKey("path")) | |||
{ | |||
if (!IsFolderCreationAllowedHere(parentId)) | |||
{ | |||
AddCancelMessage(tempFiles, Services.TextService.Localize("speechBubbles", "folderUploadNotAllowed")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifying the message
param is needed here because otherwise, the AddCancelMessage()
will interpret the passed text as the header and the message displayed will end up being just the default operationCancelledText
.
Also, the syntax for v8 is a little different, here we can just pass "speechBubbles/folderUploadNotAllowed"
as the method is already doing the localization
Will fix up!
Hi ! We updated our Umbraco site to 8.18.3 from and older version some weeks ago, and figured out about this issue just now. As 8.18.3 just released a month ago, is there any plan to release 8.18.4 anytime soon ? It's frustrating to go to medias each time we want to upload a specific image type. |
@elcoinkeur according to the release progress tracker, 8.18.14 is scheduled for release on Monday, the 16th of May. |
Hi @OwainJ , We upgraded an existing umbraco 8.17.1 to 8.18.5 where we use differtent media type images per folder. After the upgrade we could not upload new images anymore to our specific folders. We use for example a mediatype 'Header visual images Folder' with rights to add 'Header visual image' media type and rights to add a subfolder of the same media type 'Header visual images Folder'. If we remove the rights to add the subfolder it works again as expected and this is for now a good workaround, but our client will want to make subfolders in the future. Can you please fix this in the next version? Thanks in advance |
Ported over the fixes in the v9 PR #11858 Check media Parent for permissions when setting correct MediaType to v8.
Prerequisites
If there's an existing issue for this PR then this fixes #7735
Description
I have ported over fixes from the v9 PR #11858, as the fixed issue also affected v8, the fixes have been tweaked slightly to work with v8's codebase.
Description from the v9 PR:
Gif of the drag & drop upload working correctly in v8: