This commit is contained in:
@@ -77,6 +77,8 @@ namespace AyaNova.Biz
|
||||
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectCreated && z.AyaType == newObject.AyaType).ToListAsync();
|
||||
foreach (var sub in subs)
|
||||
{
|
||||
//not for inactive users
|
||||
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
||||
if (TagsMatch(newObject.Tags, sub.Tags))
|
||||
{
|
||||
NotifyEvent n = new NotifyEvent()
|
||||
@@ -101,6 +103,8 @@ namespace AyaNova.Biz
|
||||
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectAge && z.AyaType == newObject.AyaType).ToListAsync();
|
||||
foreach (var sub in subs)
|
||||
{
|
||||
//not for inactive users
|
||||
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
||||
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
|
||||
@@ -137,6 +141,8 @@ namespace AyaNova.Biz
|
||||
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectModified && z.AyaType == newObject.AyaType).ToListAsync();
|
||||
foreach (var sub in subs)
|
||||
{
|
||||
//not for inactive users
|
||||
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
||||
if (TagsMatch(newObject.Tags, sub.Tags))
|
||||
{
|
||||
NotifyEvent n = new NotifyEvent()
|
||||
@@ -174,6 +180,8 @@ namespace AyaNova.Biz
|
||||
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectDeleted && z.AyaType == bizObject.AyaType).ToListAsync();
|
||||
foreach (var sub in subs)
|
||||
{
|
||||
//not for inactive users
|
||||
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
||||
if (TagsMatch(bizObject.Tags, sub.Tags))
|
||||
{
|
||||
//TODO: On deliver should point to history event log record or take from there and insert into delivery message?
|
||||
@@ -265,6 +273,7 @@ namespace AyaNova.Biz
|
||||
|
||||
internal static async Task AddGeneralNotifyEvent(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
|
||||
//e.g. ops problems, GeneralNotification, NotifyHealthCheck etc
|
||||
//optional user id to send directly to them
|
||||
@@ -301,6 +310,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: GeneralNotification requires a user id but none was specified");
|
||||
}
|
||||
//not for inactive users
|
||||
if (!await UserBiz.UserIsActive(userId)) return;
|
||||
|
||||
var UserName = await ct.User.AsNoTracking().Where(z => z.Id == userId).Select(z => z.Name).FirstOrDefaultAsync();
|
||||
|
||||
@@ -328,6 +339,8 @@ namespace AyaNova.Biz
|
||||
|
||||
foreach (var sub in subs)
|
||||
{
|
||||
//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~" };
|
||||
await ct.NotifyEvent.AddAsync(n);
|
||||
|
||||
Reference in New Issue
Block a user