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
Design a GraphQL API that would allow us to show either the "Update campaign" or "Create campaign" button on the apply page #12468
Comments
This API will be obsolete once we have the delta API in place, so I already deprecated it, although it's not even implemented yet. diff --git a/cmd/frontend/graphqlbackend/schema.graphql b/cmd/frontend/graphqlbackend/schema.graphql
index 564d6653b4..35fe964b4a 100755
--- a/cmd/frontend/graphqlbackend/schema.graphql
+++ b/cmd/frontend/graphqlbackend/schema.graphql
@@ -1184,6 +1184,15 @@ type Query {
viewerCanAdminister: Boolean
): CampaignConnection!
+ # Gets the campaign that is targetted by the given campaign spec. Returns null, when the targetted campaign doesn't yet exist.
+ # This is the case when no match was found for the given namespace + campaign name combination.
+ # DEPRECATED: This API is only used to determine whether a campaign will be created or updated by running the applyCampaign
+ # mutation. Once the delta API is in place, this API is not required anymore and should NOT be used by anyone.
+ campaignForSpec(campaignSpec: ID!): Campaign
+ @deprecated(
+ reason: "This API is going to disappear in a future version of Sourcegraph. It acts as a lightweight version of the upcoming delta API."
+ )
+
# Looks up a repository by either name or cloneURL.
repository(
# Query the repository by name, for example "github.com/gorilla/mux". |
Looks good to me! But wouldn't it be easier for the frontend if this was an attribute on the |
That's actually a good idea. That field could even stay useful, so it might not need the immediate deprecation, I've updated the patch: diff --git a/cmd/frontend/graphqlbackend/schema.graphql b/cmd/frontend/graphqlbackend/schema.graphql
index 564d6653b4..6f1c86e18b 100755
--- a/cmd/frontend/graphqlbackend/schema.graphql
+++ b/cmd/frontend/graphqlbackend/schema.graphql
@@ -659,6 +659,9 @@ type CampaignSpec implements Node {
# When true, the viewing user can apply this spec.
viewerCanAdminister: Boolean!
+
+ # The campaign this spec will update when applied. Is null, when the campaign doesn't yet exist.
+ appliesToCampaign: Campaign
}
# A user (identified either by username or email address) with its repository permission.
|
Thanks! I know I came up with it, but now I'm wondering: is |
I think I'd prefer the latter, if grammar says yes - because it makes more clear that this WILL happen, while |
But isn't that correct? You don't have to apply the campaign spec when you preview it. |
Yes, but my understanding was that when you |
You both know I'm Australian, right? Some people would argue I don't speak proper English. I'd go with |
Closing this because it's done! The API implementation of this is covered in #12469 but can also be tackled separately. |
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:
Reply to this ticket with the proposed API
The text was updated successfully, but these errors were encountered: