Skip to content
Snippets Groups Projects
Closed Design a GraphQL API that would allow us to show either the "Update campaign" or "Create campaign" button on the apply page
  • View options
  • Design a GraphQL API that would allow us to show either the "Update campaign" or "Create campaign" button on the apply page

  • View options
  • Closed Issue created by Warren Gifford

    Created by: mrnugget

    We need to way to tell whether the application of the given campaign spec on the apply page would update an existing campaign or create a new campaign.

    Quoting from our Campaigns sync doc:

    When the user runs src campaign apply, it prints a URL like /{users,organizations}/$NAMESPACE_NAME/campaigns/apply?spec=$CAMPAIGN_SPEC_ID. That page shows something slightly different…

    • if the apply would create a new campaign: displays the spec and a "Create campaign" button. This uses the createCampaign mutation to ensure that if another campaign with the same namespace+name was created after the user loaded the page, that it would error instead of clobbering that unintentionally.
    • if the apply would update an existing campaign: displays a short summary of the existing campaign (namespace+name, link, and something like ), shows the new campaign spec (no delta) [that is the changeset specs], and an "Update campaign" button. This uses the applyCampaign mutation with ensureCampaign to ensure that the "Update campaign" button in fact updates the intended campaign and does not clobber another campaign in case the existing one is deleted and another one with the same namespace+name is created after the user loads the page. Runs in the namespace, URL: /users/abc/campaigns/apply?specID

    Reply to this ticket with the proposed API

    Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first