Skip to content
Snippets Groups Projects

Product/970 extend notification channel

Merged Marcel Nellesen requested to merge Product/970-extendNotificationChannel into Sprint/2020-18
5 files
+ 141
4
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -8,6 +8,7 @@ using Coscine.NotificationConfiguration;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using Stubble.Core.Builders;
using System;
using System.Collections.Generic;
using System.Reflection;
@@ -111,7 +112,25 @@ namespace Coscine.Api.NotificationBus.Controllers
{
language = _languageModel.GetById(new Guid(user.LanguageId.ToString())).Abbreviation;
}
return (JObject)(action.Template[channelName][language]);
var template = (JObject)(action.Template[channelName][language]);
var stubble = new StubbleBuilder().Build();
var dict = new Dictionary<string, object>();
if (requestArgs["placeholder"] != null)
{
dict = ((JObject)(requestArgs["placeholder"])).ToObject<Dictionary<string, object>>();
}
dict.Add("_targetUserName", user.DisplayName);
dict.Add("_projectName", project.DisplayName);
foreach (JProperty property in template.Properties())
{
template[property.Name] = stubble.Render(template[property.Name].ToString(), dict);
}
return template;
}
private List<User> GetUsers(List<string> userIds)
Loading