summaryrefslogtreecommitdiff
path: root/lib/api
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'memoize_shell_secret_token' into 'master' Rémy Coutable2016-10-071-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Memoize Github::Shell's secret token ## What does this MR do? `API::Helpers#secret_token` was reading the secret file on every invocation. This MR reads the file in the `gitlab_shell_secret_token.rb` initializer and saves it as a class variable at `Gitlab::Shell.secret_token` ## Are there points in the code the reviewer needs to double check? - I'm not sure if the use of `cattr_accessor` is the best approach, or if should be moved into the `class << self` block? - Should `API::Helpers#secret_token` be removed in favor of using `Gitlab::Shell.secret_token`? ## Why was this MR needed? Performance optimization. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/22510 See merge request !6599
| * Load Github::Shell's secret token from file on initialization instead of ↵Justin DiPierro2016-10-061-1/+1
| | | | | | | | every request.
* | Merge branch 'ben.boeckel/gitlab-ce-api-visible-projects' into 'master' Rémy Coutable2016-10-071-20/+31
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add visible projects API ## What does this MR do? Add a new `/projects/visible` API endpoint. Originally created by @ben.boeckel in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5970. ## Are there points in the code the reviewer needs to double check? Does the API make sense? ## Why was this MR needed? The `/projects` endpoint only returned projects the user was explicitly a member of. Closes #19361, #3119. See merge request !6681
| * | Tidy up project list actionsben.boeckel/gitlab-ce-api-visible-projectsSean McGivern2016-10-051-28/+24
| | |
| * | api: add /projects/visible API endpointBen Boeckel2016-10-041-0/+15
| | | | | | | | | | | | FIxes #19361, #3119.
* | | Switch from request to env in ::API::HelpersNick Thomas2016-10-061-1/+1
| |/ |/| | | | | | | | | Per https://gitlab.com/gitlab-org/gitlab-ce/issues/22820, this helper is mixed in to classes that lack a `request` method. They do include `env`, so use it instead.
* | Merge branch 'rc-use-grape-dsl-to-document-members-api' into 'master' Robert Speicher2016-10-062-93/+67
|\ \ | | | | | | | | | | | | | | | | | | API: Use Grape DSL to document access requests and members endpoints Part of #21979, depends on gitlab-org/gitlab-ce!6267 and gitlab-org/gitlab-ce!6266. See merge request !6269
| * | Use Grape DSL to document methods and their paramsrc-use-grape-dsl-to-document-members-apiRémy Coutable2016-10-052-93/+67
| | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | | Merge branch 'mahcsig/gitlab-ce-17350-multi-file-commit'Rémy Coutable2016-10-061-0/+36
|\ \ \ | | | | | | | | | | | | See !6096.
| * | | multi-file commitMarc Siegfriedt2016-10-051-0/+36
| |/ / | | | | | | | | | | | | | | | add docs and tests - add additional validation allow move without content updated response
* | | Merge branch 'issue-board-api-support' into 'master' Dmitriy Zaporozhets2016-10-063-1/+133
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue Board API support ## What does this MR do? Adds support for Issue Board in the API. ## Are there points in the code the reviewer needs to double check? ~~Double check whether the Issue Board list movement fix is needed.~~ *Moved to a separate issue.* [#22890](https://gitlab.com/gitlab-org/gitlab-ce/issues/22890) ## Why was this MR needed? Currently the API offers partial support to a project's Issue Board indirectly through Labels. This MR adds support for listing, creating, moving and removing board lists. ## Does this MR meet the acceptance criteria? - [X] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [X] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [X] API support added - Tests - [X] Added for this feature/bug - [X] All builds are passing - [X] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [X] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [X] Branch has no merge conflicts with `master` (if you do - rebase it please) - [X] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? [#22195](https://gitlab.com/gitlab-org/gitlab-ce/issues/22195) See merge request !6646
| * | | Added Issue Board API supportAndre Guedes2016-10-053-1/+133
| |/ / | | | | | | | | | - Includes documentation and tests
* | | Merge commit 'dev/security' into 'master'Rémy Coutable2016-10-061-1/+4
|\ \ \ | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
| * \ \ Merge branch '22435-no-api-state-change-via-rails-session' into 'security' Douwe Maan2016-09-281-1/+4
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | API: disable rails session auth for non-GET/HEAD requests Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/22435 See merge request !1999
| | * | | API: disable rails session auth for non-GET/HEAD requestsNick Thomas2016-09-231-1/+4
| | | | |
* | | | | fix group links 404barthc2016-10-051-0/+3
| |_|/ / |/| | |
* | | | Merge branch 'rc-improve-members-destroy-service' into 'master' Robert Speicher2016-10-042-4/+3
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | | | | | | | | | Improve `Members::DestroyService` Part of #21979. See merge request !6267
| * | | Remove useless code now that Member#add_user handles itrc-improve-members-destroy-serviceRémy Coutable2016-10-031-8/+0
| | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
| * | | Fix a few things after the initial improvment to Members::DestroyServiceRémy Coutable2016-10-031-1/+2
| | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
| * | | Improve Members::DestroyServiceRémy Coutable2016-10-032-4/+10
| | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | | | GrapeDSL for Namespace endpointzj-grape-sessionsZ.J. van de Weg2016-10-041-12/+10
|/ / /
* | | Merge branch 'zj-grape-award-emoji' into 'master' Robert Speicher2016-10-031-33/+31
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | GrapeDSL for Award Emoji endpoints Cherry-picked from !6330 See merge request !6629
| * | | GrapeDSL for Award Emoji endpointszj-grape-award-emojiZ.J. van de Weg2016-10-031-33/+31
| | | |
* | | | Merge branch 'zj-grape-keys' into 'master' Rémy Coutable2016-10-031-4/+3
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | GrapeDSL for Keys endpoint No changelog item as it doesn't change behaviour Cherry-picket from !6330 See merge request !6631
| * | | GrapeDSL for Keys endpointzj-grape-keysZ.J. van de Weg2016-10-011-4/+3
| | | |
* | | | Merge branch ↵Robert Speicher2016-10-021-15/+2
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | '21983-member-add_user-doesn-t-detect-existing-members-that-have-requested-access' into 'master' Resolve "`Member.add_user`doesn't detect existing members that have requested access" ## What does this MR do? This merge request handle the case when an access requester is added to a group or project (via the members page or the API). In `Member.add_user`, if an access requester already exists, we simply accept their request (and set the `created_by`, `access_level` and `expires_at` attributes if given). ## Are there points in the code the reviewer needs to double check? I've taken the opportunity to cleanup the whole `{Group,Project}Member.add_user*` methods since it was quite a mess. ## What are the relevant issue numbers? Closes #21983 See merge request !6393
| * | | Allow Member.add_user to handle access requestersRémy Coutable2016-09-281-15/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes include: - Ensure Member.add_user is not called directly when not necessary - New GroupMember.add_users_to_group to have the same abstraction level as for Project - Refactor Member.add_user to take a source instead of an array of members - Fix Rubocop offenses - Always use Project#add_user instead of project.team.add_user - Factorize users addition as members in Member.add_users_to_source - Make access_level a keyword argument in GroupMember.add_users_to_group and ProjectMember.add_users_to_projects - Destroy any requester before adding them as a member - Improve the way we handle access requesters in Member.add_user Instead of removing the requester and creating a new member, we now simply accepts their access request. This way, they will receive a "access request granted" email. - Fix error that was previously silently ignored - Stop raising when access level is invalid in Member, let Rails validation do their work Signed-off-by: Rémy Coutable <remy@rymai.me>
* | | | Merge branch '15356-filters-should-change-issue-counts' into 'master' Robert Speicher2016-09-301-2/+1
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Take filters in account in issuable counters ## What does this MR do? This merge request ensure we display issuable counters that take in account all the selected filters, solving #15356. ## Are there points in the code the reviewer needs to double check? There was an issue (#22414) in the original implementation (!4960) when more than one label was selected because calling `#count` when the ActiveRecordRelation contains a `.group` returns an OrderedHash. This merge request relies on [how Kaminari handle this case](https://github.com/amatsuda/kaminari/blob/master/lib/kaminari/models/active_record_relation_methods.rb#L24-L30). A few things to note: - The `COUNT` query issued by Kaminari for the pagination is now cached because it's already run by `ApplicationHelper#state_filters_text_for`, so in the end we issue one less SQL query than before; - In the case when more than one label are selected, the `COUNT` queries return an OrderedHash in the form `{ ISSUABLE_ID => COUNT_OF_SELECTED_FILTERS }` on which `#count` is called: this drawback is already in place (for instance when loading https://gitlab.com/gitlab-org/gitlab-ce/issues?scope=all&state=all&utf8=%E2%9C%93&label_name%5B%5D=bug&label_name%5B%5D=regression) since that's how Kaminari solves this, **the difference is that now we do that two more times for the two states that are not currently selected**. I will let the ~Performance team decide if that's something acceptable or not, otherwise we will have to find another solution... - The queries that count the # of issuable are a bit more complex than before, from: ``` (0.6ms) SELECT COUNT(*) FROM "issues" WHERE "issues"."deleted_at" IS NULL AND "issues"."project_id" = $1 AND ("issues"."state" IN ('opened','reopened')) [["project_id", 2]] (0.2ms) SELECT COUNT(*) FROM "issues" WHERE "issues"."deleted_at" IS NULL AND "issues"."project_id" = $1 AND ("issues"."state" IN ('closed')) [["project_id", 2]] (0.2ms) SELECT COUNT(*) FROM "issues" WHERE "issues"."deleted_at" IS NULL AND "issues"."project_id" = $1 [["project_id", 2]] ``` to ``` (0.7ms) SELECT COUNT(*) AS count_all, "issues"."id" AS issues_id FROM "issues" INNER JOIN "label_links" ON "label_links"."target_id" = "issues"."id" AND "label_links"."target_type" = $1 INNER JOIN "labels" ON "labels"."id" = "label_links"."label_id" WHERE "issues"."deleted_at" IS NULL AND ("issues"."state" IN ('opened','reopened')) AND "issues"."project_id" = 2 AND "labels"."title" IN ('bug', 'discussion') AND "labels"."project_id" = 2 GROUP BY "issues"."id" HAVING COUNT(DISTINCT labels.title) = 2 [["target_type", "Issue"]] (0.5ms) SELECT COUNT(*) AS count_all, "issues"."id" AS issues_id FROM "issues" INNER JOIN "label_links" ON "label_links"."target_id" = "issues"."id" AND "label_links"."target_type" = $1 INNER JOIN "labels" ON "labels"."id" = "label_links"."label_id" WHERE "issues"."deleted_at" IS NULL AND ("issues"."state" IN ('closed')) AND "issues"."project_id" = 2 AND "labels"."title" IN ('bug', 'discussion') AND "labels"."project_id" = 2 GROUP BY "issues"."id" HAVING COUNT(DISTINCT labels.title) = 2 [["target_type", "Issue"]] (0.5ms) SELECT COUNT(*) AS count_all, "issues"."id" AS issues_id FROM "issues" INNER JOIN "label_links" ON "label_links"."target_id" = "issues"."id" AND "label_links"."target_type" = $1 INNER JOIN "labels" ON "labels"."id" = "label_links"."label_id" WHERE "issues"."deleted_at" IS NULL AND "issues"."project_id" = 2 AND "labels"."title" IN ('bug', 'discussion') AND "labels"."project_id" = 2 GROUP BY "issues"."id" HAVING COUNT(DISTINCT labels.title) = 2 [["target_type", "Issue"]] ``` - We could cache the counters for a few minutes? The key could be `PROJECT_ID-ISSUABLE_TYPE-PARAMS`. A few possible arguments in favor of "it's an acceptable solution": - most of the time people filter with a single label => no performance problem here - when filtering with more than one label, usually the result set is reduced, limiting the performance issues ## What are the relevant issue numbers? Closes #15356 See merge request !6496
| * | | | Small improvements thanks to Robert's feedbackRémy Coutable2016-09-301-2/+1
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | | | | Merge branch 'koding-setting-api' into 'master' Robert Speicher2016-09-301-0/+2
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expose the Koding application settings in the API ## Why was this MR needed? When saving the GitLab application secrets in Koding, and authorising your admin user to have access to the UI, we want to let Koding enable the integration, and populate the url in GitLab for the user. ## What are the relevant issue numbers? Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/22705 See merge request !6555
| * | | | Expose the Koding application settings in the APIkoding-setting-apiDJ Mountney2016-09-291-0/+2
| | | | | | | | | | | | | | | | | | | | This will allow the Koding app to enable the integration itself once is has authorized an admin user using the application secrets.
* | | | | Merge branch 'rc-new-access-requests-finder' into 'master' Douwe Maan2016-09-301-2/+2
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New `AccessRequestsFinder` Part of #21979. ## Does this MR meet the acceptance criteria? - [x] API support added - Tests - [x] Added for this feature/bug - [x] All builds are passing - [ ] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !6268
| * | | | New AccessRequestsFinderRémy Coutable2016-09-281-2/+2
| |/ / / | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | | | Merge branch 'issue_22382' into 'master' Rémy Coutable2016-09-292-6/+7
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expose project share expiration_date field on API closes #22382 See merge request !6484
| * | | | Expose project share expiration_date field on APIissue_22382Felipe Artur2016-09-282-6/+7
| | |_|/ | |/| |
* | | | Merge branch '22367-add-pipeline-id-build' into 'master' Rémy Coutable2016-09-291-2/+7
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expose pipeline data in builds API Exposes pipeline data in builds API, as suggested by #22367. The fields exposed were 'id', 'status', 'ref', and 'sha'. Closes #22367 See merge request !6502
| * | | | expose pipeline data in builds APIGuilherme Salazar2016-09-281-2/+7
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | add pipeline ref, sha, and status to the build API response add tests of build API (pipeline data) change API documentation for builds API log change to builds API in CHANGELOG CHANGELOG: add reference to pull request and contributor's name
* | | | Handle LFS token creation and retrieval in the same method, and in the same ↵lfs-ssh-authorization-fixPatricio Cano2016-09-281-1/+1
|/ / / | | | | | | | | | | | | | | | Redis connection. Reset expiry time of token, if token is retrieved again before it expires.
* | | Merge branch 'dz-profile-organization' into 'master' Dmitriy Zaporozhets2016-09-272-3/+5
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add organization field to the user profile ## What does this MR do? Add organization field to the user profile ## Are there points in the code the reviewer needs to double check? no ## Why was this MR needed? So we can let users fill organization information separately ## Screenshots (if relevant) ![Screen_Shot_2016-09-26_at_7.32.27_PM](/uploads/d11a9a86aa22227f9c9915d195106c5f/Screen_Shot_2016-09-26_at_7.32.27_PM.png) ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [x] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~ - [x] API support added - Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? https://gitlab.com/gitlab-org/gitlab-ce/issues/21903 See merge request !6526
| * | | Add User#organization to users apiDmitriy Zaporozhets2016-09-272-3/+5
| | |/ | |/| | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | | Merge branch 'rc-new-members-approve-request-access-service' into 'master' Douwe Maan2016-09-271-6/+1
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New `Members::ApproveAccessRequestService` Part of #21979. ## Does this MR meet the acceptance criteria? - [x] API support added - Tests - [x] Added for this feature/bug - [x] All builds are passing - [ ] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !6266
| * | New Members::ApproveAccessRequestServiceRémy Coutable2016-09-221-6/+1
| |/ | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | Keep API mounts in alphabetical orderAchilleas Pipinellis2016-09-251-1/+2
|/
* API: Return 404 when trying to fork to unaccessible namespaceRémy Coutable2016-09-221-1/+3
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Merge branch 'and-you-get-awards' into 'master' Rémy Coutable2016-09-211-12/+17
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And Snippets get awards ## What does this MR do? Makes snippets more awesome, by making them awardables ## Why was this MR needed? Because Snippets were left behind. ## What are the relevant issue numbers? Closes #17878 See merge request !4456
| * Fix tests for Snippets toggling awardsZ.J. van de Weg2016-09-191-14/+9
| | | | | | | | Also incorporate feedback
| * API support for Award Emoji on SnippetsZ.J. van de Weg2016-09-191-10/+20
| |
| * Snippets get award emoji! :thumbsup:Z.J. van de Weg2016-09-191-1/+1
| |
* | Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ceDmitriy Zaporozhets2016-09-218-73/+105
|\ \
| * \ Merge branch 'add_optional_author_for_commits' into 'master' Rémy Coutable2016-09-201-5/+7
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add optional 'author' param when making commits This fulfills https://gitlab.com/gitlab-org/gitlab-ce/issues/20789 by adding the ability to specify a user's ID to be used as the author of a commit. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/20789 See merge request !5822