This commit is contained in:
2020-10-21 15:41:57 +00:00
parent 09c26fc6a8
commit b021d82c12

View File

@@ -230,10 +230,11 @@ namespace AyaNova.Biz
if (ne.AyaType != AyaType.NoType)
AyaTypeTranslated = $":{GetTranslatedAyaTypeName(ne.AyaType, transid)}";
var subject = $"AY{AyaTypeTranslated}:{GetTranslatedNotifyEventName(ne.EventType, transid)}:{name}";
//subscription link translation
var SubscriptionTypeName = $":{GetTranslatedAyaTypeName(AyaType.NotifySubscription, transid)}";
IMailer m = AyaNova.Util.ServiceProviderProvider.Mailer;
try
{
@@ -242,10 +243,19 @@ namespace AyaNova.Biz
if (ne.ObjectId != 0 || ne.EventType == NotifyEventType.BackupStatus)
{
body = OpenObjectUrlBuilder(ne.AyaType, ne.ObjectId, ne.EventType) + "\n";
body = OpenObjectUrlBuilder(ne.AyaType, ne.ObjectId, ne.EventType) + "\n";
}
body += ne.Message;
//Add link to subscription
//http://localhost:8080/open/51/1 //add subscription link, notifysub is object type 51
if (!body.EndsWith('\n'))
{
body += "\n";
}
body += $"({SubscriptionTypeName}: {OpenSubscriptionUrlBuilder(ne.NotifySubscriptionId)} )\n";
if (!ServerGlobalOpsSettingsCache.Notify.SmtpDeliveryActive)
{
await NotifyEventProcessor.AddGeneralNotifyEvent(NotifyEventType.GeneralNotification, $"Email notifications are set to OFF at server, unable to send email notification for this event:{ne}", "Error", null, ne.UserId);
@@ -343,6 +353,24 @@ namespace AyaNova.Biz
return $"{ServerUrl}/viewreport?oid={objectId}&rid={reportId}";
}
//url to open subscription for editing
private static string OpenSubscriptionUrlBuilder(long id)
{
var ServerUrl = ServerGlobalOpsSettingsCache.Notify.AyaNovaServerURL;
if (string.IsNullOrWhiteSpace(ServerUrl))
{
NotifyEventProcessor.AddOpsProblemEvent("Notification system: The OPS Notification setting is empty for AyaNova Server URL. This prevents Notification system from linking events to openable objects.").Wait();
return "OPS ERROR NO SERVER URL CONFIGURED";
}
ServerUrl = ServerUrl.Trim().TrimEnd('/');
//default is to open the object in question directly
return $"{ServerUrl}/open/{(int)AyaType.NotifySubscription}/{id}";
}
/////////////////////////////////////////////////////////////////////
}//eoc