Merge remote-tracking branch 'origin/v11/dev' into v12/dev

# Conflicts:
#	src/Umbraco.Core/Services/ContentService.cs
#	tests/Umbraco.Tests.AcceptanceTest/package-lock.json
#	tests/Umbraco.Tests.AcceptanceTest/package.json
#	tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/BlockGridEditor/Content/blockGridEditorAdvanced.spec.ts
#	tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/BlockGridEditor/Content/blockGridEditorAreasContent.spec.ts
#	tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/BlockGridEditor/Content/blockGridEditorSettings.spec.ts
#	tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/BlockGridEditor/Datatype/BlockGridEditorDataTypeBlocks.spec.ts
#	tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/content.spec.ts
#	tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/ModelsBuilder/modelsbuilder.spec.ts
#	tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/partialViewMacroFiles.spec.ts
This commit is contained in:
Bjarke Berg
2023-10-10 12:49:22 +02:00
14 changed files with 824 additions and 86 deletions

View File

@@ -1955,7 +1955,7 @@ public class ContentService : RepositoryService, IContentService
cultures = new HashSet<string>(); // empty means 'already published'
}
if (isRoot || edited)
if (edited)
{
cultures.Add(c); // <culture> means 'republish this culture'
}
@@ -2110,13 +2110,11 @@ public class ContentService : RepositoryService, IContentService
}
// deal with the branch root - if it fails, abort
var rootPublishNotificationState = new Dictionary<string, object?>();
PublishResult? rootResult = SaveAndPublishBranchItem(scope, document, shouldPublish, publishCultures, true,
publishedDocuments, eventMessages, userId, allLangs, rootPublishNotificationState);
if (rootResult != null)
PublishResult? result = SaveAndPublishBranchItem(scope, document, shouldPublish, publishCultures, true, publishedDocuments, eventMessages, userId, allLangs, out IDictionary<string, object?> notificationState);
if (result != null)
{
results.Add(rootResult);
if (!rootResult.Success)
results.Add(result);
if (!result.Success)
{
return results;
}
@@ -2129,7 +2127,6 @@ public class ContentService : RepositoryService, IContentService
int count;
var page = 0;
const int pageSize = 100;
PublishResult? result = null;
do
{
count = 0;
@@ -2148,8 +2145,7 @@ public class ContentService : RepositoryService, IContentService
}
// no need to check path here, parent has to be published here
result = SaveAndPublishBranchItem(scope, d, shouldPublish, publishCultures, false,
publishedDocuments, eventMessages, userId, allLangs,null);
result = SaveAndPublishBranchItem(scope, d, shouldPublish, publishCultures, false, publishedDocuments, eventMessages, userId, allLangs, out _);
if (result != null)
{
results.Add(result);
@@ -2173,12 +2169,7 @@ public class ContentService : RepositoryService, IContentService
// (SaveAndPublishBranchOne does *not* do it)
scope.Notifications.Publish(
new ContentTreeChangeNotification(document, TreeChangeTypes.RefreshBranch, eventMessages));
if (rootResult?.Success is true)
{
scope.Notifications.Publish(
new ContentPublishedNotification(rootResult!.Content!.Yield(), eventMessages, true)
.WithState(rootPublishNotificationState));
}
scope.Notifications.Publish(new ContentPublishedNotification(publishedDocuments, eventMessages).WithState(notificationState));
scope.Complete();
}
@@ -2189,9 +2180,6 @@ public class ContentService : RepositoryService, IContentService
// shouldPublish: a function determining whether the document has changes that need to be published
// note - 'force' is handled by 'editing'
// publishValues: a function publishing values (using the appropriate PublishCulture calls)
/// <param name="rootPublishingNotificationState">Only set this when processing a the root of the branch
/// Published notification will not be send when this property is set</param>
/// <returns></returns>
private PublishResult? SaveAndPublishBranchItem(
ICoreScope scope,
IContent document,
@@ -2203,8 +2191,9 @@ public class ContentService : RepositoryService, IContentService
EventMessages evtMsgs,
int userId,
IReadOnlyCollection<ILanguage> allLangs,
IDictionary<string, object?>? rootPublishingNotificationState)
out IDictionary<string, object?> notificationState)
{
notificationState = new Dictionary<string, object?>();
HashSet<string>? culturesToPublish = shouldPublish(document);
// null = do not include
@@ -2232,17 +2221,11 @@ public class ContentService : RepositoryService, IContentService
return new PublishResult(PublishResultType.FailedPublishContentInvalid, evtMsgs, document);
}
var notificationState = rootPublishingNotificationState ?? new Dictionary<string, object?>();
PublishResult result = CommitDocumentChangesInternal(scope, document, evtMsgs, allLangs, notificationState, userId, true, isRoot);
if (!result.Success)
PublishResult result = CommitDocumentChangesInternal(scope, document, evtMsgs, allLangs, savingNotification.State, userId, true, isRoot);
if (result.Success)
{
return result;
}
publishedDocuments.Add(document);
if (rootPublishingNotificationState == null)
{
scope.Notifications.Publish(new ContentPublishedNotification(result.Content!, evtMsgs).WithState(notificationState));
publishedDocuments.Add(document);
notificationState = savingNotification.State;
}
return result;

