mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-02-12 11:12:44 +00:00
api: add support for {{Email}} placeholder in announcements
This commit is contained in:
@@ -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<IUserAccountService>(IdentityServerTopics.UserAccountServiceTopic)).GetUserAsync(Clients.Notesnook.Id, userId);
|
||||
action.Data = action.Data.Replace("{{Email}}", user?.Email ?? "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user