This commit is contained in:
2020-07-20 23:17:07 +00:00
parent 5bfdaad629
commit 243d71612d
3 changed files with 11 additions and 6 deletions

View File

@@ -76,7 +76,8 @@ namespace AyaNova.Biz
//this will likely be a development error, not a production error so no need to log etc
throw new System.ArgumentException("NotifyEventProcessor:AddGeneralNotifyEvent: DefaultNotification requires a user id but none was specified");
}
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = userId, Message = message, NotifySubscriptionId = 0 };
var UserName = await ct.User.Where(z => z.Id == userId).Select(z => z.Name).FirstOrDefaultAsync();
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = userId, Message = message, NotifySubscriptionId = 0, Name = UserName };
await ct.NotifyEvent.AddAsync(n);
await ct.SaveChangesAsync();
return;
@@ -87,7 +88,8 @@ namespace AyaNova.Biz
var subs = await ct.NotifySubscription.Where(z => z.EventType == eventType).ToListAsync();
foreach (var sub in subs)
{
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = sub.UserId, Message = message, NotifySubscriptionId = sub.Id };
//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);
}
if (subs.Count > 0)
@@ -206,9 +208,9 @@ namespace AyaNova.Biz
if (TagsMatch(newObject.Tags, sub.Tags))
{
//Note: age is set by advance notice which is consulted by CoreJobNotify in it's run so the deliver date is not required here only the reference EventDate to check for deliver
//ObjectAge is determined by subscription AgeValue in combo with the EventDate NotifyEvent parameter which together determines at what age from notifyevent.EventDate it's considered for the event to have officially occured
//However delivery is determined by sub.advancenotice so all three values play a part
//
//ObjectAge is determined by subscription AgeValue in combo with the EventDate NotifyEvent parameter which together determines at what age from notifyevent.EventDate it's considered for the event to have officially occured
//However delivery is determined by sub.advancenotice so all three values play a part
//
NotifyEvent n = new NotifyEvent()
{
EventType = NotifyEventType.ObjectAge,