summaryrefslogtreecommitdiff
path: root/spec/finders
Commit message (Collapse)AuthorAgeFilesLines
* Introduce an Events APIMark Fletcher2017-06-061-0/+44
| | | | | | | | | | | * Meld the following disparate endpoints: * `/projects/:id/events` * `/events` * `/users/:id/events` + Add result filtering to the above endpoints: * action * target_type * before and after dates
* Add :owned param to ProjectFinderToon Claes2017-05-301-0/+7
| | | | And use it in the API.
* Change ProjectFinder so starred can be combined with other filtersToon Claes2017-05-301-1/+7
| | | | | The `starred` parameter couldn't be used in combination with `trending` or `non_public`. But this is changed now.
* Merge branch 'rework-authorizations-performance' into 'master'Douwe Maan2017-05-292-2/+2
|\ | | | | | | | | Rework project authorizations and nested groups for better performance See merge request !10885
| * Use CTEs for nested groups and authorizationsYorick Peterse2017-05-172-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces the usage of Common Table Expressions (CTEs) to efficiently retrieve nested group hierarchies, without having to rely on the "routes" table (which is an _incredibly_ inefficient way of getting the data). This requires a patch to ActiveRecord (found in the added initializer) to work properly as ActiveRecord doesn't support WITH statements properly out of the box. Unfortunately MySQL provides no efficient way of getting nested groups. For example, the old routes setup could easily take 5-10 seconds depending on the amount of "routes" in a database. Providing vastly different logic for both MySQL and PostgreSQL will negatively impact the development process. Because of this the various nested groups related methods return empty relations when used in combination with MySQL. For project authorizations the logic is split up into two classes: * Gitlab::ProjectAuthorizations::WithNestedGroups * Gitlab::ProjectAuthorizations::WithoutNestedGroups Both classes get the fresh project authorizations (= as they should be in the "project_authorizations" table), including nested groups if PostgreSQL is used. The logic of these two classes is quite different apart from their public interface. This complicates development a bit, but unfortunately there is no way around this. This commit also introduces Gitlab::GroupHierarchy. This class can be used to get the ancestors and descendants of a base relation, or both by using a UNION. This in turn is used by methods such as: * Namespace#ancestors * Namespace#descendants * User#all_expanded_groups Again this class relies on CTEs and thus only works on PostgreSQL. The Namespace methods will return an empty relation when MySQL is used, while User#all_expanded_groups will return only the groups a user is a direct member of. Performance wise the impact is quite large. For example, on GitLab.com Namespace#descendants used to take around 580 ms to retrieve data for a particular user. Using CTEs we are able to reduce this down to roughly 1 millisecond, returning the exact same data. == On The Fly Refreshing Refreshing of authorizations on the fly (= when users.authorized_projects_populated was not set) is removed with this commit. This simplifies the code, and ensures any queries used for authorizations are not mutated because they are executed in a Rails scope (e.g. Project.visible_to_user). This commit includes a migration to schedule refreshing authorizations for all users, ensuring all of them have their authorizations in place. Said migration schedules users in batches of 5000, with 5 minutes between every batch to smear the load around a bit. == Spec Changes This commit also introduces some changes to various specs. For example, some specs for ProjectTeam assumed that creating a personal project would _not_ lead to the owner having access, which is incorrect. Because we also no longer refresh authorizations on the fly for new users some code had to be added to the "empty_project" factory. This chunk of code ensures that the owner's permissions are refreshed after creating the project, something that is normally done in Projects::CreateService.
* | Fix trailing ',' in hash.Bob Van Landuyt2017-05-151-1/+1
| |
* | Create a Users FinderGeorge Andrinopoulos2017-05-151-0/+66
|/
* Use `described_class` in SnippetsFinder-specBob Van Landuyt2017-05-101-21/+21
|
* Merge branch 'tc-fix-private-subgroups-shown' into 'security' Douwe Maan2017-05-101-11/+46
| | | | | Use GroupsFinder to find subgroups the user has access to See merge request !2096
* Merge branch 'snippets-finder-visibility' into 'security'Douwe Maan2017-05-101-25/+100
| | | | | | Refactor snippets finder & dont return internal snippets for external users See merge request !2094
* Add Pipeline Schedules that supersedes experimental Trigger ScheduleZeger-Jan van de Weg2017-05-071-0/+41
|
* [Multiple issue assignee] Fix a number of specsValery Sizov2017-05-051-11/+11
|
* Backport of multiple_assignees_feature [ci skip]Valery Sizov2017-05-041-13/+13
|
* Merge branch ↵Robert Speicher2017-05-031-25/+180
|\ | | | | | | | | | | | | | | | | '28408-feature-proposal-include-search-options-to-pipelines-api' into 'master' Resolve "Feature Proposal: Include search options to pipelines API" Closes #28408 See merge request !9367
| * Improve pipelines_finder.rbShinya Maeda2017-05-031-4/+4
| |
| * Avoid using sampleShinya Maeda2017-05-031-1/+1
| |
| * Use HasStatus::AVAILABLE_STATUSES instead of hard codingShinya Maeda2017-05-031-2/+2
| |
| * Improve api/pipelines_spec.rbShinya Maeda2017-05-031-3/+7
| |
| * Add another pipeline for spec statusShinya Maeda2017-05-031-0/+5
| |
| * Add space before bracketShinya Maeda2017-05-031-6/+6
| |
| * Improve pipelines_finder_spec.rbShinya Maeda2017-05-031-113/+70
| |
| * Ci::Pipeline to project.pipelinesShinya Maeda2017-05-031-23/+23
| |
| * Fix improper method name and spec descriptionShinya Maeda2017-05-031-3/+3
| |
| * Fix created_at to user_id in specShinya Maeda2017-05-031-6/+6
| |
| * Change sort spec descriptionShinya Maeda2017-05-031-2/+2
| |
| * Allow only indexed columns in #order_and_sort. Remove present (Because ↵Shinya Maeda2017-05-031-1/+9
| | | | | | | | unnecessary) from condition. Added spec just in case.
| * Normalize wordingShinya Maeda2017-05-031-47/+39
| |
| * Finish pipelines_specShinya Maeda2017-05-031-1/+1
| |
| * Use eq instead of match_array for comparison of arrayShinya Maeda2017-05-031-5/+5
| |
| * No need 'a'Shinya Maeda2017-05-031-13/+13
| |
| * Add name(User)Shinya Maeda2017-05-031-6/+24
| |
| * Change name to usernameShinya Maeda2017-05-031-1/+1
| |
| * Use ActiveRecord for comparisonShinya Maeda2017-05-031-50/+36
| |
| * Add tag trueShinya Maeda2017-05-031-1/+1
| |
| * Check if any master existsShinya Maeda2017-05-031-1/+1
| |
| * include to all(eq()). Test status, not scope.Shinya Maeda2017-05-031-16/+16
| |
| * %[] to %w[]Shinya Maeda2017-05-031-1/+1
| |
| * %w() to %[]Shinya Maeda2017-05-031-1/+1
| |
| * Improved CI. Fix yaml_errors boolean evaluation.Shinya Maeda2017-05-031-56/+39
| |
| * Fixed the following.Shinya Maeda2017-05-031-20/+39
| | | | | | | | | | | | - Fix inappropriate evaluation(casecmp) to regex - Fix missed boolean conversion - Improve spec
| * Fix created_at test case because of sorting failureShinya Maeda2017-05-031-8/+8
| |
| * Fix rubocop offences and rspec failuresShinya Maeda2017-05-031-23/+22
| |
| * Add specs. Plus, minor fixes.Shinya Maeda2017-05-031-17/+201
| |
* | Merge branch 'rs-described_class-cop-2' into 'master' Douwe Maan2017-05-023-24/+24
|\ \ | |/ |/| | | | | Enable `RSpec/DescribedClass` cop and correct violations See merge request !10930
| * Auto-correct `RSpec/DescribedClass` violationsrs-described_class-cop-2Robert Speicher2017-05-013-24/+24
| |
* | Display comments for personal snippets12910-personal-snippets-notes-showJarka Kadlecova2017-05-021-0/+9
|/
* Use rspec-set to speed up examplesZeger-Jan van de Weg2017-04-261-12/+12
|
* Merge branch 'update-droplab-to-webpack-version' into new-resolvable-discussionLuke "Jared" Bennett2017-04-062-38/+160
|\
| * ProjectsFinder should handle more optionsJacopo2017-04-062-38/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extended ProjectFinder in order to handle the following options: - current_user - which user use - project_ids_relation: int[] - project ids to use - params: - trending: boolean - non_public: boolean - starred: boolean - sort: string - visibility_level: int - tags: string[] - personal: boolean - search: string - non_archived: boolean GroupProjectsFinder now inherits from ProjectsFinder. Changed the code in order to use the new available options.
* | Add specsDouwe Maan2017-04-051-1/+38
| |