Skip to content

Updating a closed campaign with N already merged changesets creates N new changesets

Created by: mrnugget

This was reported by @unknwon:

  1. He had a Campaign with 24 merged Changesets
  2. Campaign was closed
  3. He then tried to edit the Campaign's description (which he could in the UI!)
  4. He got a warning that updating a closed campaign is not allowed

But the campaign was updated and a complete set of new changesets was created on the code host.

Two bugs:

  1. We still allow updating a closed Campaign in the frontend, even though we show a warning that it's not allowed
  2. We still allow updating a closed Campaign in the backend

And one sneaky bug in the background: 3. When we update a closed Campaign, we "ResetChangesetJobs" which leads to the ChangesetJobs being executed again, which means that they will create a commit/push it/create PR again, since the previous PR doesn't exist anymore and the ExecChangesetJob method doesn't fail. We should add a safety check to ExecChangesetJob that stops the method when the ChangesetJob already has a Changeset and that is closed/merged.