Skip to content
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

Notification state is lost when use "Publish with descendants" #14543

Closed
PeterKvayt opened this issue Jul 11, 2023 · 4 comments
Closed

Notification state is lost when use "Publish with descendants" #14543

PeterKvayt opened this issue Jul 11, 2023 · 4 comments

Comments

@PeterKvayt
Copy link
Contributor

PeterKvayt commented Jul 11, 2023

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

11.3.1

Bug summary

I have two notification handlers: Published and Publishing. In Publishing I set notification state and in Published I use that state.
When I try to publish through "Save and publish" unpublished content I set notification state in Publishing notification and get it in Published notificaiton as expected. But when I try to publish through "Publish with descendants" unpublished content I set notification state in Publishing notification but I get empty state for Published notificaiton.

Specifics

I tested it with async content notification handlers

Steps to reproduce

  1. Fresh umbraco 11.3.1 (default setup, telemetry minimal)
  2. Create document type (Foo) with template
  3. Register two notification handlers:
public class Published : INotificationAsyncHandler<ContentPublishedNotification>
{
  public Task HandleAsync(ContentPublishedNotification notification, CancellationToken cancellationToken)
  {
      notification.State.TryGetValue("test", out var value);

      return Task.CompletedTask;
  }
}
public class Publishing : INotificationAsyncHandler<ContentPublishingNotification>
{
    public Task HandleAsync(ContentPublishingNotification notification, CancellationToken cancellationToken)
    {
        notification.State.Add("test", notification.PublishedEntities.Select(x => x.Id).ToList());

        return Task.CompletedTask;
    }
}

// Starttup.cs
public void ConfigureServices(IServiceCollection services)
        {
            services.AddUmbraco(_env, _config)
                .AddBackOffice()
                .AddWebsite()
                .AddComposers()
                .AddNotificationAsyncHandler<ContentPublishingNotification, Publishing>()
                .AddNotificationAsyncHandler<ContentPublishedNotification, Published>()
                .Build();
        }
  1. Create document "Test" in content tab (use "Foo" document type). Click "Save and publish".
  2. Refresh page
  3. Unpublish "Test" page.
  4. Set breakpoints in handlers classes
  5. Click "Publish with descendants"
  6. In "Publishing" handler state is setted as expected
  7. In "Published" handler state is null

Expected result / actual result

Expected: state from Published was the same as in Publishing when triggered by "Publish with descendants".

Actual: state in Publishing is null when triggered by "Publish with descendants".


This item has been added to our backlog AB#31344

@github-actions
Copy link

Hi there @PeterKvayt!

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'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

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 🤖 🙂

@andr317c
Copy link
Contributor

Hey!

Thanks a lot for posting this issue and for the clear reproduction steps💪. I was able to reproduce it on v11.3.1 and v12.0.1.

I will go ahead and mark this issue as a sprint candidate!

@Migaroez
Copy link
Contributor

Migaroez commented Sep 4, 2023

Hey @PeterKvayt as you can see we have created a fix for this issue and are going trough the process of validating it. Would be awesome if you could test the fix as well and give us your feedback.

@Zeegaan
Copy link
Member

Zeegaan commented Sep 5, 2023

Fixed in #14763 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants