-
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
Return tempFiles from PostAddFile result #11279
Conversation
Add the response data to the return. Fixes umbraco#11278
Thanks @matthewcare! I am trying to figure out what this is actually fixing though? You mentioned notifications not working, but they seem fine? I believe you are noticing error notifications not coming through? How do you make it error so that we can observe that the behavior is now correctly fixed? Thanks in advance! Note: this behavior doesn't seem changed in v8, so we might need to backport this to v8 as well. Ps. you are not required to make an issue before you create a PR. If there something to discuss before making the PR then an issue is good, but if you have code already then only a PR is fine as well. 👍 |
Hi there @matthewcare, 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 🤖 🙂 |
In Umbraco 8, you'll notice that the Whereas in Umbraco 9 it has been ported to be I am currently fixing issue #11094, and found that the dropzone response data is an empty string as the So in the method inside of
all uploaded files are now accepted, even if there is an error. Thanks for the info about not needing to create an issue. I'll bear in mind for the future |
Sorry, I wasn't super clear on what the PR fixes. When you upload files via the dropzone, and have a media saving notificaiton handler which adds messages, the js in This PR adds the data back to the response, so that these messages once again show. You can add a notification handler
That shows that the message will not show without this PR |
@matthewcare Try as I might, I do not understand how to get the message to show. The message is "Info message" in your screenshot but "Warning Message" in your code, I assume that's just a different example. But in no way do I get to see "Warning message" next to the file(s) with or without returning I'm sure I'm missing something but I don't know what 😅 11279.mp4My updated code looks like this, as you can see in the log we're getting and handling the notifications just fine. public class PostAddFile : INotificationHandler<MediaSavingNotification>
{
private readonly ILogger<PostAddFile> _logger;
public PostAddFile(ILogger<PostAddFile> logger)
{
_logger = logger;
}
public void Handle(MediaSavingNotification notification)
{
notification.Messages.Add(new EventMessage("Category", "Warning Message", EventMessageType.Warning));
foreach(var ent in notification.SavedEntities)
_logger.LogInformation("Saving a media item: " + ent.Name);
}
} |
Thanks for this @matthewcare and congrats on your first accepted PR for Umbraco CMS! 🎉 If you have an Our Umbraco profile then I'd love to give you a contributor badge, if you can link your profile here then I'll get it done. 👍 |
Hi @nul800sebastiaan Thanks :) |
Awesome, thanks @matthewcare! You now have a shiny new contributor badge! 🎖️ Thanks again! |
Hi there @matthewcare, First of all: A big #H5YR for making an Umbraco related contribution during Hacktoberfest! We are very thankful for the huge amount of PRs submitted, and all the amazing work you've been doing 🥇 Due to the amazing work you and others in the community have been doing, we've had a bit of a hard time keeping up. 😅 While all of the PRs for Hacktoberfest might not have been merged yet, you still qualify for receiving some Umbraco swag, congratulations! 🎉 In the spirit of Hacktoberfest we've prepared some exclusive Umbraco swag for all our contributors - including you! As an alternative choice this year, you can opt-out of receiving anything and ask us to help improve the planet instead by planting a tree on your behalf. 🌳 Receive your swag or plant a tree! 👈 Please follow this link to fill out and submit the form, before December 31st, 2021. Following this date we'll be sending out all the swag, but please note that it might not reach your doorstep for a few months, so please bear with us and be patient 🙏 We have blogged about this year's hacktoberfest in a recap post, have a read about at all the achievements for this year! The only thing left to say is thank you so much for participating in Hacktoberfest! We really appreciate the help! Kind regards, |
Add the response data to the return. Fixes #11278
Prerequisites
Fixes #11278
Description
Response data was not being included in the reutrn of
PostAddFile
, which caused notifications to not show correctly.To test, upload new media, and observe the response from the post