fixed history

This commit is contained in:
Maksim Chegulov 2023-03-29 13:46:54 +03:00
parent a79c5420b6
commit 0af471a215
3 changed files with 47 additions and 46 deletions

View File

@ -323,30 +323,30 @@ public class FeedAggregateDataProvider
if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(module))
{
return exp;
return null;
}
if (module == Constants.RoomsModule)
switch (module)
{
var roomId = $"{Constants.RoomItem}_{id}";
var sharedRoomId = $"{Constants.SharedRoomItem}_{id}";
case Constants.RoomsModule:
{
var roomId = $"{Constants.RoomItem}_{id}";
exp = f => f.Id == roomId || f.Id.StartsWith(sharedRoomId);
exp = f => f.Id == roomId || (f.Id.StartsWith(Constants.SharedRoomItem) && f.ContextId == roomId);
if (withRelated)
{
exp = f => f.Id == roomId || f.Id.StartsWith(sharedRoomId) || f.ContextId == roomId;
}
}
if (withRelated)
{
exp = f => f.Id == roomId || f.ContextId == roomId;
}
if (module == Constants.FilesModule)
{
exp = f => f.Id.StartsWith($"{Constants.FileItem}_{id}") || f.Id.StartsWith($"{Constants.SharedFileItem}_{id}");
}
if (module == Constants.FoldersModule)
{
exp = f => f.Id == $"{Constants.FolderItem}_{id}" || f.Id.StartsWith($"{Constants.SharedFolderItem}_{id}");
break;
}
case Constants.FilesModule:
exp = f => f.Id.StartsWith($"{Constants.FileItem}_{id}") || f.Id.StartsWith($"{Constants.SharedFileItem}_{id}");
break;
case Constants.FoldersModule:
exp = f => f.Id == $"{Constants.FolderItem}_{id}" || f.Id.StartsWith($"{Constants.SharedFolderItem}_{id}");
break;
}
return exp;

View File

@ -144,7 +144,7 @@ public class FilesModule : FeedModule
return files.Select(f => new Tuple<Feed.Aggregator.Feed, object>(ToFeed(f, folders.FirstOrDefault(r => r.Id.Equals(f.File.ParentId)),
roomsIds.GetValueOrDefault(f.File.ParentId)), f));
}
}
public override async Task<IEnumerable<int>> GetTenantsWithFeeds(DateTime fromTime)
{
@ -162,7 +162,7 @@ public class FilesModule : FeedModule
var feed = new Feed.Aggregator.Feed(shareRecord.Owner, shareRecord.TimeStamp, true)
{
Item = SharedFileItem,
ItemId = string.Format("{0}_{1}", file.Id, shareRecord.Subject),
ItemId = $"{file.Id}_{shareRecord.Subject}",
Product = Product,
Module = Name,
Title = file.Title,
@ -184,7 +184,7 @@ public class FilesModule : FeedModule
return new Feed.Aggregator.Feed(file.ModifiedBy, file.ModifiedOn, true)
{
Item = FileItem,
ItemId = string.Format("{0}_{1}", file.Id, file.Version > 1 ? 1 : 0),
ItemId = $"{file.Id}_{(file.Version > 1 ? file.Version : 0)}",
Product = Product,
Module = Name,
Action = updated ? FeedAction.Updated : FeedAction.Created,

View File

@ -106,45 +106,46 @@ public class RoomsModule : FeedModule
private Feed.Aggregator.Feed ToFeed(FolderWithShare folderWithSecurity)
{
var folder = folderWithSecurity.Folder;
var room = folderWithSecurity.Folder;
var shareRecord = folderWithSecurity.ShareRecord;
if (shareRecord != null)
if (shareRecord == null)
{
var feed = new Feed.Aggregator.Feed(shareRecord.Owner, shareRecord.TimeStamp)
return new Feed.Aggregator.Feed(room.CreateBy, room.CreateOn)
{
Item = SharedRoomItem,
ItemId = string.Format("{0}_{1}_{2}", folder.Id, shareRecord.Subject, shareRecord.TimeStamp.Ticks),
Item = RoomItem,
ItemId = room.Id.ToString(),
Product = Product,
Module = Name,
Title = folder.Title,
Title = room.Title,
ExtraLocationTitle = FilesUCResource.VirtualRooms,
ExtraLocation = folder.ParentId.ToString(),
Keywords = folder.Title,
AdditionalInfo = ((int)folder.FolderType).ToString(),
AdditionalInfo2 = ((int)shareRecord.Share).ToString(),
AdditionalInfo3 = ((int)shareRecord.SubjectType).ToString(),
AdditionalInfo4 = folder.Private ? "private" : null,
Target = shareRecord.Subject,
GroupId = GetGroupId(SharedRoomItem, shareRecord.Owner, folder.ParentId.ToString())
ExtraLocation = room.ParentId.ToString(),
Keywords = room.Title,
AdditionalInfo = ((int)room.FolderType).ToString(),
AdditionalInfo4 = room.Private ? "private" : null,
GroupId = GetGroupId(RoomItem, room.CreateBy, room.ParentId.ToString())
};
return feed;
}
return new Feed.Aggregator.Feed(folder.CreateBy, folder.CreateOn)
var feed = new Feed.Aggregator.Feed(shareRecord.Owner, shareRecord.TimeStamp)
{
Item = RoomItem,
ItemId = folder.Id.ToString(),
Item = SharedRoomItem,
ItemId = $"{shareRecord.Subject}_{shareRecord.TimeStamp.Ticks}",
Product = Product,
Module = Name,
Title = folder.Title,
Title = room.Title,
ExtraLocationTitle = FilesUCResource.VirtualRooms,
ExtraLocation = folder.ParentId.ToString(),
Keywords = folder.Title,
AdditionalInfo = ((int)folder.FolderType).ToString(),
AdditionalInfo4 = folder.Private ? "private" : null,
GroupId = GetGroupId(RoomItem, folder.CreateBy, folder.ParentId.ToString())
ExtraLocation = room.ParentId.ToString(),
Keywords = room.Title,
AdditionalInfo = ((int)room.FolderType).ToString(),
AdditionalInfo2 = ((int)shareRecord.Share).ToString(),
AdditionalInfo3 = ((int)shareRecord.SubjectType).ToString(),
AdditionalInfo4 = room.Private ? "private" : null,
Target = shareRecord.Subject,
GroupId = GetGroupId(SharedRoomItem, shareRecord.Owner, room.ParentId.ToString()),
ContextId = $"{RoomItem}_{room.Id}"
};
return feed;
}
}