This commit is contained in:
@@ -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<string> TranslationKeysToFetch = new List<string>();
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user