private DataCacheInternal createCacheInternal( InternalCacheUpdater cacheUpdater, string hostname, IHostProperties hostProperties, User user, SearchQueryCollection queryCollection, IModificationNotifier modificationNotifier, INetworkOperationStatusListener networkOperationStatusListener, bool isApprovalStatusSupported) { MergeRequestManager mergeRequestManager = new MergeRequestManager( _cacheContext, cacheUpdater, hostname, hostProperties, queryCollection, networkOperationStatusListener, isApprovalStatusSupported); DiscussionManager discussionManager = new DiscussionManager( _cacheContext, hostname, hostProperties, user, mergeRequestManager, modificationNotifier, networkOperationStatusListener); TimeTrackingManager timeTrackingManager = new TimeTrackingManager( hostname, hostProperties, user, discussionManager, modificationNotifier, networkOperationStatusListener); ProjectCache projectCache = null; if (_cacheContext.SupportProjectCache) { IProjectListLoader loader = new ProjectListLoader(hostname, _operator); projectCache = new ProjectCache(loader, _cacheContext, hostname); } UserCache userCache = null; if (_cacheContext.SupportUserCache) { IUserListLoader userListLoader = new UserListLoader(hostname, _operator); userCache = new UserCache(userListLoader, _cacheContext, hostname); } return(new DataCacheInternal(mergeRequestManager, discussionManager, timeTrackingManager, projectCache, userCache)); }
// Checks if a merge request matches ANY of search queries inside `queries` public static bool DoesMatchSearchQuery(SearchQueryCollection queries, MergeRequest mergeRequest, ProjectKey projectKey) { foreach (SearchQuery query in queries.Queries) { if ((query.State == null || query.State == mergeRequest.State) && (query.IId.HasValue && query.IId.Value == mergeRequest.IId || query.ProjectName == projectKey.ProjectName || query.TargetBranchName == mergeRequest.Target_Branch || (query.Text != null && mergeRequest.Title.ToLower().Contains(query.Text.ToLower())) || (query.Text != null && mergeRequest.Description.ToLower().Contains(query.Text.ToLower())) || (query.Labels != null && query.Labels.All(label => mergeRequest.Labels.Contains(label))) || (query.AuthorUserName != null && mergeRequest.Author.Username == query.AuthorUserName))) { return(true); } } return(false); }