View File

@@ -586,6 +586,11 @@ public class BackOfficeController : UmbracoController
if (errors.Count > 0)
{
// the external user might actually be signed in at this point, but certain errors (i.e. missing claims)
// prevents us from applying said user to a back-office session. make sure the sign-in manager does not
// report the user as being signed in for subsequent requests.
await _signInManager.SignOutAsync();
ViewData.SetExternalSignInProviderErrors(
new BackOfficeExternalLoginProviderErrors(
loginInfo.LoginProvider,

View File

@@ -188,15 +188,41 @@ public class ExamineManagementController : UmbracoAuthorizedJsonController
private ExamineIndexModel CreateModel(IIndex index)
{
var indexName = index.Name;
IIndexDiagnostics indexDiag = _indexDiagnosticsFactory.Create(index);
Attempt<string?> isHealth = indexDiag.IsHealthy();
var healthResult = isHealth.Result;
long documentCount;
int fieldCount;
try
{
// This will throw if the index is corrupted - i.e. a file in the index folder cannot be found
// Which will break the UI and not give the possibility to rebuild the index
documentCount = indexDiag.GetDocumentCount();
fieldCount = indexDiag.GetFieldNames().Count();
}
catch (FileNotFoundException ex)
{
// Safe catch that will allow to rebuild a corrupted index
documentCount = 0;
fieldCount = 0;
_logger.LogWarning(ex, "{name} is corrupted.", indexName);
if (!string.IsNullOrWhiteSpace(healthResult))
{
healthResult += " ";
}
// Provide a useful message in the Examine dashboard
healthResult += $"It may not be possible to rebuild the index. Please try deleting the entire {indexName} folder and then attempt to rebuild it again.";
}
var properties = new Dictionary<string, object?>
{
["DocumentCount"] = indexDiag.GetDocumentCount(),
["FieldCount"] = indexDiag.GetFieldNames().Count()
["DocumentCount"] = documentCount,
["FieldCount"] = fieldCount
};
foreach (KeyValuePair<string, object?> p in indexDiag.Metadata)
@@ -207,7 +233,7 @@ public class ExamineManagementController : UmbracoAuthorizedJsonController
var indexerModel = new ExamineIndexModel
{
Name = indexName,
HealthStatus = isHealth.Success ? isHealth.Result ?? "Healthy" : isHealth.Result ?? "Unhealthy",
HealthStatus = isHealth.Success ? healthResult ?? "Healthy" : healthResult ?? "Unhealthy",
ProviderProperties = properties,
CanRebuild = _indexRebuilder.CanRebuild(index.Name)
};