diff --git a/src/api/Main/BuisnessLayer/Shrooms.Domain/Services/UserService/UserService.cs b/src/api/Main/BuisnessLayer/Shrooms.Domain/Services/UserService/UserService.cs index f7c3009aa..0aa23947c 100644 --- a/src/api/Main/BuisnessLayer/Shrooms.Domain/Services/UserService/UserService.cs +++ b/src/api/Main/BuisnessLayer/Shrooms.Domain/Services/UserService/UserService.cs @@ -267,7 +267,7 @@ public async Task GetWallNotificationSettings(User .Include(x => x.Wall) .Where(x => x.UserId == userOrg.UserId && x.Wall != null && x.Wall.OrganizationId == userOrg.OrganizationId) .Where(x => x.Wall.Type == WallType.UserCreated || x.Wall.Type == WallType.Main) - .Select(x => new WallNotificationsDto() + .Select(x => new WallNotificationsDto { WallName = x.Wall.Name, WallId = x.WallId, diff --git a/src/api/Main/DataLayer/Shrooms.DataLayer/DAL/ShroomsDbContext.cs b/src/api/Main/DataLayer/Shrooms.DataLayer/DAL/ShroomsDbContext.cs index 7253c4651..db0b176f1 100644 --- a/src/api/Main/DataLayer/Shrooms.DataLayer/DAL/ShroomsDbContext.cs +++ b/src/api/Main/DataLayer/Shrooms.DataLayer/DAL/ShroomsDbContext.cs @@ -252,7 +252,9 @@ p.Entity is ITrackable && private static void UpdateEntityMetadata(IEnumerable entries) { + var now = DateTime.UtcNow; var trackableItems = entries.Where(p => p.Entity is ITrackable); + foreach (var entry in trackableItems) { if (entry.Entity is ITrackable trackableEntry) @@ -265,12 +267,13 @@ private static void UpdateEntityMetadata(IEnumerable entries) if (entry.State == EntityState.Added) { - trackableEntry.Created = DateTime.UtcNow; + trackableEntry.Created = now; + trackableEntry.Modified = now; trackableEntry.CreatedBy = userId; } else if (entry.State == EntityState.Deleted || entry.State == EntityState.Modified) { - trackableEntry.Modified = DateTime.UtcNow; + trackableEntry.Modified = now; trackableEntry.ModifiedBy = userId; } } diff --git a/src/api/Main/PresentationLayer/Shrooms.API/Controllers/NotificationController.cs b/src/api/Main/PresentationLayer/Shrooms.API/Controllers/NotificationController.cs index fc2181099..0bb93a8f8 100644 --- a/src/api/Main/PresentationLayer/Shrooms.API/Controllers/NotificationController.cs +++ b/src/api/Main/PresentationLayer/Shrooms.API/Controllers/NotificationController.cs @@ -1,20 +1,20 @@ -namespace Shrooms.API.Controllers -{ - using System.Collections.Generic; - using System.Linq; - using System.Threading.Tasks; - using System.Web.Http; - using AutoMapper; - using Shrooms.DataTransferObjects.Models.Notification; - using Shrooms.Domain.Services.Notifications; - using Shrooms.EntityModels.Models.Notifications; - using Shrooms.WebViewModels.Models.Notifications; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Web.Http; +using AutoMapper; +using Shrooms.DataTransferObjects.Models.Notification; +using Shrooms.Domain.Services.Notifications; +using Shrooms.EntityModels.Models.Notifications; +using Shrooms.WebViewModels.Models.Notifications; +namespace Shrooms.API.Controllers +{ [Authorize] public class NotificationController : BaseController { - private INotificationService _notificationService; - private IMapper _mapper; + private readonly INotificationService _notificationService; + private readonly IMapper _mapper; public NotificationController(INotificationService notificationService, IMapper mapper) { @@ -52,9 +52,8 @@ private IEnumerable MakeCommentsStacked(IEnumerable CompareSourcesIds(x.sourceIds, item.SourceIds) && - item.Type != NotificationType.EventReminder) - .FirstOrDefault(); + .FirstOrDefault(x => CompareSourcesIds(x.sourceIds, item.SourceIds) && item.Type != NotificationType.EventReminder); + if (parentComment == null) { stackedList.Add(_mapper.Map(item)); @@ -72,7 +71,7 @@ private IEnumerable MakeCommentsStacked(IEnumerable