Commit a2899a74 authored by Andrew Chin's avatar Andrew Chin
Browse files

Make MergeRequest.user field optional

This field will be set when you request a single merge request:

    /api/v4/projects/123/merge_requests/456

But it's missing if you request a list of merge requests:

    /api/v4/projects/123/merge_requests

Tested against a gitlab 11.9.7 server
parent 5519edf4
......@@ -396,7 +396,7 @@ fn test_read_merge_request() {
assert_eq!(merge_request.discussion_locked, None);
assert_eq!(merge_request.should_remove_source_branch, None);
assert_eq!(merge_request.force_remove_source_branch, Some(true));
assert_eq!(merge_request.user.can_merge, true);
assert_eq!(merge_request.user.unwrap().can_merge, true);
assert_eq!(
merge_request.web_url,
"https://gitlab.kitware.com/utils/rust-gitlab/merge_requests/35",
......
......@@ -1695,7 +1695,7 @@ pub struct MergeRequest {
/// Whether the merge request should be deleted or not (set by the author).
pub force_remove_source_branch: Option<bool>,
/// Information about current user's access to the merge request.
pub user: MergeRequestUser,
pub user: Option<MergeRequestUser>,
/// The URL of the merge request.
pub web_url: String,
}
......@@ -1840,7 +1840,7 @@ impl From<MergeRequestChanges> for MergeRequest {
discussion_locked: mr.discussion_locked,
should_remove_source_branch: mr.should_remove_source_branch,
force_remove_source_branch: mr.force_remove_source_branch,
user: mr.user,
user: Some(mr.user),
web_url: mr.web_url,
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment