umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.41k stars 2.66k forks source link

notification.CancelOperation message not showing #16794

Open ksolberg opened 1 month ago

ksolberg commented 1 month ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

14.1.1

Bug summary

Cancelling a ContentSaving event with a message, but only a generic error shows up.

image

image

Specifics

No response

Steps to reproduce

Implements a class that inherits INotificationHandler. Loop through SavedEntities and call notification.CancelOperation(new EventMessager("title", "message", EventTypeMessage.Error). Operatinon is cancelled, but custom error title and message is not shown.

Expected result / actual result

No response


This item has been added to our backlog AB#42404

github-actions[bot] commented 1 month ago

Hi there @ksolberg!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

elit0451 commented 1 month ago

Hi @ksolberg 👋

Thank you for reaching out! I was able to reproduce this, we will have a look. Seems like we are not returning the notification message as we had in v13:

Notification

Here is the example code that I used:

public class MyNotificationHandler : INotificationHandler<ContentSavingNotification>
{
    public void Handle(ContentSavingNotification notification)
    {
        foreach (IContent entity in notification.SavedEntities)
        {
            notification.CancelOperation(new EventMessage("My category", "We are canceling", EventMessageType.Error));
        }
    }
}

public class MyComposer : IComposer
{
    public void Compose(IUmbracoBuilder builder)
    {
        builder.AddNotificationHandler<ContentSavingNotification, MyNotificationHandler>();
    }
}
elit0451 commented 1 month ago

Hello again, actually the notification message is part of the Umb-Notifications header and it is a known issue from the front-end side, so it is coming 🙂

CanceledMsg