Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEVPROD-14383 Remove includeCommitQueue field #8667

Merged
merged 7 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions graphql/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions graphql/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 13 additions & 10 deletions graphql/project_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@ func (r *projectResolver) IsFavorite(ctx context.Context, obj *restModel.APIProj

// Patches is the resolver for the patches field.
func (r *projectResolver) Patches(ctx context.Context, obj *restModel.APIProjectRef, patchesInput PatchesInput) (*Patches, error) {
opts := patch.ByPatchNameStatusesCommitQueuePaginatedOptions{
Project: obj.Id,
PatchName: patchesInput.PatchName,
Statuses: patchesInput.Statuses,
Page: patchesInput.Page,
Limit: patchesInput.Limit,
OnlyCommitQueue: patchesInput.OnlyCommitQueue,
IncludeHidden: patchesInput.IncludeHidden,
Requesters: patchesInput.Requesters,
if patchesInput.OnlyMergeQueue == nil {
patchesInput.OnlyMergeQueue = patchesInput.OnlyCommitQueue
}
opts := patch.ByPatchNameStatusesMergeQueuePaginatedOptions{
Project: obj.Id,
PatchName: patchesInput.PatchName,
Statuses: patchesInput.Statuses,
Page: patchesInput.Page,
Limit: patchesInput.Limit,
OnlyMergeQueue: patchesInput.OnlyMergeQueue,
IncludeHidden: patchesInput.IncludeHidden,
Requesters: patchesInput.Requesters,
}

patches, count, err := patch.ByPatchNameStatusesCommitQueuePaginated(ctx, opts)
patches, count, err := patch.ByPatchNameStatusesMergeQueuePaginated(ctx, opts)
if err != nil {
return nil, InternalServerError.Send(ctx, fmt.Sprintf("fetching patches for project '%s': %s", utility.FromStringPtr(opts.Project), err.Error()))
}
Expand Down
4 changes: 2 additions & 2 deletions graphql/schema/types/patch.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ PatchesInput is the input value to the patches field for the User and Project ty
Based on the information in PatchesInput, we return a list of Patches for either an individual user or a project.
"""
input PatchesInput {
includeCommitQueue: Boolean
limit: Int! = 0
onlyCommitQueue: Boolean
onlyCommitQueue: Boolean @deprecated(reason: "onlyCommitQueue is deprecated. Use onlyMergeQueue instead.")
onlyMergeQueue: Boolean
includeHidden: Boolean = false
page: Int! = 0
patchName: String! = ""
Expand Down
63 changes: 48 additions & 15 deletions graphql/tests/project/patches/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,54 +18,87 @@
"patches": [
{
"branch": "spruce",
"_id": { "$oid": "5e4ff3abe3c3317e352062e4" },
"_id": {
"$oid": "5e4ff3abe3c3317e352062e4"
},
"author": "regular_user",
"create_time": { "$date": "2020-01-01T00:00:01Z" },
"create_time": {
"$date": "2020-01-01T00:00:01Z"
},
"desc": "1",
"status": "created",
"alias": "__commit_queue"
"alias": "__commit_queue",
"github_merge_data": {
"head_sha": "5e4ff3a"
}
},
{
"branch": "spruce",
"_id": { "$oid": "5e4ff3abe3c3317e352062e5" },
"_id": {
"$oid": "5e4ff3abe3c3317e352062e5"
},
"author": "regular_user",
"create_time": { "$date": "2020-01-01T00:00:02Z" },
"create_time": {
"$date": "2020-01-01T00:00:02Z"
},
"desc": "222",
"status": "created",
"alias": "__commit_queue"
"alias": "__commit_queue",
"github_merge_data": {
"head_sha": "5e4ff3f"
}
},
{
"branch": "spruce",
"_id": { "$oid": "5e4ff3abe3c3317e352062e6" },
"_id": {
"$oid": "5e4ff3abe3c3317e352062e6"
},
"author": "regular_user",
"create_time": { "$date": "2020-01-01T00:00:03Z" },
"create_time": {
"$date": "2020-01-01T00:00:03Z"
},
"desc": "1",
"status": "created",
"alias": "__commit_queue"
"alias": "__commit_queue",
"github_merge_data": {
"head_sha": "3d4ff3a"
}
},
{
"branch": "spruce",
"_id": { "$oid": "5e4ff3abe3c3317e352062e7" },
"_id": {
"$oid": "5e4ff3abe3c3317e352062e7"
},
"author": "regular_user",
"create_time": { "$date": "2020-01-01T00:00:04Z" },
"create_time": {
"$date": "2020-01-01T00:00:04Z"
},
"desc": "222",
"status": "failed",
"alias": "__github"
},
{
"branch": "spruce",
"_id": { "$oid": "5e4ff3abe3c3317e352062e8" },
"_id": {
"$oid": "5e4ff3abe3c3317e352062e8"
},
"author": "regular_user",
"create_time": { "$date": "2020-01-01T00:00:05Z" },
"create_time": {
"$date": "2020-01-01T00:00:05Z"
},
"desc": "1",
"status": "created",
"alias": "__github"
},
{
"branch": "spruce",
"_id": { "$oid": "5e4ff3abe3c3317e352062e9" },
"_id": {
"$oid": "5e4ff3abe3c3317e352062e9"
},
"author": "regular_user",
"create_time": { "$date": "2019-01-01T00:00:06Z" },
"create_time": {
"$date": "2019-01-01T00:00:06Z"
},
"desc": "222",
"status": "failed",
"alias": "__github"
Expand Down
1 change: 0 additions & 1 deletion graphql/tests/project/patches/queries/all_params.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
project(projectIdentifier: "spruce") {
patches(
patchesInput: {
includeCommitQueue: true
statuses: ["failed", "succeeded"]
patchName: "2"
page: 0
Expand Down
10 changes: 10 additions & 0 deletions graphql/tests/project/patches/queries/only_merge_queue.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
project(projectIdentifier: "spruce") {
patches(patchesInput: { onlyMergeQueue: true }) {
patches {
id
}
filteredPatchCount
}
}
}
2 changes: 1 addition & 1 deletion graphql/tests/project/patches/queries/statuses.graphql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
project(projectIdentifier: "spruce") {
patches(patchesInput: { includeCommitQueue: true, statuses: ["failed"] }) {
patches(patchesInput: { statuses: ["failed"] }) {
patches {
id
status
Expand Down
Loading
Loading