Skip to content

Commit

Permalink
ASC.Web.Core: StudioWhatsNewNotify: fix error in notify logs (FileUpd…
Browse files Browse the repository at this point in the history
…atedRevisionComment audit event is written to the database without room information)
  • Loading branch information
andreysavihin committed Feb 5, 2024
1 parent 6a11fee commit 48b941f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
15 changes: 12 additions & 3 deletions products/ASC.Files/Core/Configuration/ProductEntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public string GetModuleResource(string ResourceClassTypeName, string ResourseKey
}
}

public override async Task<IEnumerable<ActivityInfo>> GetAuditEventsAsync(DateTime scheduleDate, Guid userId, Tenant tenant, WhatsNewType whatsNewType)
public override async Task<IEnumerable<ActivityInfo>> GetAuditEventsAsync(DateTime scheduleDate, Guid userId, Tenant tenant, WhatsNewType whatsNewType, ILogger logger)
{
IEnumerable<AuditEvent> events;
_tenantManager.SetCurrentTenant(tenant);
Expand Down Expand Up @@ -203,8 +203,17 @@ public override async Task<IEnumerable<ActivityInfo>> GetAuditEventsAsync(DateTi
activityInfo.FileUrl = _commonLinkUtility.GetFullAbsolutePath(_filesLinkUtility.GetFileWebEditorUrl(e.Target.GetItems().FirstOrDefault()));
}

var obj = e.Description.LastOrDefault();
var additionalInfo = JsonSerializer.Deserialize<AdditionalNotificationInfo>(obj);
AdditionalNotificationInfo additionalInfo;

try
{
additionalInfo = JsonSerializer.Deserialize<AdditionalNotificationInfo>(e.Description.LastOrDefault());
}
catch (Exception ex)
{
logger.ErrorWithException("Error deserializing audit event: " + e.Id, ex);
continue;
}

activityInfo.TargetUsers = additionalInfo.UserIds;

Expand Down
2 changes: 1 addition & 1 deletion products/ASC.Files/Core/Core/FileStorageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ public async Task<string> UpdateCommentAsync<T>(T fileId, int version, string co

comment = await fileDao.UpdateCommentAsync(fileId, version, comment);

await _filesMessageService.SendAsync(MessageAction.FileUpdatedRevisionComment, file, file.Title, version.ToString(CultureInfo.InvariantCulture));
await _filesMessageService.SendAsync(MessageAction.FileUpdatedRevisionComment, file, new[] { file.Title, version.ToString(CultureInfo.InvariantCulture) });

return comment;
}
Expand Down
2 changes: 1 addition & 1 deletion web/ASC.Web.Core/IProduct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ public interface IProduct : IWebItem

void Shutdown();

Task<IEnumerable<ActivityInfo>> GetAuditEventsAsync(DateTime scheduleDate, Guid userId, Tenant tenant,WhatsNewType whatsNewType);
Task<IEnumerable<ActivityInfo>> GetAuditEventsAsync(DateTime scheduleDate, Guid userId, Tenant tenant,WhatsNewType whatsNewType, ILogger logger);
}
2 changes: 1 addition & 1 deletion web/ASC.Web.Core/Notify/StudioWhatsNewNotify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private async Task SendMsgWhatsNewAsync(int tenantid, DateTime scheduleDate, Wha

foreach (var p in products)
{
auditEvents.AddRange(await p.GetAuditEventsAsync(scheduleDate, user.Id, tenant, whatsNewType));
auditEvents.AddRange(await p.GetAuditEventsAsync(scheduleDate, user.Id, tenant, whatsNewType, _log));
}

_log.Debug($"SendMsgWhatsNew auditEvents count : {auditEvents.Count}");//temp
Expand Down
2 changes: 1 addition & 1 deletion web/ASC.Web.Core/Product.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public abstract class Product : IProduct

public virtual void Shutdown() { }

public virtual Task<IEnumerable<ActivityInfo>> GetAuditEventsAsync(DateTime scheduleDate, Guid userId, Tenant tenant, WhatsNewType whatsNewType)
public virtual Task<IEnumerable<ActivityInfo>> GetAuditEventsAsync(DateTime scheduleDate, Guid userId, Tenant tenant, WhatsNewType whatsNewType, ILogger logger)
{
return Task.FromResult(Enumerable.Empty<ActivityInfo>());
}
Expand Down

0 comments on commit 48b941f

Please sign in to comment.