summaryrefslogtreecommitdiff
path: root/app/finders/issuable_finder.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove `weight` from IssuableFinder::SCALAR_PARAMS and improve the array ↵rc/backport-ce-to-ee-changesRémy Coutable2017-09-261-1/+19
| | | | | | formatting Signed-off-by: Rémy Coutable <remy@rymai.me>
* Backport part of c777bb91fd7 and 4074cb3b7c16 from EERémy Coutable2017-09-261-0/+4
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* fix #35290 Make read-only API for public merge requests available without ↵haseeb2017-09-181-0/+2
| | | | authentication
* Re-use issue/MR counts for the pagination systemmr-index-page-performanceYorick Peterse2017-09-051-0/+4
| | | | | | | This changes the issue and MR index pages so the pagination system re-uses the output of the COUNT(*) query used to calculate the number of rows per state (opened, closed, etc). This removes the need for an additional COUNT(*) on both pages.
* Remove issuable finder count cachingSean McGivern2017-08-311-28/+1
| | | | | | | We're going to cache the total open count separately, and then just perform these counts on the list. We already do that to get the pagination information, through Kaminari, and a future change will make Kaminari reuse the query results from earlier in the request.
* Add filter by my reactionHiroyuki Sato2017-08-301-0/+10
|
* Merge issuable "reopened" state into "opened"merge-issuable-reopened-into-opened-stateYorick Peterse2017-07-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having two states that essentially mean the same thing is very much like having a boolean "true" and boolean "mostly-true": it's rather silly. This commit merges the "reopened" state into the "opened" state while taking care of system notes still showing messages along the lines of "Alice reopened this issue". A big benefit from having only two states (opened and closed) is that indexing and querying becomes simpler and more performant. For example, to get all the opened queries we no longer have to query both states: SELECT * FROM issues WHERE project_id = 2 AND state IN ('opened', 'reopened'); Instead we can query a single state directly, which can be much faster: SELECT * FROM issues WHERE project_id = 2 AND state = 'opened'; Further, only having two states makes indexing easier as we will only ever filter (and thus scan an index) using a single value. Partial indexes could help but aren't supported on MySQL, complicating the development process and not being helpful for MySQL.
* Add author_id & assignee_id param to /issues APIToon Claes2017-07-241-0/+1
| | | | Allow issues filtering on `author_id` and `assignee_id`.
* Clear issuable counter caches on updateclear-issuable-count-cache-for-statesSean McGivern2017-07-191-1/+15
| | | | | | When an issuable's state changes, or one is created, we should clear the cache counts for a user's assigned issuables, and also the project-wide caches for this user type.
* Fix issuable state cachingSean McGivern2017-07-191-1/+1
| | | | | We were including controller params in the cache key, so the key for the header didn't match the one for the list itself!
* Fix issuable state counter cache keysSean McGivern2017-07-191-5/+4
| | | | | These cache a hash of counts by state, so the state isn't needed in the key itself.
* Merge branch 'feature/user-datetime-search-api-mysql' into 'master'Douwe Maan2017-07-071-13/+3
|\ | | | | | | | | | | | | Add creation time filters to user search API for admins Closes #29507 See merge request !12682
| * refactor created at filter to use model scopesJames Lopez2017-07-071-2/+2
| |
| * refactor filtersJames Lopez2017-07-071-12/+2
| |
* | Native group milestonesFelipe Artur2017-07-071-7/+10
|/
* Make finders responsible for counter cache keysSean McGivern2017-06-301-0/+14
|
* Don't count any confidential issues for non-project-membersSean McGivern2017-06-301-1/+1
|
* add since and until params to issuablesKyle Bishop2017-06-181-0/+13
|
* Backport of multiple_assignees_feature [ci skip]Valery Sizov2017-05-041-1/+1
|
* ProjectsFinder should handle more optionsJacopo2017-04-061-6/+2
| | | | | | | | | | | | | | | | | | | 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.
* Allow filtering by all started milestonesbetter-priority-sortingSean McGivern2017-03-151-0/+6
|
* Improve issues filtering performanceJarka Kadlecova2017-03-061-14/+21
|
* Enable Style/MutableConstantDouwe Maan2017-02-231-1/+1
|
* add a :iids param to IssuableFindermhasbini2017-02-171-9/+6
|
* Add comments to issuable finderClement Ho2017-01-101-0/+2
|
* Make sure we could query against no oneLin Jen-Shin2017-01-091-0/+12
| | | | | We should separate the idea of not finding anyone, and the idea of against no one.
* Show no issues if author/assignee cannot be foundLin Jen-Shin2017-01-091-8/+12
| | | | | Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7345/diffs#note_19994225
* Check if it's not NONE tooLin Jen-Shin2017-01-091-6/+6
| | | | | | | | So that we don't have to check it again in somewhere else, and we don't really need to know if it's presented as NONE Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7345/diffs#note_20123999
* Add author_username and assignee_usernameClement Ho2017-01-091-6/+18
|
* Merge branch 'jej-23867-use-mr-finder-instead-of-access-check' into 'security'Douwe Maan2016-12-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace MR access checks with use of MergeRequestsFinder Split from !2024 to partially solve https://gitlab.com/gitlab-org/gitlab-ce/issues/23867 :warning: - Potentially untested :bomb: - No test coverage :traffic_light: - Test coverage of some sort exists (a test failed when error raised) :vertical_traffic_light: - Test coverage of return value (a test failed when nil used) :white_check_mark: - Permissions check tested - [x] :bomb: app/finders/notes_finder.rb:17 - [x] :warning: app/views/layouts/nav/_project.html.haml:80 [`.count`] - [x] :bomb: app/controllers/concerns/creates_commit.rb:84 - [x] :traffic_light: app/controllers/projects/commits_controller.rb:24 - [x] :traffic_light: app/controllers/projects/compare_controller.rb:56 - [x] :vertical_traffic_light: app/controllers/projects/discussions_controller.rb:29 - [x] :white_check_mark: app/controllers/projects/todos_controller.rb:27 - [x] :vertical_traffic_light: app/models/commit.rb:268 - [x] :white_check_mark: lib/gitlab/search_results.rb:71 - [x] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#d1c10892daedb4d4dd3d4b12b6d071091eea83df_267_266 Memoize ` merged_merge_request(current_user)` - [x] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#d1c10892daedb4d4dd3d4b12b6d071091eea83df_248_247 Expected side effect for `merged_merge_request!`, consider `skip_authorization: true`. - [x] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#d1c10892daedb4d4dd3d4b12b6d071091eea83df_269_269 Scary use of unchecked `merged_merge_request?` See merge request !2033
* Merge branch '24733-archived-project-merge-request-count' into 'master' Sean McGivern2016-12-061-0/+6
|\ | | | | | | | | | | | | Fix Archived project merge requests add to group's Merge Requests Closes #24733 See merge request !7790
| * Fix Archived project merge requests add to group's Merge RequestsJacopo2016-12-051-0/+6
| | | | | | | | | | | | | | | | | | | | counter This is done by: - Extending the IssuableFinder adding the non_archived option to the params - Overriding the #filter_params in the MergeRequestsAction - Passing the non_archived param in the nav/_group.html.haml navbar partial from the groups/merge_requests.html.haml
* | Merge branch 'issue_25064' into 'security' Douwe Maan2016-12-061-5/+8
|/ | | | | | | | | Ensure state param has a valid value when filtering issuables. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/25064 This fix makes sure we only call safe methods on issuable when filtering by state. See merge request !2038
* Count all issuable states at onceSean McGivern2016-12-011-0/+26
| | | | | | | | | | Instead of doing n queries for n states, do one query to get all the counts grouped by state, and figure out what the count is for each state is from that. We can still cache the individual counts (it can't hurt), but this will help with initial load. Note that the `opened` scope on `Issuable` includes the `opened` and `reopened` states, which is why there's a special case.
* Merge branch 'jej-use-issuable-finder-instead-of-access-check' into 'security' Douwe Maan2016-11-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace issue access checks with use of IssuableFinder Split from !2024 to partially solve https://gitlab.com/gitlab-org/gitlab-ce/issues/23867 ## Which fixes are in this MR? :warning: - Potentially untested :bomb: - No test coverage :traffic_light: - Test coverage of some sort exists (a test failed when error raised) :vertical_traffic_light: - Test coverage of return value (a test failed when nil used) :white_check_mark: - Permissions check tested ### Issue lookup with access check Using `visible_to_user` likely makes these security issues too. See [Code smells](#code-smells). - [x] :vertical_traffic_light: app/finders/notes_finder.rb:15 [`visible_to_user`] - [x] :traffic_light: app/views/layouts/nav/_project.html.haml:73 [`visible_to_user`] [`.count`] - [x] :white_check_mark: app/services/merge_requests/build_service.rb:84 [`issue.try(:confidential?)`] - [x] :white_check_mark: lib/api/issues.rb:112 [`visible_to_user`] - CHANGELOG: Prevented API returning issues set to 'Only team members' to everyone - [x] :white_check_mark: lib/api/helpers.rb:126 [`can?(current_user, :read_issue, issue)`] Maybe here too? - [x] :white_check_mark: lib/gitlab/search_results.rb:53 [`visible_to_user`] ### Previous discussions - [ ] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#b2ff264eddf9819d7693c14ae213d941494fe2b3_128_126 - [ ] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#7b6375270d22f880bdcb085e47b519b426a5c6c7_87_87 See merge request !2031
* Merge branch 'jej-fix-missing-access-check-on-issues' into 'security'Douwe Maan2016-11-281-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Fix missing access checks on issue lookup using IssuableFinder Split from !2024 to partially solve https://gitlab.com/gitlab-org/gitlab-ce/issues/23867 :warning: - Potentially untested :bomb: - No test coverage :traffic_light: - Test coverage of some sort exists (a test failed when error raised) :vertical_traffic_light: - Test coverage of return value (a test failed when nil used) :white_check_mark: - Permissions check tested - [x] :white_check_mark: app/controllers/projects/branches_controller.rb:39 - `before_action :authorize_push_code!` helpes limit/prevent exploitation. Always checks for reporter access so fine with confidential issues, issues only visible to team, etc. - [x] :traffic_light: app/models/cycle_analytics/summary.rb:9 [`.count`] - [x] :white_check_mark: app/controllers/projects/todos_controller.rb:19 - [x] Potential double render in app/controllers/projects/todos_controller.rb - https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#cedccb227af9bfdf88802767cb58d43c2b977439_24_24 See merge request !2030
* Remove unnecessary require_relative calls from finderSemyon Pupkov2016-11-261-2/+0
|
* Merge branch '22481-honour-issue-visibility-for-groups' into 'security' Douwe Maan2016-11-091-19/+14
| | | | | | | | | Honour issue and merge request visibility in their respective finders This MR fixes a security issue with the IssuesFinder and MergeRequestFinder where they would return items the user did not have permission to see. This was most visible on the issue and merge requests page for a group containing projects that had set their issues or merge requests to "private". Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/22481 See merge request !2000
* Skip authorization check when searching for labels on IssuableFinderDouglas Barbosa Alexandre2016-10-311-2/+2
|
* Return only labels that user have access on IssuableFinder#labelsDouglas Barbosa Alexandre2016-10-191-8/+5
|
* Reuse LabelsFinder on Banzai::Filter::LabelReferenceFilterDouglas Barbosa Alexandre2016-10-191-3/+2
|
* Add ProjectLabel modelDouglas Barbosa Alexandre2016-10-191-1/+2
|
* Allow users to apply group labels on Issues/MRsDouglas Barbosa Alexandre2016-10-191-1/+3
|
* Take filters in account in issuable countersRémy Coutable2016-09-301-10/+5
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* fix issues mr counterbarthc2016-09-201-1/+8
|
* remove Ability.abilitieshttp://jneen.net/2016-08-301-1/+1
|
* State specific default sort order for issuableszs2016-08-011-1/+1
| | | | | | | | | | | | | | | Provide more sensible default sort order for issues and merge requests based on the following table: | type | state | default sort order | |----------------|--------|--------------------| | issues | open | last created | | issues | closed | last updated | | issues | all | last created | | merge requests | open | last created | | merge requests | merged | last updated | | merge requests | closed | last updated | | merge requests | all | last created |
* Improve Issuable.order_labels_priorityRémy Coutable2016-06-061-1/+1
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Sort by label priorityThijs Wouters2016-06-061-2/+6
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Fix error 500 when sorting issues by milestone due date and filtering by labelsFelipe Artur2016-05-311-1/+1
|