This commit is contained in:
@@ -13,8 +13,7 @@ using AyaNova.Models;
|
||||
|
||||
namespace AyaNova.Biz
|
||||
{
|
||||
|
||||
//This class handles word breaking, processing keywords and searching for results
|
||||
|
||||
internal static class NotifyEventProcessor
|
||||
{
|
||||
private static ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("NotifyEventProcessor");
|
||||
@@ -34,14 +33,14 @@ namespace AyaNova.Biz
|
||||
else
|
||||
log.LogWarning($"Ops problem notification: \"{message}\"");
|
||||
|
||||
await AddGeneralNotifyEvent(NotifyEventType.ServerOperationsProblem, message);
|
||||
await AddGeneralNotifyEvent(NotifyEventType.ServerOperationsProblem, message,"OPS");
|
||||
}
|
||||
|
||||
|
||||
//This handles general notification events not requiring a decision or tied to an object that are basically just a immediate message to the user
|
||||
//e.g. ops problems, GeneralNotification, NotifyHealthCheck etc
|
||||
//optional user id to send directly to them
|
||||
internal static async Task AddGeneralNotifyEvent(NotifyEventType eventType, string message, Exception except = null, long userId = 0)
|
||||
internal static async Task AddGeneralNotifyEvent(NotifyEventType eventType, string message, string name, Exception except = null, long userId = 0)
|
||||
{
|
||||
log.LogTrace($"AddGeneralNotifyEvent processing: [type:{eventType}, userId:{userId}, message:{message}]");
|
||||
#if (DEBUG)
|
||||
@@ -88,7 +87,12 @@ namespace AyaNova.Biz
|
||||
await ct.SaveChangesAsync();
|
||||
}
|
||||
|
||||
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = userId, Message = message, NotifySubscriptionId = defaultsub.Id, Name = UserName };
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
name = UserName;
|
||||
}
|
||||
|
||||
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = userId, Message = message, NotifySubscriptionId = defaultsub.Id, Name = name };
|
||||
await ct.NotifyEvent.AddAsync(n);
|
||||
await ct.SaveChangesAsync();
|
||||
return;
|
||||
@@ -101,9 +105,9 @@ namespace AyaNova.Biz
|
||||
//append exception message if not null
|
||||
if (except != null)
|
||||
message += $"\nException error: {ExceptionUtil.ExtractAllExceptionMessages(except)}";
|
||||
|
||||
|
||||
foreach (var sub in subs)
|
||||
{
|
||||
{
|
||||
//note flag ~SERVER~ means to client to substitute "Server" translation key text instead
|
||||
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = sub.UserId, Message = message, NotifySubscriptionId = sub.Id, Name = "~SERVER~" };
|
||||
await ct.NotifyEvent.AddAsync(n);
|
||||
|
||||
Reference in New Issue
Block a user