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

Split force for publish descendants into separate options for publish unpublish and re-publish unedited (13) #18249

Merged
merged 14 commits into from
Feb 12, 2025

Conversation

AndyButland
Copy link
Contributor

@AndyButland AndyButland commented Feb 6, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

Resolves: #13739

Description

We currently have a single option on the "Publish descendants" dialog, where an editor can "Include unpublished content items". There are cases though we we also want to force a publish even if there are no changes to publish (so notification handlers can fire, indexes can get rebuilt etc.).

So this PR introduces a second option.

image

In code we have a force parameter that gets passed up to the content service. I've split that into two so we can be be more explicit about what exactly we are forcing (publish of unpublished or publish of unchanged).

To Test:

  • I tested this with the help of a notification handler, logging out what is published.
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Notifications;

namespace Umbraco.Cms.Web.UI.Custom;

public class ContentPublishedNotificationHander : INotificationHandler<ContentPublishedNotification>
{
    private readonly ILogger<ContentPublishedNotification> _logger;

    public ContentPublishedNotificationHander(ILogger<ContentPublishedNotification> logger) => _logger = logger;

    public void Handle(ContentPublishedNotification notification)
    {
        foreach (Core.Models.IContent entity in notification.PublishedEntities)
        {
            _logger.LogInformation($"Published content: {entity.Name} ({entity.Id})");
        }
    }
}
  • I then carried out tests for the following scenarios, and received the expected results.
Scenario No Options Selected Force Unpublish Selected Force Re-Publish Selected Both Options Selected
3 children, all published with no changes Nothing published Nothing published Parent and 3 children published Parent and 3 children published
3 children, 2 published with no changes, 1 unpublished Nothing published Single unpublished child is published Parent and 2 published children are published Parent and 3 children published
3 children, 2 published with no changes, 1 published with changes Single changed child is published Single changed child is published Parent and 3 children published Parent and 3 children published
3 children, 1 published with no changes, 1 unpublished, 1 published with changes Single changed child is published Single changed child and single unpublished child is published Parent and 2 published children are published Parent and 3 children published
  • Consider overloads and obsoletions introduced to avoid breaking changes.

@AndyButland AndyButland changed the title Split force for publish descendants into separate options for publish unpublish and re-publish unedited. Split force for publish descendants into separate options for publish unpublish and re-publish unedited Feb 6, 2025
@AndyButland AndyButland marked this pull request as ready for review February 6, 2025 14:41
@AndyButland AndyButland requested a review from Migaroez February 7, 2025 12:45
@AndyButland AndyButland changed the title Split force for publish descendants into separate options for publish unpublish and re-publish unedited Split force for publish descendants into separate options for publish unpublish and re-publish unedited (13) Feb 9, 2025
Copy link
Contributor

@Migaroez Migaroez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested out ok, UI explains the concepts well in my opinion.
Great work 🚀

@AndyButland AndyButland enabled auto-merge (squash) February 12, 2025 11:05
@AndyButland AndyButland merged commit 9227517 into v13/dev Feb 12, 2025
18 of 19 checks passed
@AndyButland AndyButland deleted the v13/feature/force-republish-descendents branch February 12, 2025 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants