Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/Umbraco.Core/EmbeddedResources/Lang/da.xml
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,6 @@
<key alias="removeTextBox">Fjern denne tekstboks</key>
<key alias="contentRoot">Indholdsrod</key>
<key alias="includeUnpublished">Inkluder ikke-udgivet indhold.</key>
<key alias="forceRepublish">Udgiv uændrede elementer.</key>
<key alias="forceRepublishWarning">ADVARSEL: Udgivelse af alle sider under denne i indholdstræet, uanset om de er ændret eller ej, kan være en ressourcekrævende og langvarig proces.</key>
<key alias="forceRepublishAdvisory">Dette bør ikke være nødvendigt under normale omstændigheder, så fortsæt kun med denne handling, hvis du er sikker på, at det er nødvendigt.</key>
<key alias="isSensitiveValue">Denne værdi er skjult. Hvis du har brug for adgang til at se denne værdi, bedes du
kontakte din administrator.
</key>
Expand Down
3 changes: 0 additions & 3 deletions src/Umbraco.Core/EmbeddedResources/Lang/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,6 @@
<key alias="removeTextBox">Remove this text box</key>
<key alias="contentRoot">Content root</key>
<key alias="includeUnpublished">Include unpublished content items.</key>
<key alias="forceRepublish">Publish unchanged items.</key>
<key alias="forceRepublishWarning">WARNING: Publishing all pages below this one in the content tree, whether or not they have changed, can be an expensive and long-running operation.</key>
<key alias="forceRepublishAdvisory">This should not be necessary in normal circumstances so please only proceed with this option selected if you are certain it is required.</key>
<key alias="isSensitiveValue">This value is hidden. If you need access to view this value please contact your
website administrator.
</key>
Expand Down
3 changes: 0 additions & 3 deletions src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,6 @@
<key alias="removeTextBox">Remove this text box</key>
<key alias="contentRoot">Content root</key>
<key alias="includeUnpublished">Include unpublished content items.</key>
<key alias="forceRepublish">Publish unchanged items.</key>
<key alias="forceRepublishWarning">WARNING: Publishing all pages below this one in the content tree, whether or not they have changed, can be an expensive and long-running operation.</key>
<key alias="forceRepublishAdvisory">This should not be necessary in normal circumstances so please only proceed with this option selected if you are certain it is required.</key>
<key alias="isSensitiveValue">This value is hidden. If you need access to view this value please contact your
website administrator.
</key>
Expand Down
32 changes: 0 additions & 32 deletions src/Umbraco.Core/Models/ContentEditing/ContentSaveAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,43 +59,11 @@ public enum ContentSaveAction
/// Saves and publishes the content item including all descendants regardless of whether they have a published version
/// or not.
/// </summary>
[Obsolete("This option is no longer used as the 'force' aspect has been extended into options for publishing unpublished and re-publishing changed content. Please use one of those options instead.")]
PublishWithDescendantsForce = 10,

/// <summary>
/// Creates and publishes the new content item including all descendants regardless of whether they have a published
/// version or not.
/// </summary>
[Obsolete("This option is no longer used as the 'force' aspect has been extended into options for publishing unpublished and re-publishing changed content. Please use one of those options instead.")]
PublishWithDescendantsForceNew = 11,

/// <summary>
/// Saves and publishes the content item including all descendants including publishing previously unpublished content.
/// </summary>
PublishWithDescendantsIncludeUnpublished = 12,

/// <summary>
/// Saves and publishes the new content item including all descendants including publishing previously unpublished content.
/// </summary>
PublishWithDescendantsIncludeUnpublishedNew = 13,

/// <summary>
/// Saves and publishes the content item including all descendants irrespective of whether there are any pending changes.
/// </summary>
PublishWithDescendantsForceRepublish = 14,

/// <summary>
/// Saves and publishes the new content item including all descendants including publishing previously unpublished content.
/// </summary>
PublishWithDescendantsForceRepublishNew = 15,

/// <summary>
/// Saves and publishes the content item including all descendants including publishing previously unpublished content and irrespective of whether there are any pending changes.
/// </summary>
PublishWithDescendantsIncludeUnpublishedAndForceRepublish = 16,

