Merge branch 'develop' into feature/new-profile

This commit is contained in:
Alexey Safronov 2022-09-16 16:06:06 +03:00 committed by GitHub
commit 0cf4e6e25b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 118 additions and 128 deletions

View File

@ -92,7 +92,7 @@ export default inject(({ filesStore, selectedFolderStore }) => {
const { navigationPath, parentId } = selectedFolderStore;
let isRootRoom, isRoom, id;
if (navigationPath.length) {
if (navigationPath && navigationPath.length) {
isRootRoom = navigationPath.at(-1).isRootRoom;
isRoom = navigationPath.at(-1).isRoom;
id = navigationPath.at(-1).id;

View File

@ -165,6 +165,8 @@ const StyledArticleHeader = styled.div`
StyledArticleHeader.defaultProps = { theme: Base };
const StyledHeading = styled.div`
height: 24px;
margin: 0;
padding: 0;
cursor: pointer;
@ -191,6 +193,7 @@ const StyledHeading = styled.div`
`;
const StyledIconBox = styled.div`
cursor: pointer;
display: none;
align-items: center;
height: 20px;

View File

@ -3,15 +3,13 @@ import PropTypes from "prop-types";
import { useHistory, useLocation } from "react-router";
import Loaders from "@docspace/common/components/Loaders";
import { isTablet as isTabletUtils } from "@docspace/components/utils/device";
import Link from "@docspace/components/link";
import { isTablet, isMobileOnly } from "react-device-detect";
import { inject, observer } from "mobx-react";
import { ReactSVG } from "react-svg";
import styled, { css } from "styled-components";
import {
StyledArticleHeader,
StyledHeading,
StyledIconBox,
StyledMenuIcon,
} from "../styled-article";
const ArticleHeader = ({
@ -62,10 +60,9 @@ const ArticleHeader = ({
<Loaders.ArticleHeader height="24px" width="211px" />
) : (
<StyledHeading showText={showText} size="large">
<img
src="/static/images/logo.docspace.react.svg"
onClick={onLogoClick}
/>
<Link href={showText ? "/" : null} onClick={onLogoClick}>
<img src="/static/images/logo.docspace.react.svg" />
</Link>
</StyledHeading>
)}
</StyledArticleHeader>

View File

@ -112,7 +112,7 @@ public interface IFileDao<T>
/// <remarks>
/// Return only the latest versions of files of a folder
/// </remarks>
IAsyncEnumerable<File<T>> GetFilesAsync(T parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false);
IAsyncEnumerable<File<T>> GetFilesAsync(T parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool exludeSubject = false);
/// <summary>
/// Get stream of file

View File

@ -57,11 +57,11 @@ public interface IFolderDao<T>
/// <returns>root folder</returns>
Task<Folder<T>> GetRootFolderByFileAsync(T fileId);
IAsyncEnumerable<Folder<T>> GetRoomsAsync(T parentId, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders,
bool withoutTags, bool withoutMe);
IAsyncEnumerable<Folder<T>> GetRoomsAsync(T parentId, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders,
bool withoutTags, bool excludeSubject);
IAsyncEnumerable<Folder<T>> GetRoomsAsync(IEnumerable<T> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders,
bool withoutTags, bool withoutMe);
IAsyncEnumerable<Folder<T>> GetRoomsAsync(IEnumerable<T> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders,
bool withoutTags, bool excludeSubject);
/// <summary>
/// Get a list of folders in current folder.
@ -81,7 +81,7 @@ public interface IFolderDao<T>
/// <param name="withSubfolders"></param>
/// <param name="tagIds"></param>
/// <returns></returns>
IAsyncEnumerable<Folder<T>> GetFoldersAsync(T parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false);
IAsyncEnumerable<Folder<T>> GetFoldersAsync(T parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool exludeSubject = false);
/// <summary>
/// Gets the folder (s) by ID (s)
@ -95,7 +95,7 @@ public interface IFolderDao<T>
/// <param name="checkShare"></param>
/// <param name="tagIds"></param>
/// <returns></returns>
IAsyncEnumerable<Folder<T>> GetFoldersAsync(IEnumerable<T> folderIds, FilterType filterTypes = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true);
IAsyncEnumerable<Folder<T>> GetFoldersAsync(IEnumerable<T> folderIds, FilterType filterTypes = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool exludeSubject = false);
/// <summary>
/// Get folder, contains folder with id

View File

@ -275,7 +275,7 @@ internal class FileDao : AbstractDao, IFileDao<int>
}
}
public async IAsyncEnumerable<File<int>> GetFilesAsync(int parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false)
public async IAsyncEnumerable<File<int>> GetFilesAsync(int parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool excludeSubject = false)
{
if (filterType == FilterType.FoldersOnly)
{
@ -333,7 +333,7 @@ internal class FileDao : AbstractDao, IFileDao<int>
}
else
{
q = q.Where(r => r.CreateBy == subjectID);
q = excludeSubject ? q.Where(r => r.CreateBy != subjectID) : q.Where(r => r.CreateBy == subjectID);
}
}

View File

@ -166,7 +166,7 @@ internal class FolderDao : AbstractDao, IFolderDao<int>
return GetFoldersAsync(parentId, default, FilterType.None, false, default, string.Empty);
}
public async IAsyncEnumerable<Folder<int>> GetRoomsAsync(int parentId, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe)
public async IAsyncEnumerable<Folder<int>> GetRoomsAsync(int parentId, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject)
{
if (CheckInvalidFilter(filterType))
{
@ -181,8 +181,8 @@ internal class FolderDao : AbstractDao, IFolderDao<int>
var filesDbContext = _dbContextFactory.CreateDbContext();
var q = GetFolderQuery(filesDbContext, r => r.ParentId == parentId).AsNoTracking();
q = !withSubfolders ? BuildRoomsQuery(filesDbContext, q, filter, tags, ownerId, searchByTags, withoutTags, searchByTypes, false, withoutMe)
: BuildRoomsWithSubfoldersQuery(filesDbContext, parentId, filter, tags, searchByTags, searchByTypes, withoutTags, withoutMe, ownerId);
q = !withSubfolders ? BuildRoomsQuery(filesDbContext, q, filter, tags, subjectId, searchByTags, withoutTags, searchByTypes, false, excludeSubject)
: BuildRoomsWithSubfoldersQuery(filesDbContext, parentId, filter, tags, searchByTags, searchByTypes, withoutTags, excludeSubject, subjectId);
if (!string.IsNullOrEmpty(searchText))
{
@ -196,7 +196,7 @@ internal class FolderDao : AbstractDao, IFolderDao<int>
}
}
public async IAsyncEnumerable<Folder<int>> GetRoomsAsync(IEnumerable<int> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe)
public async IAsyncEnumerable<Folder<int>> GetRoomsAsync(IEnumerable<int> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject)
{
if (CheckInvalidFilter(filterType))
{
@ -211,8 +211,8 @@ internal class FolderDao : AbstractDao, IFolderDao<int>
var filesDbContext = _dbContextFactory.CreateDbContext();
var q = GetFolderQuery(filesDbContext, f => roomsIds.Contains(f.Id)).AsNoTracking();
q = !withSubfolders ? BuildRoomsQuery(filesDbContext, q, filter, tags, ownerId, searchByTags, withoutTags, searchByTypes, false, withoutMe)
: BuildRoomsWithSubfoldersQuery(filesDbContext, roomsIds, filter, tags, searchByTags, searchByTypes, withoutTags, withoutMe, ownerId);
q = !withSubfolders ? BuildRoomsQuery(filesDbContext, q, filter, tags, subjectId, searchByTags, withoutTags, searchByTypes, false, excludeSubject)
: BuildRoomsWithSubfoldersQuery(filesDbContext, roomsIds, filter, tags, searchByTags, searchByTypes, withoutTags, excludeSubject, subjectId);
if (!string.IsNullOrEmpty(searchText))
{
@ -226,7 +226,7 @@ internal class FolderDao : AbstractDao, IFolderDao<int>
}
}
public async IAsyncEnumerable<Folder<int>> GetFoldersAsync(int parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false)
public async IAsyncEnumerable<Folder<int>> GetFoldersAsync(int parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false)
{
if (CheckInvalidFilter(filterType))
{
@ -276,7 +276,7 @@ internal class FolderDao : AbstractDao, IFolderDao<int>
}
else
{
q = q.Where(r => r.CreateBy == subjectID);
q = excludeSubject ? q.Where(r => r.CreateBy != subjectID) : q.Where(r => r.CreateBy == subjectID);
}
}
@ -286,7 +286,7 @@ internal class FolderDao : AbstractDao, IFolderDao<int>
}
}
public async IAsyncEnumerable<Folder<int>> GetFoldersAsync(IEnumerable<int> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true)
public async IAsyncEnumerable<Folder<int>> GetFoldersAsync(IEnumerable<int> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false)
{
if (CheckInvalidFilter(filterType))
{
@ -330,7 +330,7 @@ internal class FolderDao : AbstractDao, IFolderDao<int>
}
else
{
q = q.Where(r => r.CreateBy == subjectID);
q = excludeSubject ? q.Where(r => r.CreateBy != subjectID) : q.Where(r => r.CreateBy == subjectID);
}
}
@ -1459,8 +1459,8 @@ internal class FolderDao : AbstractDao, IFolderDao<int>
}
}
private IQueryable<DbFolder> BuildRoomsQuery(FilesDbContext filesDbContext, IQueryable<DbFolder> query, FolderType filterByType, IEnumerable<string> tags, Guid ownerId, bool searchByTags, bool withoutTags,
bool searchByFilter, bool withSubfolders, bool withoutMe)
private IQueryable<DbFolder> BuildRoomsQuery(FilesDbContext filesDbContext, IQueryable<DbFolder> query, FolderType filterByType, IEnumerable<string> tags, Guid subjectId, bool searchByTags, bool withoutTags,
bool searchByFilter, bool withSubfolders, bool excludeSubject)
{
if (searchByFilter)
{
@ -1473,14 +1473,9 @@ internal class FolderDao : AbstractDao, IFolderDao<int>
.Where(r => r.tag.Type == TagType.Custom).Any(t => t.EntryId == f.Id.ToString()));
}
if (ownerId != Guid.Empty && !withoutMe)
if (subjectId != Guid.Empty)
{
query = query.Where(f => f.CreateBy == ownerId);
}
if (ownerId == Guid.Empty && withoutMe)
{
query = query.Where((f => f.CreateBy != _authContext.CurrentAccount.ID));
query = excludeSubject ? query.Where(f => f.CreateBy != subjectId) : query.Where(f => f.CreateBy == subjectId);
}
if (searchByTags && !withSubfolders)
@ -1495,11 +1490,11 @@ internal class FolderDao : AbstractDao, IFolderDao<int>
}
private IQueryable<DbFolder> BuildRoomsWithSubfoldersQuery(FilesDbContext filesDbContext, int parentId, FolderType filterByType, IEnumerable<string> tags, bool searchByTags, bool searchByFilter, bool withoutTags,
bool withoutMe, Guid ownerId)
bool excludeSubject, Guid subjectId)
{
var q1 = GetFolderQuery(filesDbContext, r => r.ParentId == parentId).AsNoTracking();
q1 = BuildRoomsQuery(filesDbContext, q1, filterByType, tags, ownerId, searchByTags, withoutTags, searchByFilter, true, withoutMe);
q1 = BuildRoomsQuery(filesDbContext, q1, filterByType, tags, subjectId, searchByTags, withoutTags, searchByFilter, true, excludeSubject);
if (searchByTags)
{
@ -1513,7 +1508,7 @@ internal class FolderDao : AbstractDao, IFolderDao<int>
.Select(r => r.folder);
}
if (!searchByFilter && !searchByTags && !withoutTags && !withoutMe)
if (!searchByFilter && !searchByTags && !withoutTags && !excludeSubject)
{
return GetFolderQuery(filesDbContext).AsNoTracking()
.Join(filesDbContext.Tree, r => r.Id, a => a.FolderId, (folder, tree) => new { folder, tree })

View File

@ -258,7 +258,7 @@ public class FileStorageService<T> //: IFileStorageService
SearchArea searchArea = SearchArea.Active,
bool withoutTags = false,
IEnumerable<string> tagNames = null,
bool withoutMe = false)
bool excludeSubject = false)
{
var subjectId = string.IsNullOrEmpty(subject) ? Guid.Empty : new Guid(subject);
@ -308,7 +308,7 @@ public class FileStorageService<T> //: IFileStorageService
try
{
(entries, total) = await _entryManager.GetEntriesAsync(parent, from, count, filterType, subjectGroup, subjectId, searchText, searchInContent, withSubfolders, orderBy, searchArea,
withoutTags, tagNames, withoutMe);
withoutTags, tagNames, excludeSubject);
}
catch (Exception e)
{

View File

@ -921,11 +921,11 @@ public class FileSecurity : IFileSecurity
}
public async Task<List<FileEntry>> GetVirtualRoomsAsync(FilterType filterType, Guid subjectId, string searchText, bool searchInContent, bool withSubfolders,
SearchArea searchArea, bool withoutTags, IEnumerable<string> tagNames, bool withoutMe)
SearchArea searchArea, bool withoutTags, IEnumerable<string> tagNames, bool excludeSubject)
{
if (_fileSecurityCommon.IsAdministrator(_authContext.CurrentAccount.ID))
{
return await GetVirtualRoomsForAdminAsync(filterType, subjectId, searchText, searchInContent, withSubfolders, searchArea, withoutTags, tagNames, withoutMe);
return await GetVirtualRoomsForAdminAsync(filterType, subjectId, searchText, searchInContent, withSubfolders, searchArea, withoutTags, tagNames, excludeSubject);
}
var securityDao = _daoFactory.GetSecurityDao<int>();
@ -934,9 +934,9 @@ public class FileSecurity : IFileSecurity
var entries = new List<FileEntry>();
var rooms = await GetVirtualRoomsForUserAsync<int>(records.Where(r => r.EntryId is int), subjects, filterType, subjectId, searchText, searchInContent,
withSubfolders, searchArea, withoutTags, tagNames, withoutMe);
withSubfolders, searchArea, withoutTags, tagNames, excludeSubject);
var thirdPartyRooms = await GetVirtualRoomsForUserAsync<string>(records.Where(r => r.EntryId is string), subjects, filterType, subjectId, searchText,
searchInContent, withSubfolders, searchArea, withoutTags, tagNames, withoutMe);
searchInContent, withSubfolders, searchArea, withoutTags, tagNames, excludeSubject);
entries.AddRange(rooms);
entries.AddRange(thirdPartyRooms);
@ -945,7 +945,7 @@ public class FileSecurity : IFileSecurity
}
private async Task<List<FileEntry>> GetVirtualRoomsForAdminAsync(FilterType filterType, Guid subjectId, string search, bool searchInContent, bool withSubfolders,
SearchArea searchArea, bool withoutTags, IEnumerable<string> tagNames, bool withoutMe)
SearchArea searchArea, bool withoutTags, IEnumerable<string> tagNames, bool excludeSubject)
{
var folderDao = _daoFactory.GetFolderDao<int>();
var folderThirdPartyDao = _daoFactory.GetFolderDao<string>();
@ -962,8 +962,8 @@ public class FileSecurity : IFileSecurity
var roomsFolderId = await _globalFolder.GetFolderVirtualRoomsAsync<int>(_daoFactory);
var thirdPartyRoomsIds = await providerDao.GetProvidersInfoAsync(FolderType.VirtualRooms).Select(p => p.FolderId).ToListAsync();
var roomsEntries = await folderDao.GetRoomsAsync(roomsFolderId, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, withoutMe).ToListAsync();
var thirdPartyRoomsEntries = await folderThirdPartyDao.GetRoomsAsync(thirdPartyRoomsIds, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, withoutMe)
var roomsEntries = await folderDao.GetRoomsAsync(roomsFolderId, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject).ToListAsync();
var thirdPartyRoomsEntries = await folderThirdPartyDao.GetRoomsAsync(thirdPartyRoomsIds, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject)
.ToListAsync();
foldersInt.AddRange(roomsEntries);
@ -994,8 +994,8 @@ public class FileSecurity : IFileSecurity
var archiveFolderId = await _globalFolder.GetFolderArchive<int>(_daoFactory);
var thirdPartyRoomsIds = await providerDao.GetProvidersInfoAsync(FolderType.Archive).Select(p => p.FolderId).ToListAsync();
var roomsEntries = await folderDao.GetRoomsAsync(archiveFolderId, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, withoutMe).ToListAsync();
var thirdPartyRoomsEntries = await folderThirdPartyDao.GetRoomsAsync(thirdPartyRoomsIds, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, withoutMe)
var roomsEntries = await folderDao.GetRoomsAsync(archiveFolderId, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject).ToListAsync();
var thirdPartyRoomsEntries = await folderThirdPartyDao.GetRoomsAsync(thirdPartyRoomsIds, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject)
.ToListAsync();
foldersInt.AddRange(roomsEntries);
@ -1034,7 +1034,7 @@ public class FileSecurity : IFileSecurity
}
private async Task<List<FileEntry>> GetVirtualRoomsForUserAsync<T>(IEnumerable<FileShareRecord> records, List<Guid> subjects, FilterType filterType, Guid subjectId, string search,
bool searchInContent, bool withSubfolders, SearchArea searchArea, bool withoutTags, IEnumerable<string> tagNames, bool withoutMe)
bool searchInContent, bool withSubfolders, SearchArea searchArea, bool withoutTags, IEnumerable<string> tagNames, bool excludeSubject)
{
var folderDao = _daoFactory.GetFolderDao<T>();
var fileDao = _daoFactory.GetFileDao<T>();
@ -1076,7 +1076,7 @@ public class FileSecurity : IFileSecurity
return false;
};
var fileEntries = await folderDao.GetRoomsAsync(roomsIds.Keys, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, withoutMe)
var fileEntries = await folderDao.GetRoomsAsync(roomsIds.Keys, filterType, tagNames, subjectId, search, withSubfolders, withoutTags, excludeSubject)
.Where(filter).ToListAsync();
await SetTagsAsync(fileEntries);

View File

@ -186,7 +186,7 @@ internal class BoxFileDao : BoxDaoBase, IFileDao<string>
}
}
public async IAsyncEnumerable<File<string>> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false)
public async IAsyncEnumerable<File<string>> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool excludeSubject = false)
{
if (filterType == FilterType.FoldersOnly)
{

View File

@ -74,8 +74,8 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao<string>
return GetRootFolderAsync(fileId);
}
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders,
bool withoutTags, bool withoutMe)
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders,
bool withoutTags, bool excludeSubject)
{
if (CheckInvalidFilter(filterType))
{
@ -85,7 +85,7 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao<string>
var rooms = GetFoldersAsync(parentId);
rooms = FilterByRoomType(rooms, filterType);
rooms = FilterByOwner(rooms, ownerId, withoutMe);
rooms = FilterBySubject(rooms, subjectId, excludeSubject);
if (!string.IsNullOrEmpty(searchText))
{
@ -97,8 +97,8 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao<string>
return rooms;
}
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(IEnumerable<string> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText,
bool withSubfolders, bool withoutTags, bool withoutMe)
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(IEnumerable<string> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText,
bool withSubfolders, bool withoutTags, bool excludeSubject)
{
if (CheckInvalidFilter(filterType))
{
@ -108,7 +108,7 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao<string>
var folders = roomsIds.ToAsyncEnumerable().SelectAwait(async e => await GetFolderAsync(e).ConfigureAwait(false));
folders = FilterByRoomType(folders, filterType);
folders = FilterByOwner(folders, ownerId, withoutMe);
folders = FilterBySubject(folders, subjectId, excludeSubject);
if (!string.IsNullOrEmpty(searchText))
{
@ -129,7 +129,7 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao<string>
}
}
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false)
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false)
{
if (CheckInvalidFilter(filterType))
{
@ -164,7 +164,7 @@ internal class BoxFolderDao : BoxDaoBase, IFolderDao<string>
return folders;
}
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(IEnumerable<string> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true)
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(IEnumerable<string> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false)
{
if (CheckInvalidFilter(filterType))
{

View File

@ -189,7 +189,7 @@ internal class DropboxFileDao : DropboxDaoBase, IFileDao<string>
}
}
public async IAsyncEnumerable<File<string>> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false)
public async IAsyncEnumerable<File<string>> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool excludeSubject = false)
{
if (filterType == FilterType.FoldersOnly)
{

View File

@ -77,7 +77,7 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao<string>
return GetRootFolderAsync(fileId);
}
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe)
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject)
{
if (CheckInvalidFilter(filterType))
{
@ -87,7 +87,7 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao<string>
var rooms = GetFoldersAsync(parentId);
rooms = FilterByRoomType(rooms, filterType);
rooms = FilterByOwner(rooms, ownerId, withoutMe);
rooms = FilterBySubject(rooms, subjectId, excludeSubject);
if (!string.IsNullOrEmpty(searchText))
{
@ -99,7 +99,7 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao<string>
return rooms;
}
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(IEnumerable<string> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe)
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(IEnumerable<string> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject)
{
if (CheckInvalidFilter(filterType))
{
@ -109,7 +109,7 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao<string>
var folders = roomsIds.ToAsyncEnumerable().SelectAwait(async e => await GetFolderAsync(e).ConfigureAwait(false));
folders = FilterByRoomType(folders, filterType);
folders = FilterByOwner(folders, ownerId, withoutMe);
folders = FilterBySubject(folders, subjectId, excludeSubject);
if (!string.IsNullOrEmpty(searchText))
{
@ -130,7 +130,7 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao<string>
}
}
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false)
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false)
{
if (CheckInvalidFilter(filterType))
{
@ -165,7 +165,7 @@ internal class DropboxFolderDao : DropboxDaoBase, IFolderDao<string>
return folders;
}
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(IEnumerable<string> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true)
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(IEnumerable<string> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false)
{
if (CheckInvalidFilter(filterType))
{

View File

@ -188,7 +188,7 @@ internal class GoogleDriveFileDao : GoogleDriveDaoBase, IFileDao<string>
}
}
public async IAsyncEnumerable<File<string>> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false)
public async IAsyncEnumerable<File<string>> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool excludeSubject = false)
{
if (filterType == FilterType.FoldersOnly)
{

View File

@ -74,7 +74,7 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao<string>
return GetRootFolderAsync("");
}
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe)
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject)
{
if (CheckInvalidFilter(filterType))
{
@ -84,7 +84,7 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao<string>
var rooms = GetFoldersAsync(parentId);
rooms = FilterByRoomType(rooms, filterType);
rooms = FilterByOwner(rooms, ownerId, withoutMe);
rooms = FilterBySubject(rooms, subjectId, excludeSubject);
if (!string.IsNullOrEmpty(searchText))
{
@ -96,7 +96,7 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao<string>
return rooms;
}
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(IEnumerable<string> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe)
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(IEnumerable<string> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject)
{
if (CheckInvalidFilter(filterType))
{
@ -106,7 +106,7 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao<string>
var folders = roomsIds.ToAsyncEnumerable().SelectAwait(async e => await GetFolderAsync(e).ConfigureAwait(false));
folders = FilterByRoomType(folders, filterType);
folders = FilterByOwner(folders, ownerId, withoutMe);
folders = FilterBySubject(folders, subjectId, excludeSubject);
if (!string.IsNullOrEmpty(searchText))
{
@ -128,7 +128,7 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao<string>
}
}
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false)
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false)
{
if (CheckInvalidFilter(filterType))
{
@ -163,7 +163,7 @@ internal class GoogleDriveFolderDao : GoogleDriveDaoBase, IFolderDao<string>
return folders;
}
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(IEnumerable<string> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true)
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(IEnumerable<string> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false)
{
if (CheckInvalidFilter(filterType))
{

View File

@ -456,16 +456,11 @@ internal abstract class ThirdPartyProviderDao<T> : ThirdPartyProviderDao, IDispo
return rooms.Where(f => f.FolderType == filter || filter == FolderType.DEFAULT);
}
protected IAsyncEnumerable<Folder<string>> FilterByOwner(IAsyncEnumerable<Folder<string>> rooms, Guid ownerId, bool withoutMe)
protected IAsyncEnumerable<Folder<string>> FilterBySubject(IAsyncEnumerable<Folder<string>> rooms, Guid subjectId, bool excludeSubject)
{
if (ownerId != Guid.Empty && !withoutMe)
if (subjectId != Guid.Empty)
{
rooms = rooms.Where(f => f.CreateBy == ownerId);
}
if (ownerId == Guid.Empty && withoutMe)
{
rooms = rooms.Where((f => f.CreateBy != _authContext.CurrentAccount.ID));
rooms = excludeSubject ? rooms.Where(f => f.CreateBy != subjectId) : rooms.Where(f => f.CreateBy == subjectId);
}
return rooms;

View File

@ -187,7 +187,7 @@ internal class OneDriveFileDao : OneDriveDaoBase, IFileDao<string>
}
public async IAsyncEnumerable<File<string>> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false)
public async IAsyncEnumerable<File<string>> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool excludeSubject = false, bool withoutMe = false)
{
if (filterType == FilterType.FoldersOnly)
{

View File

@ -74,7 +74,7 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao<string>
return GetRootFolderAsync(fileId);
}
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe)
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject)
{
if (CheckInvalidFilter(filterType))
{
@ -84,7 +84,7 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao<string>
var rooms = GetFoldersAsync(parentId);
rooms = FilterByRoomType(rooms, filterType);
rooms = FilterByOwner(rooms, ownerId, withoutMe);
rooms = FilterBySubject(rooms, subjectId, excludeSubject);
if (!string.IsNullOrEmpty(searchText))
{
@ -96,7 +96,7 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao<string>
return rooms;
}
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(IEnumerable<string> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe)
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(IEnumerable<string> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject)
{
if (CheckInvalidFilter(filterType))
{
@ -106,7 +106,7 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao<string>
var folders = roomsIds.ToAsyncEnumerable().SelectAwait(async e => await GetFolderAsync(e).ConfigureAwait(false));
folders = FilterByRoomType(folders, filterType);
folders = FilterByOwner(folders, ownerId, withoutMe);
folders = FilterBySubject(folders, subjectId, excludeSubject);
if (!string.IsNullOrEmpty(searchText))
{
@ -128,7 +128,7 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao<string>
}
}
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false)
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false)
{
if (CheckInvalidFilter(filterType))
{
@ -164,7 +164,7 @@ internal class OneDriveFolderDao : OneDriveDaoBase, IFolderDao<string>
return folders;
}
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(IEnumerable<string> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true)
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(IEnumerable<string> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false)
{
if (CheckInvalidFilter(filterType))
{

View File

@ -182,12 +182,12 @@ internal class ProviderFileDao : ProviderDaoBase, IFileDao<string>
}
}
public async IAsyncEnumerable<File<string>> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false)
public async IAsyncEnumerable<File<string>> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool excludeSubject = false)
{
var selector = GetSelector(parentId);
var fileDao = selector.GetFileDao(parentId);
var files = fileDao.GetFilesAsync(selector.ConvertId(parentId), orderBy, filterType, subjectGroup, subjectID, searchText, searchInContent, withSubfolders);
var files = fileDao.GetFilesAsync(selector.ConvertId(parentId), orderBy, filterType, subjectGroup, subjectID, searchText, searchInContent, withSubfolders, excludeSubject);
var result = await files.Where(r => r != null).ToListAsync();
await SetSharedPropertyAsync(result);

View File

@ -90,11 +90,11 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao<string>
return folderDao.GetRootFolderByFileAsync(selector.ConvertId(fileId));
}
public async IAsyncEnumerable<Folder<string>> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe)
public async IAsyncEnumerable<Folder<string>> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject)
{
var selector = GetSelector(parentId);
var folderDao = selector.GetFolderDao(parentId);
var rooms = folderDao.GetRoomsAsync(selector.ConvertId(parentId), filterType, tags, ownerId, searchText, withSubfolders, withoutTags, withoutMe);
var rooms = folderDao.GetRoomsAsync(selector.ConvertId(parentId), filterType, tags, subjectId, searchText, withSubfolders, withoutTags, excludeSubject);
var result = await rooms.Where(r => r != null).ToListAsync();
await SetSharedPropertyAsync(result);
@ -105,7 +105,7 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao<string>
}
}
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(IEnumerable<string> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe)
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(IEnumerable<string> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject)
{
var result = AsyncEnumerable.Empty<Folder<string>>();
@ -125,7 +125,7 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao<string>
{
var folderDao = selectorLocal.GetFolderDao(matchedId.FirstOrDefault());
return folderDao.GetRoomsAsync(matchedId.Select(selectorLocal.ConvertId).ToList(), filterType, tags, ownerId, searchText, withSubfolders, withoutTags, withoutMe);
return folderDao.GetRoomsAsync(matchedId.Select(selectorLocal.ConvertId).ToList(), filterType, tags, subjectId, searchText, withSubfolders, withoutTags, excludeSubject);
})
.Where(r => r != null));
}
@ -142,11 +142,11 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao<string>
return folders.Where(r => r != null);
}
public async IAsyncEnumerable<Folder<string>> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false)
public async IAsyncEnumerable<Folder<string>> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false)
{
var selector = GetSelector(parentId);
var folderDao = selector.GetFolderDao(parentId);
var folders = folderDao.GetFoldersAsync(selector.ConvertId(parentId), orderBy, filterType, subjectGroup, subjectID, searchText, withSubfolders);
var folders = folderDao.GetFoldersAsync(selector.ConvertId(parentId), orderBy, filterType, subjectGroup, subjectID, searchText, withSubfolders, excludeSubject);
var result = await folders.Where(r => r != null).ToListAsync();
await SetSharedPropertyAsync(result);
@ -157,7 +157,7 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao<string>
}
}
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(IEnumerable<string> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true)
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(IEnumerable<string> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false)
{
var result = AsyncEnumerable.Empty<Folder<string>>();
@ -178,7 +178,7 @@ internal class ProviderFolderDao : ProviderDaoBase, IFolderDao<string>
var folderDao = selectorLocal.GetFolderDao(matchedId.FirstOrDefault());
return folderDao.GetFoldersAsync(matchedId.Select(selectorLocal.ConvertId).ToList(),
filterType, subjectGroup, subjectID, searchText, searchSubfolders, checkShare);
filterType, subjectGroup, subjectID, searchText, searchSubfolders, checkShare, excludeSubject);
})
.Where(r => r != null));
}

View File

@ -177,7 +177,7 @@ internal class SharePointFileDao : SharePointDaoBase, IFileDao<string>
}
}
public async IAsyncEnumerable<File<string>> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false)
public async IAsyncEnumerable<File<string>> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool excludeSubject = false)
{
if (filterType == FilterType.FoldersOnly)
{

View File

@ -80,7 +80,7 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao<string>
return Task.FromResult(ProviderInfo.ToFolder(ProviderInfo.RootFolder));
}
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe)
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject)
{
if (CheckInvalidFilter(filterType))
{
@ -90,7 +90,7 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao<string>
var rooms = GetFoldersAsync(parentId);
rooms = FilterByRoomType(rooms, filterType);
rooms = FilterByOwner(rooms, ownerId, withoutMe);
rooms = FilterBySubject(rooms, subjectId, excludeSubject);
if (!string.IsNullOrEmpty(searchText))
{
@ -102,7 +102,7 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao<string>
return rooms;
}
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(IEnumerable<string> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe)
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(IEnumerable<string> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject)
{
if (CheckInvalidFilter(filterType))
{
@ -112,7 +112,7 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao<string>
var folders = roomsIds.ToAsyncEnumerable().SelectAwait(async e => await GetFolderAsync(e).ConfigureAwait(false));
folders = FilterByRoomType(folders, filterType);
folders = FilterByOwner(folders, ownerId, withoutMe);
folders = FilterBySubject(folders, subjectId, excludeSubject);
if (!string.IsNullOrEmpty(searchText))
{
@ -134,7 +134,7 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao<string>
}
}
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false)
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false)
{
if (CheckInvalidFilter(filterType))
{
@ -170,7 +170,7 @@ internal class SharePointFolderDao : SharePointDaoBase, IFolderDao<string>
return folders;
}
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(IEnumerable<string> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true)
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(IEnumerable<string> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false)
{
if (CheckInvalidFilter(filterType))
{

View File

@ -172,7 +172,7 @@ internal class SharpBoxFileDao : SharpBoxDaoBase, IFileDao<string>
}
}
public async IAsyncEnumerable<File<string>> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false)
public async IAsyncEnumerable<File<string>> GetFilesAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool searchInContent, bool withSubfolders = false, bool excludeSubject = false)
{
if (filterType == FilterType.FoldersOnly)
{

View File

@ -79,7 +79,7 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao<string>
return Task.FromResult(ToFolder(RootFolder()));
}
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe)
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(string parentId, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject)
{
if (CheckInvalidFilter(filterType))
{
@ -89,7 +89,7 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao<string>
var rooms = GetFoldersAsync(parentId);
rooms = FilterByRoomType(rooms, filterType);
rooms = FilterByOwner(rooms, ownerId, withoutMe);
rooms = FilterBySubject(rooms, subjectId, excludeSubject);
if (!string.IsNullOrEmpty(searchText))
{
@ -101,7 +101,7 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao<string>
return rooms;
}
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(IEnumerable<string> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid ownerId, string searchText, bool withSubfolders, bool withoutTags, bool withoutMe)
public IAsyncEnumerable<Folder<string>> GetRoomsAsync(IEnumerable<string> roomsIds, FilterType filterType, IEnumerable<string> tags, Guid subjectId, string searchText, bool withSubfolders, bool withoutTags, bool excludeSubject)
{
if (CheckInvalidFilter(filterType))
{
@ -111,7 +111,7 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao<string>
var folders = roomsIds.ToAsyncEnumerable().SelectAwait(async e => await GetFolderAsync(e).ConfigureAwait(false));
folders = FilterByRoomType(folders, filterType);
folders = FilterByOwner(folders, ownerId, withoutMe);
folders = FilterBySubject(folders, subjectId, excludeSubject);
if (!string.IsNullOrEmpty(searchText))
{
@ -130,7 +130,7 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao<string>
return parentFolder.OfType<ICloudDirectoryEntry>().Select(ToFolder).ToAsyncEnumerable();
}
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false)
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(string parentId, OrderBy orderBy, FilterType filterType, bool subjectGroup, Guid subjectID, string searchText, bool withSubfolders = false, bool excludeSubject = false)
{
if (CheckInvalidFilter(filterType))
{
@ -166,7 +166,7 @@ internal class SharpBoxFolderDao : SharpBoxDaoBase, IFolderDao<string>
return folders;
}
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(IEnumerable<string> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true)
public IAsyncEnumerable<Folder<string>> GetFoldersAsync(IEnumerable<string> folderIds, FilterType filterType = FilterType.None, bool subjectGroup = false, Guid? subjectID = null, string searchText = "", bool searchSubfolders = false, bool checkShare = true, bool excludeSubject = false)
{
if (CheckInvalidFilter(filterType))
{

View File

@ -374,7 +374,7 @@ public class EntryManager
public async Task<(IEnumerable<FileEntry> Entries, int Total)> GetEntriesAsync<T>(Folder<T> parent, int from, int count, FilterType filterType, bool subjectGroup, Guid subjectId,
string searchText, bool searchInContent, bool withSubfolders, OrderBy orderBy, SearchArea searchArea = SearchArea.Active, bool withoutTags = false, IEnumerable<string> tagNames = null,
bool withoutMe = false)
bool excludeSubject = false)
{
var total = 0;
@ -457,7 +457,7 @@ public class EntryManager
}
else if ((parent.FolderType == FolderType.VirtualRooms || parent.FolderType == FolderType.Archive) && !parent.ProviderEntry)
{
entries = await _fileSecurity.GetVirtualRoomsAsync(filterType, subjectId, searchText, searchInContent, withSubfolders, searchArea, withoutTags, tagNames, withoutMe);
entries = await _fileSecurity.GetVirtualRoomsAsync(filterType, subjectId, searchText, searchInContent, withSubfolders, searchArea, withoutTags, tagNames, excludeSubject);
CalculateTotal();
}
@ -468,8 +468,8 @@ public class EntryManager
withSubfolders = false;
}
var folders = _daoFactory.GetFolderDao<T>().GetFoldersAsync(parent.Id, orderBy, filterType, subjectGroup, subjectId, searchText, withSubfolders);
var files = _daoFactory.GetFileDao<T>().GetFilesAsync(parent.Id, orderBy, filterType, subjectGroup, subjectId, searchText, searchInContent, withSubfolders);
var folders = _daoFactory.GetFolderDao<T>().GetFoldersAsync(parent.Id, orderBy, filterType, subjectGroup, subjectId, searchText, withSubfolders, excludeSubject);
var files = _daoFactory.GetFileDao<T>().GetFilesAsync(parent.Id, orderBy, filterType, subjectGroup, subjectId, searchText, searchInContent, withSubfolders, excludeSubject);
var task1 = _fileSecurity.FilterReadAsync(folders).ToListAsync();
var task2 = _fileSecurity.FilterReadAsync(files).ToListAsync();

View File

@ -122,9 +122,9 @@ public abstract class FoldersController<T> : ApiControllerBase
/// <param name="filterType" optional="true" remark="Allowed values: None (0), FilesOnly (1), FoldersOnly (2), DocumentsOnly (3), PresentationsOnly (4), SpreadsheetsOnly (5) or ImagesOnly (7)">Filter type</param>
/// <returns>Folder contents</returns>
[HttpGet("{folderId}", Order = 1)]
public async Task<FolderContentDto<T>> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders)
public async Task<FolderContentDto<T>> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withsubfolders, bool? excludeSubject)
{
var folder = await _foldersControllerHelper.GetFolderAsync(folderId, userIdOrGroupId, filterType, searchInContent, withsubfolders);
var folder = await _foldersControllerHelper.GetFolderAsync(folderId, userIdOrGroupId, filterType, searchInContent, withsubfolders, excludeSubject);
return folder.NotFoundIfNull();
}

View File

@ -740,14 +740,14 @@ public class VirtualRoomsCommonController : ApiControllerBase
/// <param name="tags">
/// Filter by tags
/// </param>
/// <param name="withoutMe">
/// Exclude your rooms from search
/// <param name="excludeSubject">
/// Exclude subject from search
/// </param>
/// <returns>
/// Virtual Rooms content
/// </returns>
[HttpGet("rooms")]
public async Task<FolderContentDto<int>> GetRoomsFolderAsync(RoomFilterType? type, string subjectId, bool? searchInContent, bool? withSubfolders, SearchArea? searchArea, bool? withoutTags, string tags, bool? withoutMe)
public async Task<FolderContentDto<int>> GetRoomsFolderAsync(RoomFilterType? type, string subjectId, bool? searchInContent, bool? withSubfolders, SearchArea? searchArea, bool? withoutTags, string tags, bool? excludeSubject)
{
ErrorIfNotDocSpace();
@ -778,7 +778,7 @@ public class VirtualRoomsCommonController : ApiControllerBase
var filterValue = _apiContext.FilterValue;
var content = await _fileStorageService.GetFolderItemsAsync(parentId, startIndex, count, filter, false, subjectId, filterValue,
searchInContent ?? false, withSubfolders ?? false, orderBy, searchArea ?? SearchArea.Active, withoutTags ?? false, tagNames, withoutMe ?? false);
searchInContent ?? false, withSubfolders ?? false, orderBy, searchArea ?? SearchArea.Active, withoutTags ?? false, tagNames, excludeSubject ?? false);
var dto = await _folderContentDtoHelper.GetAsync(content, startIndex);

View File

@ -77,9 +77,9 @@ public class FoldersControllerHelper<T> : FilesHelperBase<T>
return await _folderDtoHelper.GetAsync(folder);
}
public async Task<FolderContentDto<T>> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withSubFolders)
public async Task<FolderContentDto<T>> GetFolderAsync(T folderId, Guid? userIdOrGroupId, FilterType? filterType, bool? searchInContent, bool? withSubFolders, bool? excludeSubject = false)
{
var folderContentWrapper = await ToFolderContentWrapperAsync(folderId, userIdOrGroupId ?? Guid.Empty, filterType ?? FilterType.None, searchInContent ?? false, withSubFolders ?? false);
var folderContentWrapper = await ToFolderContentWrapperAsync(folderId, userIdOrGroupId ?? Guid.Empty, filterType ?? FilterType.None, searchInContent ?? false, withSubFolders ?? false, excludeSubject ?? false);
return folderContentWrapper.NotFoundIfNull();
}
@ -166,7 +166,7 @@ public class FoldersControllerHelper<T> : FilesHelperBase<T>
return await _folderDtoHelper.GetAsync(folder);
}
private async Task<FolderContentDto<T>> ToFolderContentWrapperAsync(T folderId, Guid userIdOrGroupId, FilterType filterType, bool searchInContent, bool withSubFolders)
private async Task<FolderContentDto<T>> ToFolderContentWrapperAsync(T folderId, Guid userIdOrGroupId, FilterType filterType, bool searchInContent, bool withSubFolders, bool excludeSubject)
{
OrderBy orderBy = null;
if (SortedByTypeExtensions.TryParse(_apiContext.SortBy, true, out var sortBy))
@ -175,7 +175,7 @@ public class FoldersControllerHelper<T> : FilesHelperBase<T>
}
var startIndex = Convert.ToInt32(_apiContext.StartIndex);
var items = await _fileStorageService.GetFolderItemsAsync(folderId, startIndex, Convert.ToInt32(_apiContext.Count), filterType, filterType == FilterType.ByUser, userIdOrGroupId.ToString(), _apiContext.FilterValue, searchInContent, withSubFolders, orderBy);
var items = await _fileStorageService.GetFolderItemsAsync(folderId, startIndex, Convert.ToInt32(_apiContext.Count), filterType, filterType == FilterType.ByUser, userIdOrGroupId.ToString(), _apiContext.FilterValue, searchInContent, withSubFolders, orderBy, excludeSubject: excludeSubject);
return await _folderContentDtoHelper.GetAsync(items, startIndex);
}