Skip to content

Commit

Permalink
Draft status missing in MergeRequest class (#553)
Browse files Browse the repository at this point in the history
* Draft status missing in MergeRequest class

- Closes #552

* added obsolete to work in progress for mergeRequest

* further changes for draft
  • Loading branch information
phdesroUbi authored Nov 6, 2023
1 parent 99b0710 commit 3c1289b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion NGitLab.Mock/Clients/MergeRequestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ public void Delete(int mergeRequestIid)

if (query.Wip != null)
{
mergeRequests = mergeRequests.Where(mr => (bool)query.Wip ? mr.WorkInProgress : !mr.WorkInProgress);
mergeRequests = mergeRequests.Where(mr => (bool)query.Wip ? mr.Draft : !mr.Draft);
}
}

Expand Down
5 changes: 5 additions & 0 deletions NGitLab.Mock/MergeRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,14 @@ public Pipeline HeadPipeline

public NoteCollection<MergeRequestComment> Comments { get; }

[Obsolete("Deprecated by GitLab. Use Draft instead")]
public bool WorkInProgress => Title is not null &&
(Title.StartsWith("WIP:", StringComparison.OrdinalIgnoreCase) ||
Title.StartsWith("Draft:", StringComparison.OrdinalIgnoreCase));

public bool Draft => Title is not null &&
Title.StartsWith("Draft:", StringComparison.OrdinalIgnoreCase);

public IList<UserRef> Approvers { get; } = new List<UserRef>();

public MergeRequestChangeCollection Changes
Expand Down Expand Up @@ -286,6 +290,7 @@ internal Models.MergeRequest ToMergeRequestClient()
MergedAt = MergedAt?.UtcDateTime,
ClosedAt = ClosedAt?.UtcDateTime,
Description = Description,
Draft = Draft,
Id = Id,
Iid = Iid,
ProjectId = Project.Id,
Expand Down
1 change: 1 addition & 0 deletions NGitLab.Mock/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ NGitLab.Mock.MergeRequest.CreatedAt.set -> void
NGitLab.Mock.MergeRequest.Description.get -> string
NGitLab.Mock.MergeRequest.Description.set -> void
NGitLab.Mock.MergeRequest.DivergedCommitsCount.get -> int?
NGitLab.Mock.MergeRequest.Draft.get -> bool
NGitLab.Mock.MergeRequest.ForceRemoveSourceBranch.get -> bool
NGitLab.Mock.MergeRequest.ForceRemoveSourceBranch.set -> void
NGitLab.Mock.MergeRequest.GetDiscussions() -> System.Collections.Generic.IEnumerable<NGitLab.Models.MergeRequestDiscussion>
Expand Down
4 changes: 4 additions & 0 deletions NGitLab/Models/MergeRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public class MergeRequest
[JsonPropertyName("downvotes")]
public int Downvotes;

[JsonPropertyName("draft")]
public bool Draft;

[JsonPropertyName("upvotes")]
public int Upvotes;

Expand All @@ -59,6 +62,7 @@ public class MergeRequest
[JsonPropertyName("target_project_id")]
public int TargetProjectId;

[Obsolete("Deprecated by GitLab. Use Draft instead")]
[JsonPropertyName("work_in_progress")]
public bool? WorkInProgress;

Expand Down
1 change: 1 addition & 0 deletions NGitLab/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2162,6 +2162,7 @@ NGitLab.Models.MergeRequest.DiffRefs -> NGitLab.Models.DiffRefs
NGitLab.Models.MergeRequest.DivergedCommitsCount.get -> int?
NGitLab.Models.MergeRequest.DivergedCommitsCount.set -> void
NGitLab.Models.MergeRequest.Downvotes -> int
NGitLab.Models.MergeRequest.Draft -> bool
NGitLab.Models.MergeRequest.ForceRemoveSourceBranch -> bool
NGitLab.Models.MergeRequest.HasConflicts.get -> bool
NGitLab.Models.MergeRequest.HasConflicts.set -> void
Expand Down

0 comments on commit 3c1289b

Please sign in to comment.