From 8dd9d0dc6204648ea2c4dcb0dd8edeed412f2137 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Fri, 28 Nov 2025 13:01:28 +0500 Subject: [PATCH] api: add support for {{Email}} placeholder in announcements --- Notesnook.API/Controllers/AnnouncementController.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Notesnook.API/Controllers/AnnouncementController.cs b/Notesnook.API/Controllers/AnnouncementController.cs index 1a980a2..2c1944d 100644 --- a/Notesnook.API/Controllers/AnnouncementController.cs +++ b/Notesnook.API/Controllers/AnnouncementController.cs @@ -25,6 +25,9 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using MongoDB.Driver; using Notesnook.API.Models; +using Streetwriters.Common; +using Streetwriters.Common.Interfaces; +using Streetwriters.Common.Models; using Streetwriters.Data.Repositories; namespace Notesnook.API.Controllers @@ -59,7 +62,13 @@ namespace Notesnook.API.Controllers { if (action.Type != "link" || action.Data == null) continue; - action.Data = action.Data.Replace("{{UserId}}", userId ?? "0"); + action.Data = action.Data.Replace("{{UserId}}", userId ?? ""); + + if (action.Data.Contains("{{Email}}")) + { + var user = string.IsNullOrEmpty(userId) ? null : await (await WampServers.IdentityServer.GetServiceAsync(IdentityServerTopics.UserAccountServiceTopic)).GetUserAsync(Clients.Notesnook.Id, userId); + action.Data = action.Data.Replace("{{Email}}", user?.Email ?? ""); + } } } }