Skip to content

a8n: Add closeCampaign mutation

Administrator requested to merge a8n/close-campaign into master

Created by: mrnugget

This implements the first part of https://github.com/sourcegraph/sourcegraph/issues/7082 by adding a closeCampaign mutation to our GraphQL mutation that

  • closes the Campaign by setting the new ClosedAt field to the current time
  • asynchronously closes the changesets belonging to the Campaign on the codehosts

It's an idempotent operation: it only sets ClosedAt if it hasn't been closed before and it only closes the changesets if they're still open (i.e. not merged/closed (which is "decliend" on Bitbucket Server)).

Again, this is only the first part of #7082. Read through the ticket to see what's missing. But what's here are the things we definitely need:

  • marking a campaign as closed
  • closing changesets on the codehosts

Taking the current state of #7082 as spec I implemented the closeCampaign operation to do both. If we decide to split this up (and have, for example, another closeCampaignChangesets mutation, as described in RFC 36) we can still do that.

What's missing, of course, is the frontend component, because I don't dare to add a simple button 😜 (cc @felixfbecker @eseliger)

There's also a TODO for myself and @ryanslade @tsenart: there's now a lot of duplication between the (&a8n.Service).CloseOpenCampaignChangesets and the (&a8n.Syncer).SyncChangesets methods, since both need to do the whole "here's a list of changesets, fetch me the correct external services and then turn those into sources" dance. I don't think this duplication is a blocker to reviewing and merging this PR, but I want your thoughts on a possible fix here and will work on this (and might push commits to this branch).

Merge request reports

Loading