diff --git a/server/AyaNova/biz/NotifyEventProcessor.cs b/server/AyaNova/biz/NotifyEventProcessor.cs index c9fce23f..a82e53be 100644 --- a/server/AyaNova/biz/NotifyEventProcessor.cs +++ b/server/AyaNova/biz/NotifyEventProcessor.cs @@ -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, diff --git a/server/AyaNova/models/NotifyEvent.cs b/server/AyaNova/models/NotifyEvent.cs index 1c9efc25..9c798b62 100644 --- a/server/AyaNova/models/NotifyEvent.cs +++ b/server/AyaNova/models/NotifyEvent.cs @@ -19,6 +19,8 @@ namespace AyaNova.Models public AyaType AyaType { get; set; } public long ObjectId { get; set; } [Required] + public string Name {get;set;}//object name or closest equivalent for display + [Required] public NotifyEventType EventType { get; set; } [Required] public long UserId { get; set; } @@ -46,6 +48,7 @@ namespace AyaNova.Models // AgeValue = TimeSpan.Zero; AyaType = AyaType.NoType; ObjectId = 0; + Name=string.Empty; } public override string ToString() diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index c32256e7..9f8fa243 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -689,7 +689,7 @@ $BODY$; "deliveryaddress text, attachreportid bigint not null, tags varchar(255) ARRAY)"); await ExecQueryAsync("CREATE TABLE anotifyevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created timestamp not null, " + - "ayatype integer not null, objectid bigint not null, eventtype integer not null, notifysubscriptionid bigint not null references anotifysubscription(id) on delete cascade, " + + "ayatype integer not null, objectid bigint not null, name varchar(255) not null, eventtype integer not null, notifysubscriptionid bigint not null references anotifysubscription(id) on delete cascade, " + "userid bigint not null, idvalue bigint not null, decvalue decimal(19,4) not null, eventdate timestamp, message text)");