/// <summary>
/// Saves and publishes the new content item including all descendants including publishing previously unpublished content and irrespective of whether there are any pending changes.
/// </summary>
PublishWithDescendantsIncludeUnpublishedAndForceRepublishNew = 17,
}
33 changes: 2 additions & 31 deletions src/Umbraco.Web.BackOffice/Controllers/ContentController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Net.Mime;

Check notice on line 1 in src/Umbraco.Web.BackOffice/Controllers/ContentController.cs

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v13/dev)

✅ Getting better: Lines of Code in a Single File

The lines of code decreases from 2061 to 2051, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.

Check notice on line 1 in src/Umbraco.Web.BackOffice/Controllers/ContentController.cs

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v13/dev)

✅ Getting better: Overall Code Complexity

The mean cyclomatic complexity decreases from 5.93 to 5.85, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
using System.Text;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http.Extensions;
Expand Down Expand Up @@ -1007,24 +1007,14 @@
{
case ContentSaveAction.Publish:
case ContentSaveAction.PublishWithDescendants:
#pragma warning disable CS0618 // Type or member is obsolete
case ContentSaveAction.PublishWithDescendantsForce:
#pragma warning restore CS0618 // Type or member is obsolete
case ContentSaveAction.PublishWithDescendantsIncludeUnpublished:
case ContentSaveAction.PublishWithDescendantsForceRepublish:
case ContentSaveAction.PublishWithDescendantsIncludeUnpublishedAndForceRepublish:
case ContentSaveAction.SendPublish:
case ContentSaveAction.Schedule:
contentItem.Action = ContentSaveAction.Save;
break;
case ContentSaveAction.PublishNew:
case ContentSaveAction.PublishWithDescendantsNew:
#pragma warning disable CS0618 // Type or member is obsolete
case ContentSaveAction.PublishWithDescendantsForceNew:
#pragma warning restore CS0618 // Type or member is obsolete
case ContentSaveAction.PublishWithDescendantsIncludeUnpublishedNew:
case ContentSaveAction.PublishWithDescendantsForceRepublishNew:
case ContentSaveAction.PublishWithDescendantsIncludeUnpublishedAndForceRepublishNew:
case ContentSaveAction.SendPublishNew:
case ContentSaveAction.ScheduleNew:
contentItem.Action = ContentSaveAction.SaveNew;
Expand Down Expand Up @@ -1158,16 +1148,8 @@
break;
case ContentSaveAction.PublishWithDescendants:
case ContentSaveAction.PublishWithDescendantsNew:
#pragma warning disable CS0618 // Type or member is obsolete
case ContentSaveAction.PublishWithDescendantsForce:
case ContentSaveAction.PublishWithDescendantsForceNew:
#pragma warning restore CS0618 // Type or member is obsolete
case ContentSaveAction.PublishWithDescendantsIncludeUnpublished:
case ContentSaveAction.PublishWithDescendantsIncludeUnpublishedNew:
case ContentSaveAction.PublishWithDescendantsForceRepublish:
case ContentSaveAction.PublishWithDescendantsForceRepublishNew:
case ContentSaveAction.PublishWithDescendantsIncludeUnpublishedAndForceRepublish:
case ContentSaveAction.PublishWithDescendantsIncludeUnpublishedAndForceRepublishNew:
{
if (!await ValidatePublishBranchPermissionsAsync(contentItem))
{
Expand Down Expand Up @@ -1238,26 +1220,15 @@

private static PublishBranchFilter BuildPublishBranchFilter(ContentSaveAction contentSaveAction)
{
var includeUnpublished = contentSaveAction == ContentSaveAction.PublishWithDescendantsIncludeUnpublished
|| contentSaveAction == ContentSaveAction.PublishWithDescendantsIncludeUnpublishedNew
|| contentSaveAction == ContentSaveAction.PublishWithDescendantsIncludeUnpublishedAndForceRepublish
|| contentSaveAction == ContentSaveAction.PublishWithDescendantsIncludeUnpublishedAndForceRepublishNew;
var forceRepublish = contentSaveAction == ContentSaveAction.PublishWithDescendantsForceRepublish
|| contentSaveAction == ContentSaveAction.PublishWithDescendantsForceRepublishNew
|| contentSaveAction == ContentSaveAction.PublishWithDescendantsIncludeUnpublishedAndForceRepublish
|| contentSaveAction == ContentSaveAction.PublishWithDescendantsIncludeUnpublishedAndForceRepublishNew;
var includeUnpublished = contentSaveAction == ContentSaveAction.PublishWithDescendantsForce
|| contentSaveAction == ContentSaveAction.PublishWithDescendantsForceNew;

PublishBranchFilter publishBranchFilter = PublishBranchFilter.Default;
if (includeUnpublished)
{
publishBranchFilter |= PublishBranchFilter.IncludeUnpublished;
}

Check notice on line 1231 in src/Umbraco.Web.BackOffice/Controllers/ContentController.cs

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v13/dev)

✅ No longer an issue: Complex Method

BuildPublishBranchFilter is no longer above the threshold for cyclomatic complexity. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
if (forceRepublish)
{
publishBranchFilter |= PublishBranchFilter.ForceRepublish;
}

return publishBranchFilter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,68 +181,58 @@
contentIdToCheck = contentToCheck?.Id ?? default;
break;
case ContentSaveAction.Publish:
case ContentSaveAction.PublishWithDescendants:
#pragma warning disable CS0618 // Type or member is obsolete
case ContentSaveAction.PublishWithDescendantsForce:
#pragma warning restore CS0618 // Type or member is obsolete
case ContentSaveAction.PublishWithDescendantsIncludeUnpublished:
case ContentSaveAction.PublishWithDescendantsForceRepublish:
case ContentSaveAction.PublishWithDescendantsIncludeUnpublishedAndForceRepublish:
permissionToCheck.Add(ActionPublish.ActionLetter);
contentToCheck = contentItem.PersistedContent;
contentIdToCheck = contentToCheck?.Id ?? default;
break;
case ContentSaveAction.SendPublish:
permissionToCheck.Add(ActionToPublish.ActionLetter);
contentToCheck = contentItem.PersistedContent;
contentIdToCheck = contentToCheck?.Id ?? default;
break;
case ContentSaveAction.Schedule:
permissionToCheck.Add(ActionUpdate.ActionLetter);
permissionToCheck.Add(ActionPublish.ActionLetter);
contentToCheck = contentItem.PersistedContent;
contentIdToCheck = contentToCheck?.Id ?? default;
break;
case ContentSaveAction.SaveNew:
//Save new requires ActionNew

permissionToCheck.Add(ActionNew.ActionLetter);

if (contentItem.ParentId != Constants.System.Root)
{
contentToCheck = _contentService.GetById(contentItem.ParentId);
contentIdToCheck = contentToCheck?.Id ?? default;
}
else
{
contentIdToCheck = contentItem.ParentId;
}

break;
case ContentSaveAction.SendPublishNew:
//Send new requires both ActionToPublish AND ActionNew

permissionToCheck.Add(ActionNew.ActionLetter);
permissionToCheck.Add(ActionToPublish.ActionLetter);
if (contentItem.ParentId != Constants.System.Root)
{
contentToCheck = _contentService.GetById(contentItem.ParentId);
contentIdToCheck = contentToCheck?.Id ?? default;
}
else
{
contentIdToCheck = contentItem.ParentId;
}

break;
case ContentSaveAction.PublishNew:
case ContentSaveAction.PublishWithDescendantsNew:
#pragma warning disable CS0618 // Type or member is obsolete
case ContentSaveAction.PublishWithDescendantsForceNew:

Check notice on line 235 in src/Umbraco.Web.BackOffice/Filters/ContentSaveValidationAttribute.cs

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v13/dev)

✅ Getting better: Complex Method

ValidateUserAccessAsync decreases in cyclomatic complexity from 42 to 36, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
#pragma warning restore CS0618 // Type or member is obsolete
case ContentSaveAction.PublishWithDescendantsIncludeUnpublishedNew:
case ContentSaveAction.PublishWithDescendantsForceRepublishNew:
case ContentSaveAction.PublishWithDescendantsIncludeUnpublishedAndForceRepublishNew:
//Publish new requires both ActionNew AND ActionPublish
// TODO: Shouldn't publish also require ActionUpdate since it will definitely perform an update to publish but maybe that's just implied

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@
//we need to return this promise so that the dialog can handle the result and wire up the validation response
return performSave({
saveMethod: function (content, create, files, showNotifications) {
return contentResource.publishWithDescendants(content, create, model.includeUnpublished, model.forceRepublish, files, showNotifications);
return contentResource.publishWithDescendants(content, create, model.includeUnpublished, files, showNotifications);
},
action: "publishDescendants",
showNotifications: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1003,18 +1003,14 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
* @returns {Promise} resourcePromise object containing the saved content item.
*
*/
publishWithDescendants: function (content, isNew, includeUnpublished, forceRepublish, files, showNotifications) {
publishWithDescendants: function (content, isNew, includeUnpublished, files, showNotifications) {
var endpoint = umbRequestHelper.getApiUrl(
"contentApiBaseUrl",
"PostSave");

var action = "publishWithDescendants";
if (includeUnpublished === true && forceRepublish === true) {
action += "IncludeUnpublishedAndForceRepublish";
} else if (includeUnpublished === true) {
action += "IncludeUnpublished";
} else if (forceRepublish === true) {
action += "ForceRepublish";
if (includeUnpublished === true) {
action += "Force";
}

return saveContentItem(content, action + (isNew ? "New" : ""), files, endpoint, showNotifications);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@

var vm = this;
vm.includeUnpublished = $scope.model.includeUnpublished || false;
vm.forceRepublish = $scope.model.forceRepublish || false;
vm.publishAll = false;

vm.changeSelection = changeSelection;
vm.toggleIncludeUnpublished = toggleIncludeUnpublished;
vm.toggleForceRepublish = toggleForceRepublish;
vm.changePublishAllSelection = changePublishAllSelection;

function onInit() {
Expand All @@ -30,11 +28,6 @@
vm.labels.includeUnpublished = value;
});
}
if (!vm.labels.forceRepublish) {
localizationService.localize("content_forceRepublish").then(value => {
vm.labels.forceRepublish = value;
});
}

vm.variants.forEach(variant => {
variant.isMandatory = isMandatoryFilter(variant);
Expand Down Expand Up @@ -74,11 +67,6 @@
$scope.model.includeUnpublished = vm.includeUnpublished;
}

function toggleForceRepublish() {
vm.forceRepublish = !vm.forceRepublish;
$scope.model.forceRepublish = vm.forceRepublish;
}

/** Returns true if publishing is possible based on if there are un-published mandatory languages */
function canPublish() {
var selected = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,6 @@
show-labels="true">
</umb-toggle>
</div>

<div class="flex mb3">
<umb-toggle checked="vm.forceRepublish"
on-click="vm.toggleForceRepublish()"
class="mr2"
input-id="includeUnpublished"
label-on="{{vm.labels.forceRepublish}}"
label-off="{{vm.labels.forceRepublish}}"
label-position="right"
show-labels="true">
</umb-toggle>
</div>
<div ng-if="vm.forceRepublish" class="umb-alert umb-alert--warning">
<p><localize key="content_forceRepublishWarning"></localize></p>
<p><localize key="content_forceRepublishAdvisory"></localize></p>
</div>
</div>

<div ng-if="vm.displayVariants.length > 1">
Expand All @@ -51,22 +35,6 @@
</umb-toggle>
</div>

<div class="flex mb3">
<umb-toggle checked="vm.forceRepublish"
on-click="vm.toggleForceRepublish()"
class="mr2"
input-id="includeUnpublished"
label-on="{{vm.labels.forceRepublish}}"
label-off="{{vm.labels.forceRepublish}}"
label-position="right"
show-labels="true">
</umb-toggle>
</div>
<div ng-if="vm.forceRepublish" class="umb-alert umb-alert--warning">
<p><localize key="content_forceRepublishWarning"></localize></p>
<p><localize key="content_forceRepublishAdvisory"></localize></p>
</div>

<div class="umb-list umb-list--condensed">

<div class="umb-list-item" ng-if="vm.displayVariants.length > 1">
Expand Down
Loading