Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Gavin Williams 47 posts 220 karma points
    Mar 24, 2023 @ 14:04
    Gavin Williams
    0

    Cancelling ContentMovingToRecycleBinNotification via custom notification handler code throws Angular error

    I've created a custom approvals plugin which manages the various content creation, moving, deleting events via the notification handlers, so that editors can make changes but they aren't applied to the content until approved by an admin.

    So for example if an editor moves a page to somewhere else in the content tree, an item in a custom approvals table is created and the actual move is cancelled via notification.Cancel = true in the Handle method. Once approved by an admin via a custom dashboard (which manages the approvals table), the actual move takes place and the approvals table item is then removed.

    Published, SentToPublish, Moving work fine but moving to the recycle bin doesn't work. It hits the handler ok and the code runs fine, but when I set Cancel=true and the code returns back to umbraco, I'm left with the red spinner button, and there's a HTTP400 bad request error in the console for the delete url:

    /umbraco/backoffice/umbracoapi/content/DeleteById?id=46292

    If I move to recycle bin as an admin, everything works fine, so it looks like there's possibly a bug with setting Cancel=true in the ContentMovingToRecycleBinNotification event handler.

    I'm refactoring this plugin from v8, which also is exhibiting the same behaviour. Anyone had this or know how to resolve?

Please Sign in or register to post replies

Write your reply to:

Draft