Commit Graph

121 Commits

Author SHA1 Message Date
George Andrinopoulos 7fb1bb01bd Create issue and merge request destroy services 2017-11-25 22:09:18 +02:00
Sean McGivern 4d4ddb6004 Fail when issuable_meta_data is called on an unlimited collection
This method can be called with an array, or a relation:

1. Arrays always have a limited amount of values, so that's fine.
2. If the relation does not have a limit value applied, then we will load every
   single object in that collection, and prevent N+1 queries for the metadata
   for that. But that's wrong, because we should never call this without an
   explicit limit set. So we raise in that case, and this commit will see which
   specs fail.

The only failing specs here were the issues API specs, and the specs for
IssuableMetadata itself, and both have been addressed.
2017-11-07 16:26:55 +00:00
Jarka Kadlecova 994e7d1359 Create system notes for MR too, improve doc + clean up code 2017-09-14 14:50:32 +02:00
Jarka Kadlecova 073ba05d31 Support discussion lock in the API 2017-09-14 14:50:32 +02:00
Hiroyuki Sato cf9c54bd31 Add my_reaction_emoji param to /issues API 2017-09-05 11:56:17 +09:00
Robert Schilling 6a2ee0968e API: Use defined project requirements 2017-08-31 14:57:47 +02:00
Robert Speicher 966b635221 Merge branch '28453-add-time-estimate-time-spent-to-api-issue-output' into 'master'
Add time stats to Issue and Merge Request API

Closes #28453

See merge request !13335
2017-08-30 17:35:14 +00:00
Travis Miller 749c389345 Add time stats to issue and merge request API end points 2017-08-29 08:31:36 -05:00
Travis Miller ce1ce82045 Resolve new N+1 by adding preloads and metadata to issues end points 2017-08-29 08:31:36 -05:00
Robert Schilling e80313f9ee Conditionally destroy a ressource 2017-08-28 16:40:25 +02:00
Robert Schilling 998afa5f74 API: Respect the 'If-Unmodified-Since' for delete endpoints 2017-08-28 16:40:25 +02:00
Toon Claes 39c39ae791 Modify/add some forgotten issues API documentation
Should have been part of !13004.
2017-07-28 00:08:44 +02:00
Sean McGivern 5e56890e31 Merge branch 'tc-issue-api-assignee' into 'master'
Add author_id & assignee_id param to /issues API

Closes #29430

See merge request !13004
2017-07-27 09:59:38 +00:00
Oswaldo Ferreira 33dc5171e5 Resolve "More RESTful API: include resource URLs in responses" 2017-07-25 09:35:45 +00:00
Toon Claes d8798c907d Allow query param scope for /issues API endpoint 2017-07-24 22:46:02 +02:00
Toon Claes 8bf89cb4ab Add author_id & assignee_id param to /issues API
Allow issues filtering on `author_id` and `assignee_id`.
2017-07-24 22:16:14 +02:00
Dmitriy Zaporozhets 6b8ad689da
Update grape gem
New version of the gem returns 200 status code on delete with content
instead of 204 so we explicitly set status code to keep existing
behavior

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2017-07-20 16:33:18 +03:00
James Lopez 2aa95aa018 refactor code based on feedback 2017-07-06 15:27:49 +02:00
James Lopez 6ee87aea89 add user agent details API endpoints to issues and snippets 2017-07-06 15:27:48 +02:00
Kyle Bishop ef633d2478 add since and until params to issuables 2017-06-18 15:43:51 -07:00
Valery Sizov 387c4b2c21 Backport of multiple_assignees_feature [ci skip] 2017-05-04 17:11:53 +03:00
Rémy Coutable f8f49cf516 Merge branch '26437-closed-by' into 'master'
Add issues/:iid/closed_by api endpoint

Closes #26437

See merge request !10511
2017-04-26 11:45:10 +00:00
Sean McGivern 91ac0e038a Port 'Add user activities API' to CE
CE port of https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/962
2017-04-14 15:20:55 +02:00
mhasbini 327e344417 Add issues/:iid/closed_by api endpoint 2017-04-12 14:38:00 +03:00
Oswaldo Ferreira fd32960e7c Separate CE params on Grape API 2017-04-10 16:13:48 -03:00
Oswaldo Ferreira 7cb907cc77 Add "search" optional param and docs for V4
Notice that this param is being supported since V3, but we have not added the proper docs for it
2017-04-05 13:50:12 -03:00
Alexander Randa c4be3460c2 Fix API group/issues default state filter 2017-03-28 17:43:55 +03:00
Adam Niedzielski 8ab347b392 Return 404 in project issues API endpoint when project cannot be found
Closes #29631
2017-03-20 18:03:29 +01:00
Rémy Coutable 63360adeae
Add `requirements: { id: %r{[^/]+} }` for all projects and groups namespaced API routes
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-03-16 18:00:24 +01:00
Bob Van Landuyt ea70a0d674 Rename variable
merge_request_for_resolving_discussions ->
merge_request_to_resolve_discussions_of
2017-03-13 08:27:52 +01:00
Bob Van Landuyt f86928953d Always require MR-iid for resolving discussions
And deduplicate the finding of MR's & discussions. Now the searching
is done in the service, istead of the controller & the API.
2017-03-13 08:27:51 +01:00
Bob Van Landuyt 0267b83898 Delegate a single discussion to a new issue
Delegate a discussion in a merge request into a new issue.
The discussion wil be marked as resolved and a system note will be
added linking to the newly created issue.
2017-03-13 08:27:51 +01:00
Timothy Andrew dd99622347
API routes referencing a specific issue should use the issue `iid`
- As opposed to the issue `id` that was previously being used.
- This brings the API routes closer to the web interface's routes.
- This is specific to API v4.
2017-03-07 13:06:42 +05:30
Adam Niedzielski c727d4328f Remove "subscribed" field from API responses returning list of issues or merge requests 2017-03-06 14:17:07 +01:00
Jarka Kadlecova c6181f9799 API issues - support filtering by iids 2017-03-01 07:28:10 +01:00
Oswaldo Ferreira 2ace39f242 Spam check and reCAPTCHA improvements 2017-02-21 13:32:49 -03:00
Oswaldo Ferreira c2426b4eac Unify issues search behavior by always filtering when ALL labels matches 2017-02-20 13:21:22 -03:00
Oswaldo Ferreira c2d64d6702 Remove deprecated MR and Issue endpoints and preserve V3 namespace 2017-02-06 10:12:20 -02:00
Ruben Davila 0f3c9355c1 Add some API endpoints for time tracking.
New endpoints are:

