This commit is contained in:
@@ -116,9 +116,11 @@ namespace AyaNova.Biz
|
||||
var usersNeedingTranslations = events.Where(z => z.NotifySubscription.DeliveryMethod != NotifyDeliveryMethod.App && z.User.Active).Select(z => z.NotifySubscription.UserId).ToList().Distinct();
|
||||
foreach (long userid in usersNeedingTranslations)
|
||||
{
|
||||
long transId = (await ct.UserOptions.SingleAsync(z => z.UserId == userid)).TranslationId;
|
||||
var usr = await ct.User.AsNoTracking().Include(z => z.UserOptions).SingleAsync(z => z.Id == userid);
|
||||
long transId = usr.UserOptions.TranslationId;
|
||||
|
||||
_UserTranslationIdCache.Add(userid, transId);
|
||||
await CacheTranslations(transId);
|
||||
await CacheTranslations(transId, usr.Roles);
|
||||
}
|
||||
//cache all translations of the word "Server" for server notifications
|
||||
_ServerTheWordTranslations = await TranslationBiz.GetAllTranslationsForKey("Server");
|
||||
@@ -193,13 +195,21 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
//cache any translations required for email notification
|
||||
private static async Task CacheTranslations(long translationId)
|
||||
private static async Task CacheTranslations(long translationId, AuthorizationRoles roles)
|
||||
{
|
||||
if (!_NotifyEventTypeTransCache.ContainsKey(translationId))
|
||||
_NotifyEventTypeTransCache.Add(translationId, await AyaNova.Api.Controllers.EnumListController.GetEnumList("NotifyEventType", translationId));
|
||||
_NotifyEventTypeTransCache.Add(translationId, await AyaNova.Api.Controllers.EnumListController.GetEnumList(
|
||||
"NotifyEventType",
|
||||
translationId,
|
||||
roles));
|
||||
|
||||
if (!_AyaTypeTypeTransCache.ContainsKey(translationId))
|
||||
_AyaTypeTypeTransCache.Add(translationId, await AyaNova.Api.Controllers.EnumListController.GetEnumList("AyaType", translationId));
|
||||
_AyaTypeTypeTransCache.Add(
|
||||
translationId,
|
||||
await AyaNova.Api.Controllers.EnumListController.GetEnumList(
|
||||
"AyaType",
|
||||
translationId,
|
||||
roles));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user