This commit is contained in:
@@ -410,6 +410,7 @@ namespace Sockeye.Biz
|
||||
//
|
||||
public async Task HandlePotentialNotificationEvent(SockEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||
{
|
||||
if (ServerBootConfig.MIGRATING) return;
|
||||
ILogger log = Sockeye.Util.ApplicationLogging.CreateLogger<SubscriptionServerBiz>();
|
||||
|
||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [SockType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||
@@ -435,6 +436,39 @@ namespace Sockeye.Biz
|
||||
if (ayaEvent == SockEvent.Created || ayaEvent == SockEvent.Modified)
|
||||
{
|
||||
|
||||
//# NEW TRIAL SERVER REQUEST
|
||||
if (ayaEvent == SockEvent.Created && o.Trial == true)
|
||||
{
|
||||
{
|
||||
//Conditions: must match specific status id value and also tags below
|
||||
//Newly created only and immediate delivery so no need to remove
|
||||
var subs = await ct.NotifySubscription.AsNoTracking().Where(z => z.EventType == NotifyEventType.SubscriptionServerRequestReceived).ToListAsync();
|
||||
foreach (var sub in subs)
|
||||
{
|
||||
//not for inactive users
|
||||
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
||||
|
||||
//Tag match? (will be true if no sub tags so always safe to call this)
|
||||
if (NotifyEventHelper.ObjectHasAllSubscriptionTags(o.Tags, sub.Tags))
|
||||
{
|
||||
NotifyEvent n = new NotifyEvent()
|
||||
{
|
||||
EventType = NotifyEventType.SubscriptionServerRequestReceived,
|
||||
UserId = sub.UserId,
|
||||
SockType = BizType,
|
||||
ObjectId = o.Id,
|
||||
NotifySubscriptionId = sub.Id,
|
||||
Name = $"{o.TrialCompany} - trial server requested"
|
||||
};
|
||||
await ct.NotifyEvent.AddAsync(n);
|
||||
log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]");
|
||||
await ct.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}//new trial server request event
|
||||
|
||||
|
||||
//# SUBSCRIPTION SERVER EXPIRY
|
||||
{
|
||||
//notify users about warranty expiry (time delayed)
|
||||
@@ -498,7 +532,7 @@ namespace Sockeye.Biz
|
||||
}
|
||||
}
|
||||
|
||||
}//subscription server expiry event
|
||||
}//subscription server last updated event
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user