This commit is contained in:
2020-07-27 23:47:12 +00:00
parent f2f0113d62
commit eb1786da85
3 changed files with 25 additions and 3 deletions

View File

@@ -39,6 +39,7 @@ namespace AyaNova.Biz
//temporary list to hold translations as required during delivery
private static Dictionary<long, List<NameIdItem>> _transCache = new Dictionary<long, List<NameIdItem>>();
private static Dictionary<long, long> _UserTranslationIdCache = new Dictionary<long, long>();
private static Dictionary<long, string> _ServerTheWordTranslations = new Dictionary<long, string>();
////////////////////////////////////////////////////////////////////////////////////////////////
// DoSweep
@@ -117,6 +118,8 @@ namespace AyaNova.Biz
_UserTranslationIdCache.Add(userid, transId);
await CacheNotifyEventTypeTranslations(transId);
}
//cache all translations of the word "Server" for server notifications
_ServerTheWordTranslations = await TranslationBiz.GetAllTranslationsForKey("Server");
//iterate and deliver
foreach (var notifyevent in events)
@@ -209,7 +212,12 @@ namespace AyaNova.Biz
var transid = _UserTranslationIdCache[ne.NotifySubscription.UserId];
var subject = $"AY:{GetTranslatedNotifyEventName(ne.EventType, transid)}:{ne.Name}";
var name = ne.Name;
if (name == "~SERVER~")
{
name = _ServerTheWordTranslations.First(z => z.Key == transid).Value;
}
var subject = $"AY:{GetTranslatedNotifyEventName(ne.EventType, transid)}:{name}";
IMailer m = AyaNova.Util.ServiceProviderProvider.Mailer;
try