Add GraphQL mutation for toggling the resolved status of a discussion
What does this MR do?
This MR adds a new GraphQL mutations for toggling the resolved state of a discussion.
It also adds a new interface called ResolvableInterface
that is implemented by NoteType
and DiscussionType
. Previously NoteType
had all the fields of this new interface, besides the boolean resolved
. The interface allows us to reuse those field definitions between these two "resolvable" types.
Example mutation call
The following can be performed in GraphiQL
to manually test the mutations.
-
input.id
is the Global ID (emitted in GraphQL queries) of a discussion. -
input.resolve
is a boolean to indicate if the mutation should resolve or unresolve a discussion.
Note that the mutation will intentionally not produce an error if the input.resolved
argument is true
and the discussion is already resolved (and vice versa) this is to cater for the kind of race conditions that can happen when two clients are mutating the same discussion without the state having been refreshed on the second client to mutate beforehand. The client should not need to deal with errors in that situation, but simply know that the discussion was resolved (it may just not be by them).
mutation {
discussionToggleResolve(input: { id: "gid://gitlab/DiffDiscussion/c6bd13b7c9814f1f5f77aa2b8ccef7fd37ea2f1a", resolve: true }) {
discussion {
id
resolved
resolvable
resolvedAt
resolvedBy {
username
}
resolvedAt
notes {
nodes {
resolved
resolvable
resolvedAt
resolvedBy {
username
}
}
}
}
errors
}
}
- Issue: #13049 (closed)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
- [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done