summaryrefslogtreecommitdiff
path: root/app/finders
Commit message (Collapse)AuthorAgeFilesLines
* Reduce queries in GroupProjectsFinderYorick Peterse2018-05-281-18/+8
| | | | | | | | | | | | | | GroupProjectsFinder#collection_with_user would run the following code: if group.users.include?(current_user) When running this code for multiple groups this would result in one query being executed for every group. This commit simple removes the entire "if" statement with the code of the "else" statement. This ensures both paths use the same code, and removes the need for explicitly checking if a user is a member of the group.
* Merge branch '44799-api-naming-issue-scope' into 'master'Rémy Coutable2018-05-213-6/+7
|\ | | | | | | | | | | | | Resolve "API naming for issue scope" Closes #44799 See merge request gitlab-org/gitlab-ce!18935
| * Add created_by_me and assigned_to_me scopes44799-api-naming-issue-scopeMark Chao2018-05-213-6/+7
| | | | | | | | Deprecate corresponding dash versions created-by-me and assigned-to-me
* | Order UsersController#projects.json by updated_atTakuya Noguchi2018-05-191-1/+1
|/
* show only groups an admin is a member of in dashboards/gropsRoger Rüttimann2018-05-011-2/+6
|
* Add sha filter to list pipelinesJames Ramsay2018-04-271-0/+9
| | | | | | | To find the pipeline for a specific sha requires scanning the list of all pipelines for a ref that contains the sha. This makes it hard to find the pipeline id needed to access a trace for a specific job run in the pipeline using the API.
* Add 2FA filter to users API for admins onlyDmitriy Zaporozhets2018-04-231-0/+12
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Revert "Don't include projects shared as group-descendants"Bob Van Landuyt2018-04-181-4/+2
| | | | | | This reverts commit 2c3c5b35549185080296670cfe6710aa80f99944. Revisit this after https://gitlab.com/gitlab-org/gitlab-ce/issues/45441
* Merge branch 'dm-archived-read-only' into 'master'Robert Speicher2018-04-121-0/+1
|\ | | | | | | | | | | | | Make archived projects completely read-only Closes #44788 See merge request gitlab-org/gitlab-ce!18136
| * Prevent new merge requests for archived projectsBob Van Landuyt2018-04-111-0/+1
| | | | | | | | | | | | | | This prevents creating merge requests targeting archived projects. This could happen when a project was already forked, but then the source was archived.
* | Reduce complexity of issuable finder query.ab-37125-assigned-issues-queryAndreas Brandl2018-04-091-4/+7
|/ | | | | | | | This removes the extra check for project-ids which is not needed at all. This does not necessarily reduce execution time of the query, but improves planning time by a few millseconds. Closes #37125.
* Allow assigning and filtering issuables by ancestor group labelsFelipe Artur2018-04-041-10/+25
|
* [Rails5] Rename `sort` methods to `sort_by_attribute`blackst0ne2018-04-044-4/+4
|
* Remove N+1 queries in /admin/projects pageStan Hu2018-03-191-0/+1
|
* Fix timeouts loading /admin/projects pagesh-optimize-admin-projects-pageStan Hu2018-03-151-2/+1
| | | | | | | These extra sort keys caused sequential scans on the namespaces and projects page. Removing them makes the page load on GitLab.com. Closes #44338
* Leverage user_contributed_projects to find recent events.40525-listing-user-activity-timeoutsAndreas Brandl2018-03-071-7/+38
| | | | Closes #40525.
* Merge branch '40187-project-branch-dashboard-with-active-stale-branches' ↵Rémy Coutable2018-03-061-1/+1
|\ | | | | | | | | | | | | | | | | into 'master' Add overview of branches and filtered views for active/stale branches Closes #40187 et #17293 See merge request gitlab-org/gitlab-ce!15402
| * Add overview of branches and a filter for active/stale branchesTakuya Noguchi2018-03-061-1/+1
| |
* | Remove default scope from todosremove-default-scope-from-todosSean McGivern2018-03-051-3/+1
| | | | | | | | This was causing todo priority sorting to fail.
* | Merge branch '41616-api-issues-between-date' into 'master'Sean McGivern2018-03-053-0/+20
|\ \ | | | | | | | | | | | | | | | | | | Resolve "API support for selecting only updated issues before/after a given date" Closes #41616 See merge request gitlab-org/gitlab-ce!17417
| * | Adds updated_at filter to issues and merge_requests APIJacopo2018-03-053-0/+20
| | |
* | | Use limited count queries also for scoped searchesJan Provaznik2018-03-051-0/+12
| | |
* | | Merge branch 'remove-projects-finder-from-todos-finder' into 'master'Sean McGivern2018-03-051-9/+6
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Don't use ProjectsFinder in TodosFinder Closes #43767 See merge request gitlab-org/gitlab-ce!17462
| * | | Don't use ProjectsFinder in TodosFinderremove-projects-finder-from-todos-finderYorick Peterse2018-03-021-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using ProjectsFinder in TodosFinder to limit todos to the right projects leads to overly complicated and slow database queries. This commit removes the use of ProjectsFinder in favour of using Project.public_or_visible_to_current_user directly. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/43767
* | | | Merge branch '42877-fix-visibility-change-performance' into 'master'Yorick Peterse2018-03-021-1/+27
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | | | | | | | | | Revert Project.public_or_visible_to_user changes but apply change to SnippetsFinder Closes #42877 See merge request gitlab-org/gitlab-ce!17476
| * | | Extract method User#authorizations_for_projects.42877-fix-visibility-change-performanceAndreas Brandl2018-03-021-5/+1
| | | |
| * | | Use yield instead of block.call.Andreas Brandl2018-03-021-6/+6
| | | |
| * | | Apply query changes to snippets only.Andreas Brandl2018-03-021-2/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This applies the changes introduced in `Project.public_or_visible_to_user` to the snippets finder only. We know that for `SnippetsFinder`, this change improves SQL timing from 5/23/25s to 0.7/2/4s (mean/p95/p99). At the same time, the scope was too broad, (negatively) affecting SQL timings in various other places: https://gitlab.com/gitlab-com/infrastructure/issues/3772 With this commit, the snippets dashboard stays usuable as we generally don't run into statement timeouts. In contrast to the earlier change in !17088, the scope of the change is limited to `SnippetsFinder` only, thus not affecting other places.
| * | | Revert Project.public_or_visible_to_user changesYorick Peterse2018-03-021-3/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These changes were introduced in MR https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/17088. In https://gitlab.com/gitlab-com/infrastructure/issues/3772 we discovered these changes lead to a pretty drastic increase in SQL response timings. We'll revert these changes so we can work on a better solution in the mean time without GitLab.com (or other installations) experiecing reduced performance in the mean time.
* | | Allow to include also descendant group labelsJan Provaznik2018-03-021-3/+11
|/ / | | | | | | | | | | Because epic index page includes also epics from subgroups it's necessary to also get descendant group labels for filtering. https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/4773#note_61236542
* | Merge branch 'merge-requests-api-filter-by-branch' into 'master'Rémy Coutable2018-03-011-0/+28
|\ \ | |/ |/| | | | | | | | | Add source and target branch filters to merge requests API Closes #42492 See merge request gitlab-org/gitlab-ce!17355
| * Add source and target branch filters to merge requests APISean McGivern2018-03-011-0/+28
| |
* | Allow to find labels in ancestor groups and better group support in label ↵Jan Provaznik2018-02-261-4/+11
|/ | | | service
* Merge branch 'users-autocomplete' into 'master'Douwe Maan2018-02-231-7/+15
|\ | | | | | | | | Improve performance of searching for and auto completing of users See merge request gitlab-org/gitlab-ce!17158
| * Added changelog for user search improvementsusers-autocompleteYorick Peterse2018-02-221-1/+1
| |
| * Removed pagination from AutocompleteUsersFinderYorick Peterse2018-02-221-4/+8
| | | | | | | | | | | | | | The frontend code doesn't use this so there's no practical point in supporting this. We also hardcode the limit to 20 so users can no longer request their own limit, which could overload the database (depending on any upper bounds perhaps enforced by Kaminari).
| * Don't pluck IDs in AutocompleteUsersFinderYorick Peterse2018-02-221-3/+7
| | | | | | | | | | | | We can instead just use a UNION. This removes the need for plucking hundreds if not thousands of IDs into memory when a project has many members.
* | Port `read_cross_project` ability from EEBob Van Landuyt2018-02-2210-14/+183
|/
* Merge branch 'refactor-issuable-finder-to-use-inheritance' into 'master'Rémy Coutable2018-02-212-66/+85
|\ | | | | | | | | Refactor IssuableFinder to extract model-specific logic See merge request gitlab-org/gitlab-ce!17236
| * Refactor IssuableFinder to extract model-specific logicrefactor-issuable-finder-to-use-inheritanceSean McGivern2018-02-212-66/+85
| | | | | | | | | | | | | | | | | | By extracting a new `filter_items` method, we can override that in the IssuesFinder and MergeRequestsFinder separately, so we don't need checks that the model is the correct one, because we can just use the class we're in to know that. We can do the same for the VALID_PARAMS constant, by making it a class method.
* | Merge branch '41461-project-members-slow-due-to-sql' into 'master'Yorick Peterse2018-02-211-12/+45
|\ \ | | | | | | | | | | | | | | | | | | Simplify database queries in MembersFinder and improve performance for Projects::ProjectMembersController#index Closes #41461 See merge request gitlab-org/gitlab-ce!17190
| * | More readable SQL query.Andreas Brandl2018-02-211-3/+7
| | |
| * | Fix MembersFinder to never include group invitees.41461-project-members-slow-due-to-sqlAndreas Brandl2018-02-201-1/+1
| | | | | | | | | | | | | | | This was the default behavior, because all members with `user_id` set to `null` were excluded.
| * | Fix N+1 query problem for users on members view.Andreas Brandl2018-02-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For each member being rendered on Projects::ProjectMembersController#index, there was a query to the users table to retrieve the corresponding user: ``` SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 ```
| * | Use DISTINCT ON and translate to MySQL.Andreas Brandl2018-02-201-16/+34
| | | | | | | | | | | | | | | | | | | | | | | | Realized window functions are not available in older MySQL versions either. Falling back to DISTINCT ON for postgresql and a convoluted translation for MySQL.
| * | Simplify database queries in MembersFinder.Andreas Brandl2018-02-201-11/+22
| |/ | | | | | | Closes #41461.
* | Rename use_conditions_only option to use_where_in.42877-snippets-dashboard-slowAndreas Brandl2018-02-201-1/+1
| |
* | Allow choice between #where or #from.Andreas Brandl2018-02-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Immediately using #from here requires a lot of changes in other finders (e.g. IssuableFinder, TodosFinder). In all places where we use #merge, this goes completely the wrong way when passed in a relation that was built with `#from(...)`: The original query's FROM part gets completely replaced. This avoids changing all other places and focuses on improving SnippetFinder with the downside of two (small) codepaths to do the same thing.
* | Remove duplication in Project methods.Andreas Brandl2018-02-201-1/+4
| |
* | Push feature-related query part up.Andreas Brandl2018-02-201-2/+1
|/