This commit is contained in:
@@ -79,7 +79,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
//not for inactive users
|
||||
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
||||
if (TagsMatch(newObject.Tags, sub.Tags))
|
||||
if (ObjectHasAllSubscriptionTags(newObject.Tags, sub.Tags))
|
||||
{
|
||||
NotifyEvent n = new NotifyEvent()
|
||||
{
|
||||
@@ -105,7 +105,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
//not for inactive users
|
||||
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
||||
if (TagsMatch(newObject.Tags, sub.Tags))
|
||||
if (ObjectHasAllSubscriptionTags(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
|
||||
@@ -143,7 +143,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
//not for inactive users
|
||||
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
||||
if (TagsMatch(newObject.Tags, sub.Tags))
|
||||
if (ObjectHasAllSubscriptionTags(newObject.Tags, sub.Tags))
|
||||
{
|
||||
NotifyEvent n = new NotifyEvent()
|
||||
{
|
||||
@@ -182,7 +182,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
//not for inactive users
|
||||
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
||||
if (TagsMatch(bizObject.Tags, sub.Tags))
|
||||
if (ObjectHasAllSubscriptionTags(bizObject.Tags, sub.Tags))
|
||||
{
|
||||
//TODO: On deliver should point to history event log record or take from there and insert into delivery message?
|
||||
NotifyEvent n = new NotifyEvent()
|
||||
@@ -236,7 +236,7 @@ namespace AyaNova.Biz
|
||||
//
|
||||
// A match here means *all* tags in the subscription are present in the object
|
||||
//
|
||||
public static bool TagsMatch(List<string> objectTags, List<string> subTags)
|
||||
public static bool ObjectHasAllSubscriptionTags(List<string> objectTags, List<string> subTags)
|
||||
{
|
||||
//no subscription tags? Then it always will match
|
||||
if (subTags.Count == 0) return true;
|
||||
@@ -250,6 +250,23 @@ namespace AyaNova.Biz
|
||||
return subTags.All(z => objectTags.Any(x => x == z));
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
// COMPARE TAGS COLLECTION
|
||||
//
|
||||
// A match here means *all* tags are the same in both objects (don't have to be in same order)
|
||||
//
|
||||
public static bool TwoObjectsHaveSameTags(List<string> firstObjectTags, List<string> secondObjectTags)
|
||||
{
|
||||
//no tags on either side?
|
||||
if (firstObjectTags.Count == 0 && secondObjectTags.Count == 0) return true;
|
||||
|
||||
//different counts will always mean not a match
|
||||
if (firstObjectTags.Count != secondObjectTags.Count) return false;
|
||||
|
||||
//Do ALL the tags in the first object exist in the second object?
|
||||
return firstObjectTags.All(z => secondObjectTags.Any(x => x == z));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
// CREATE OPS PROBLEM EVENT
|
||||
//
|
||||
@@ -346,7 +363,7 @@ namespace AyaNova.Biz
|
||||
|
||||
foreach (var sub in subs)
|
||||
{
|
||||
//not for inactive users
|
||||
//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~" };
|
||||
|
||||
Reference in New Issue
Block a user