POST :project_id/(issues|merge_requests)/(:issue_id|:merge_request_id)/time_estimate"

POST :project_id/(issues|merge_requests)/(:issue_id|:merge_request_id)/reset_time_estimate"

POST :project_id/(issues|merge_requests)/(:issue_id|:merge_request_id)/add_spent_time"

POST :project_id/(issues|merge_requests)/(:issue_id|:merge_request_id)/reset_spent_time"

GET  :project_id/(issues|merge_requests)/(:issue_id|:merge_request_id)/time_stats"
2017-01-18 10:48:16 -06:00
David Eisner 7ef1c6408e API: Implement project issues iid param with IssuesFinder and add tests
- Use IssuesFinder for the /issues API resouce
- Tests for iid filter in project issues API resource
- Tests for No Milestone filter in issues API resources
  The "No Milestone" case was not previously tested, and the `/issues`
  resource did not support the the `milestone` parameter.
- Return issues where all labels match from the issues and project issues
  API resources, like the group issues resource already does. See
  https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6825#note_17474533

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-01-12 17:51:06 -05:00
Panagiotis Atmatzidis 5c253116ae Adding 'IssueFinder' for 'projects' API endpoint
Current filtering for "/projects/:id/issues" endpoint
returns no results for "No Milestone" query.

This PR introduces fix by copying filtering from "/groups/:id/issues"
which works as expected.
2017-01-12 17:51:06 -05:00
Robert Schilling 0199f1861b Add missing milestone parameter 2017-01-04 10:07:00 +01:00
Robert Schilling dc6b35e1ae Refactor issues filter in API 2017-01-04 09:50:09 +01:00
Robert Schilling 5961d14292 Fix state_event parameter to reopen an issue 2016-12-22 09:41:53 +01:00
Robert Schilling 3e7818e93a Grapify the issues API 2016-12-07 10:19:28 +01:00
Bob Van Landuyt 51a921baf9 A simpler implementation of finding a merge request
Following a discussion in !7180
2016-12-06 17:46:52 +01:00
Bob Van Landuyt 1123057ab7 Feature: delegate all open discussions to Issue
When a merge request can only be merged when all discussions are
resolved. This feature allows to easily delegate those discussions to a
new issue, while marking them as resolved in the merge request.

The user is presented with a new issue, prepared with mentions of all
unresolved discussions, including the first unresolved note of the
discussion, time and link to the note.

When the issue is created, the discussions in the merge request will get
a system note directing the user to the newly created issue.
2016-12-05 20:55:45 +01:00
Douwe Maan 3bf34face4 Merge branch 'jej-use-issuable-finder-instead-of-access-check' into 'security'
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?

⚠️ - Potentially untested  
💣 - No test coverage  
🚥 - Test coverage of some sort exists (a test failed when error raised)  
🚦 - Test coverage of return value (a test failed when nil used)  
 - Permissions check tested

### Issue lookup with access check

Using `visible_to_user` likely makes these security issues too. See [Code smells](#code-smells).

- [x] 🚦 app/finders/notes_finder.rb:15 [`visible_to_user`]
- [x] 🚥 app/views/layouts/nav/_project.html.haml:73 [`visible_to_user`] [`.count`]
- [x]  app/services/merge_requests/build_service.rb:84 [`issue.try(:confidential?)`]
- [x]  lib/api/issues.rb:112 [`visible_to_user`]
  - CHANGELOG: Prevented API returning issues set to 'Only team members' to everyone
- [x]  lib/api/helpers.rb:126 [`can?(current_user, :read_issue, issue)`] Maybe here too?
- [x]  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
2016-11-28 21:26:23 -03:00
Douwe Maan 3d7704ae5f Merge branch 'zj-fix-label-creation-non-members' into 'security'
Fix label creation non members

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/23416

See merge request !2006
2016-11-28 21:24:19 -03:00
Rémy Coutable 81ba3f9177
API: Introduce `#find_group!` which also check access permission
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-24 16:58:32 +01:00