From d1bc8b7dfcce58911d2d38f677c69b28b0780499 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 8 Jun 2021 22:45:01 +0000 Subject: [PATCH] --- server/AyaNova/generator/CoreJobNotify.cs | 42 +++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/server/AyaNova/generator/CoreJobNotify.cs b/server/AyaNova/generator/CoreJobNotify.cs index 828b522c..d204474b 100644 --- a/server/AyaNova/generator/CoreJobNotify.cs +++ b/server/AyaNova/generator/CoreJobNotify.cs @@ -112,7 +112,7 @@ namespace AyaNova.Biz } finally { - log.LogTrace("Notify is done setting to not running state and tagging lastRun timestamp"); + log.LogTrace("Notify is done setting to not running state and tagging lastRun timestamp"); lastRun = DateTime.UtcNow; NotifyIsRunning = false; @@ -130,17 +130,7 @@ namespace AyaNova.Biz } -/* -todo: this message sucks: -http://localhost:8080/open/34/18 ------ -(:WorkOrder: http://localhost:8080/open/51/8 ) - - -the first link is to the workorder, teh second one that says workorder is to the subscription - -*/ private static async Task DeliverSMTP(NotifyEvent ne, NotifySubscription sub, AyContext ct) { try @@ -155,6 +145,7 @@ the first link is to the workorder, teh second one that says workorder is to the //Email notification requires pre-translated values List TranslationKeysToFetch = new List(); TranslationKeysToFetch.Add(ne.AyaType.ToString()); + TranslationKeysToFetch.Add("NotifySubscription"); if (ne.Name == "~SERVER~") TranslationKeysToFetch.Add("Server"); var EventTypeTranslationKey = "NotifyEvent" + ne.EventType.ToString(); @@ -162,28 +153,43 @@ the first link is to the workorder, teh second one that says workorder is to the var transid = await ct.UserOptions.AsNoTracking().Where(x => x.UserId == sub.UserId).Select(x => x.TranslationId).FirstOrDefaultAsync(); var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, transid); + var NotifySubscriptionTheWord = LT["NotifySubscription"]; var name = ne.Name; if (name == "~SERVER~") name = LT["Server"]; //AyaType translation - var AyaTypeTranslated = string.Empty; + var AyaTypeTranslated = "-"; if (ne.AyaType != AyaType.NoType) - AyaTypeTranslated = $":{LT[ne.AyaType.ToString()]}"; + AyaTypeTranslated = $"{LT[ne.AyaType.ToString()]}"; + + //subscription name translation + var SubscriptionTypeName = LT[EventTypeTranslationKey]; + + var subject = $"AY:{AyaTypeTranslated}:{name}:{SubscriptionTypeName}"; - var subject = $"AY{AyaTypeTranslated}:{LT[EventTypeTranslationKey]}:{name}"; - //subscription link translation - var SubscriptionTypeName = AyaTypeTranslated; IMailer m = AyaNova.Util.ServiceProviderProvider.Mailer; var body = ""; //NOTE: if need any other exemptions besides backup status make a separate static function "CanOpen(NotifyEventType)" + /* +todo: this message sucks: + +http://localhost:8080/open/34/18 +----- +(:WorkOrder: http://localhost:8080/open/51/8 ) + + +the first link is to the workorder, teh second one that says workorder is to the subscription + +*/ + if (ne.ObjectId != 0 || ne.EventType == NotifyEventType.BackupStatus) { - body = OpenObjectUrlBuilder(ne.AyaType, ne.ObjectId, ne.EventType) + "\n"; + body = $"{AyaTypeTranslated}\n{OpenObjectUrlBuilder(ne.AyaType, ne.ObjectId, ne.EventType)}\n"; } body += ne.Message; @@ -192,7 +198,7 @@ the first link is to the workorder, teh second one that says workorder is to the if (!body.EndsWith('\n')) body += "\n"; - body += $"-----\n({SubscriptionTypeName}: {OpenSubscriptionUrlBuilder(ne.NotifySubscriptionId)} )\n"; + body += $"-----\n{NotifySubscriptionTheWord}\n{OpenSubscriptionUrlBuilder(ne.NotifySubscriptionId)}\n"; if (!ServerGlobalOpsSettingsCache.Notify.SmtpDeliveryActive) {