From e6f379034fb856c45ef701a18a3fe74dccb875b4 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Tue, 17 Sep 2024 10:58:47 +0200 Subject: [PATCH] Add notification alias to document notifications endpoint output (#17028) --- .../DocumentNotificationPresentationFactory.cs | 15 ++++++++------- src/Umbraco.Cms.Api.Management/OpenApi.json | 4 ++++ .../DocumentNotificationsResponseModel.cs | 2 ++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Cms.Api.Management/Factories/DocumentNotificationPresentationFactory.cs b/src/Umbraco.Cms.Api.Management/Factories/DocumentNotificationPresentationFactory.cs index 549163df91..7daf762b78 100644 --- a/src/Umbraco.Cms.Api.Management/Factories/DocumentNotificationPresentationFactory.cs +++ b/src/Umbraco.Cms.Api.Management/Factories/DocumentNotificationPresentationFactory.cs @@ -27,13 +27,14 @@ internal sealed class DocumentNotificationPresentationFactory : IDocumentNotific .ToArray() ?? Array.Empty(); - var availableActionIds = _actionCollection.Where(a => a.ShowInNotifier).Select(a => a.Letter.ToString()).ToArray(); - - return await Task.FromResult( - availableActionIds.Select(actionId => new DocumentNotificationResponseModel + return await Task.FromResult(_actionCollection + .Where(action => action.ShowInNotifier) + .Select(action => new DocumentNotificationResponseModel { - ActionId = actionId, - Subscribed = subscribedActionIds.Contains(actionId) - }).ToArray()); + ActionId = action.Letter, + Alias = action.Alias, + Subscribed = subscribedActionIds.Contains(action.Letter) + }) + .ToArray()); } } diff --git a/src/Umbraco.Cms.Api.Management/OpenApi.json b/src/Umbraco.Cms.Api.Management/OpenApi.json index e5e2f04d42..d1b5eea473 100644 --- a/src/Umbraco.Cms.Api.Management/OpenApi.json +++ b/src/Umbraco.Cms.Api.Management/OpenApi.json @@ -36279,6 +36279,7 @@ "DocumentNotificationResponseModel": { "required": [ "actionId", + "alias", "subscribed" ], "type": "object", @@ -36286,6 +36287,9 @@ "actionId": { "type": "string" }, + "alias": { + "type": "string" + }, "subscribed": { "type": "boolean" } diff --git a/src/Umbraco.Cms.Api.Management/ViewModels/Document/DocumentNotificationsResponseModel.cs b/src/Umbraco.Cms.Api.Management/ViewModels/Document/DocumentNotificationsResponseModel.cs index b3ae3b8f6e..cf7665a643 100644 --- a/src/Umbraco.Cms.Api.Management/ViewModels/Document/DocumentNotificationsResponseModel.cs +++ b/src/Umbraco.Cms.Api.Management/ViewModels/Document/DocumentNotificationsResponseModel.cs @@ -4,5 +4,7 @@ public class DocumentNotificationResponseModel { public required string ActionId { get; set; } + public required string Alias { get; set; } + public required bool Subscribed { get; set; } }