Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Remove openChangesets resolver #12209

Merged
merged 2 commits into from
Jul 15, 2020
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
1 change: 0 additions & 1 deletion cmd/frontend/graphqlbackend/campaigns.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ type CampaignResolver interface {
CreatedAt() DateTime
UpdatedAt() DateTime
Changesets(ctx context.Context, args *ListChangesetsArgs) (ChangesetsConnectionResolver, error)
OpenChangesets(ctx context.Context) (ChangesetsConnectionResolver, error)
ChangesetCountsOverTime(ctx context.Context, args *ChangesetCountsArgs) ([]ChangesetCountsResolver, error)
Status(context.Context) (BackgroundProcessStatus, error)
ClosedAt() *DateTime
Expand Down
3 changes: 0 additions & 3 deletions cmd/frontend/graphqlbackend/schema.go

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

3 changes: 0 additions & 3 deletions cmd/frontend/graphqlbackend/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,6 @@ type Campaign implements Node {
checkState: ChangesetCheckState
): ChangesetConnection!

# All the changesets in this campaign whose state is ChangesetState.OPEN.
openChangesets: ChangesetConnection!

# The changeset counts over time, in 1-day intervals backwards from the point in time given in
# the "to" parameter.
changesetCountsOverTime(
Expand Down
1 change: 0 additions & 1 deletion enterprise/internal/campaigns/resolvers/apitest/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ type Campaign struct {
Patches PatchConnection
HasUnpublishedPatches bool
Changesets ChangesetConnection
OpenChangesets ChangesetConnection
ChangesetCountsOverTime []ChangesetCounts
DiffStat DiffStat
PatchSet PatchSet
Expand Down
13 changes: 0 additions & 13 deletions enterprise/internal/campaigns/resolvers/campaigns.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,6 @@ func (r *campaignResolver) Changesets(
}, nil
}

func (r *campaignResolver) OpenChangesets(ctx context.Context) (graphqlbackend.ChangesetsConnectionResolver, error) {
state := campaigns.ChangesetStateOpen
return &changesetsConnectionResolver{
store: r.store,
opts: ee.ListChangesetsOpts{
CampaignID: r.Campaign.ID,
ExternalState: &state,
Limit: -1,
},
optsSafe: true,
}, nil
}

func (r *campaignResolver) ChangesetCountsOverTime(
ctx context.Context,
args *graphqlbackend.ChangesetCountsArgs,
Expand Down
40 changes: 5 additions & 35 deletions enterprise/internal/campaigns/resolvers/permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,8 @@ func TestRepositoryPermissions(t *testing.T) {
"campaign": string(campaigns.MarshalCampaignID(campaign.ID)),
}
testCampaignResponse(t, s, userCtx, input, wantCampaignResponse{
changesetTypes: map[string]int{"ExternalChangeset": 2},
changesetsCount: 2,
openChangesetTypes: map[string]int{"ExternalChangeset": 2},
changesetTypes: map[string]int{"ExternalChangeset": 2},
changesetsCount: 2,
campaignDiffStat: apitest.DiffStat{
Added: 2 * changesetDiffStat.Added,
Changed: 2 * changesetDiffStat.Changed,
Expand Down Expand Up @@ -532,10 +531,6 @@ func TestRepositoryPermissions(t *testing.T) {
"HiddenExternalChangeset": 1,
},
changesetsCount: 2,
openChangesetTypes: map[string]int{
"ExternalChangeset": 1,
"HiddenExternalChangeset": 1,
},
campaignDiffStat: apitest.DiffStat{
Added: 1 * changesetDiffStat.Added,
Changed: 1 * changesetDiffStat.Changed,
Expand Down Expand Up @@ -582,10 +577,9 @@ func TestRepositoryPermissions(t *testing.T) {
}

type wantCampaignResponse struct {
changesetTypes map[string]int
changesetsCount int
openChangesetTypes map[string]int
campaignDiffStat apitest.DiffStat
changesetTypes map[string]int
changesetsCount int
campaignDiffStat apitest.DiffStat
}

func testCampaignResponse(t *testing.T, s *graphql.Schema, ctx context.Context, in map[string]interface{}, w wantCampaignResponse) {
Expand All @@ -610,14 +604,6 @@ func testCampaignResponse(t *testing.T, s *graphql.Schema, ctx context.Context,
t.Fatalf("unexpected changesettypes (-want +got):\n%s", diff)
}

openChangesetTypes := map[string]int{}
for _, c := range response.Node.OpenChangesets.Nodes {
openChangesetTypes[c.Typename]++
}
if diff := cmp.Diff(w.openChangesetTypes, openChangesetTypes); diff != "" {
t.Fatalf("unexpected open changeset types (-want +got):\n%s", diff)
}

if diff := cmp.Diff(w.campaignDiffStat, response.Node.DiffStat); diff != "" {
t.Fatalf("unexpected campaign diff stat (-want +got):\n%s", diff)
}
Expand Down Expand Up @@ -651,22 +637,6 @@ query($campaign: ID!, $state: ChangesetState, $reviewState: ChangesetReviewState
}
}

openChangesets {
nodes {
__typename
... on HiddenExternalChangeset {
id
}
... on ExternalChangeset {
id
repository {
id
name
}
}
}
}

diffStat {
added
changed
Expand Down