summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2016-01-13 13:07:15 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2016-01-13 13:11:26 +0100
commitbe7a784db7faf558caa022535c0a192111c4336d (patch)
treee185bcf505021989fba147053b7daa3e5435d48e
parentac5b250fab83f5daace9fe99f61fcc33f3a0ed4d (diff)
downloadgitlab-ce-be7a784db7faf558caa022535c0a192111c4336d.tar.gz
Add some fixes after review
-rw-r--r--doc/api/merge_requests.md37
-rw-r--r--lib/api/entities.rb21
-rw-r--r--lib/api/merge_requests.rb2
3 files changed, 36 insertions, 24 deletions
diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md
index 4f614026dab..2ab34c38d6e 100644
--- a/doc/api/merge_requests.md
+++ b/doc/api/merge_requests.md
@@ -2,7 +2,7 @@
## List merge requests
-Get all merge requests for this project.
+Get all merge requests for this project.
The `state` parameter can be used to get only merge requests with a given state (`opened`, `closed`, or `merged`) or all of them (`all`).
The pagination parameters `page` and `per_page` can be used to restrict the list of merge requests.
@@ -50,8 +50,7 @@ Parameters:
"created_at": "2012-04-29T08:46:00Z"
},
"description":"fixed login page css paddings",
- "work_in_progress": false,
- "status": "pending"
+ "work_in_progress": false
}
]
```
@@ -98,7 +97,25 @@ Parameters:
},
"description":"fixed login page css paddings",
"work_in_progress": false,
- "status": "pending"
+ "last_commit": {
+ "author_email": "admin@example.com",
+ "author_name": "Administrator",
+ "authored_date": "2012-04-25T13:12:15.000+01:00",
+ "committed_date": "2012-04-25T13:12:15.000+01:00",
+ "coverage": null,
+ "created_at": "2012-04-25T13:12:15.000+01:00",
+ "duration": 0,
+ "finished_at": null,
+ "id": "6c14056df0be27374e849ad67295a22cd0f7e0d0",
+ "message": "Add some fixes",
+ "parent_ids": [
+ "6b053ad388c531c21907f022933e5e81598db388"
+ ],
+ "short_id": "6c14056d",
+ "started_at": null,
+ "status": "pending",
+ "title": "Add some fixes"
+ }
}
```
@@ -206,8 +223,7 @@ Parameters:
"renamed_file": false,
"deleted_file": false
}
- ],
- "status": "pending"
+ ]
}
```
@@ -255,8 +271,7 @@ Parameters:
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
},
- "description":"fixed login page css paddings",
- "status": "pending"
+ "description":"fixed login page css paddings"
}
```
@@ -307,8 +322,7 @@ Parameters:
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
- },
- "status": "pending"
+ }
}
```
@@ -364,8 +378,7 @@ Parameters:
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
- },
- "status": "pending"
+ }
}
```
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 680cc9765dc..5a949b75f1a 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -165,12 +165,6 @@ module API
expose :assignee, :author, using: Entities::UserBasic
end
- class CommitStatus < Grape::Entity
- expose :id, :sha, :ref, :status, :name, :target_url, :description,
- :created_at, :started_at, :finished_at, :allow_failure
- expose :author, using: Entities::UserBasic
- end
-
class MergeRequest < ProjectEntity
expose :target_branch, :source_branch
expose :upvotes, :downvotes
@@ -181,11 +175,10 @@ module API
expose :work_in_progress?, as: :work_in_progress
expose :milestone, using: Entities::Milestone
expose :merge_when_build_succeeds
- expose :status do |repo_obj, _options|
- if repo_obj.respond_to?(:ci_commit)
- repo_obj.ci_commit.status if repo_obj.ci_commit
- end
- end
+ end
+
+ class MergeRequestDetail < MergeRequest
+ expose :last_commit, with: RepoCommitDetail
end
class MergeRequestChanges < MergeRequest
@@ -229,6 +222,12 @@ module API
expose :created_at
end
+ class CommitStatus < Grape::Entity
+ expose :id, :sha, :ref, :status, :name, :target_url, :description,
+ :created_at, :started_at, :finished_at, :allow_failure
+ expose :author, using: Entities::UserBasic
+ end
+
class Event < Grape::Entity
expose :title, :project_id, :action_name
expose :target_id, :target_type, :author_id
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index 3c1c6bda260..6381a771f21 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -73,7 +73,7 @@ module API
authorize! :read_merge_request, merge_request
- present merge_request, with: Entities::MergeRequest
+ present merge_request, with: Entities::MergeRequestDetail
end
# Show MR commits