This commit is contained in:
2021-08-02 18:53:30 +00:00
parent ab5e2205d0
commit 5ecf1a2620
3 changed files with 11 additions and 7 deletions

View File

@@ -298,6 +298,10 @@ namespace AyaNova.Biz
//
internal static async Task AddGeneralNotifyEvent(NotifyEventType eventType, string message, string name, Exception except = null, long userId = 0)
{
await AddGeneralNotifyEvent(AyaType.NoType, 0, eventType, message, name, except, userId);
}
internal static async Task AddGeneralNotifyEvent(AyaType atype, long objectid, NotifyEventType eventType, string message, string name, Exception except = null, long userId = 0)
{
//This handles general notification events not requiring a decision or tied to an object that are basically just a immediate message to the user
@@ -350,7 +354,7 @@ namespace AyaNova.Biz
var gensubs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.GeneralNotification && z.UserId == userId).ToListAsync();
foreach (var sub in gensubs)
{
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = userId, Message = message, NotifySubscriptionId = sub.Id, Name = name };
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = userId, Message = message, NotifySubscriptionId = sub.Id, Name = name, AyaType = atype, ObjectId = objectid };
await ct.NotifyEvent.AddAsync(n);
}
if (gensubs.Count > 0)
@@ -371,7 +375,7 @@ namespace AyaNova.Biz
//not for inactive users
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
//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~" };
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = sub.UserId, Message = message, NotifySubscriptionId = sub.Id, Name = "~SERVER~", AyaType = atype, ObjectId = objectid };
await ct.NotifyEvent.AddAsync(n);
}
if (subs.Count > 0)