Add updateImageDiffNote mutation to reposition notes on images
What does this MR do?
This MR adds a new repositionImageDiffNote
mutation which allows repositioning a DiffNote
on an image.
It uses the special reposition_note
permission introduced in !45957 (merged), which is an alias of admin_note
unless the noteable is a Design
, in which case it will be true
if the user can create_note
. This allows people who can comment on a Design
to reposition the notes of other people, but for other noteables, only the author of the note or maintainer could reposition it.
The mutation is written to allow it to be used for DiffNotes
on images for all noteables and not just Design
s.
GraphQL changes
Adds a new note.userPermissions.repositionNote
property to check for whether a user can reposition a note.
Adds a new mutation to reposition the note called repositionImageDiffNote
.
It takes:
-
id
(required) -
position
: (required)-
x
(optional) -
y
(optional) -
width
(optional) -
height
(optional)
-
And returns:
errors
note
Example:
mutation {
repositionImageDiffNote(input: { id: "gid://gitlab/DiffNote/1588", position: { x: 50, y: 100 } }) {
errors
note {
id
}
}
}
QA
First, add a note to a design.
Using GraphiQL http://127.0.0.1:3001/-/graphql-explorer, inspect the note that was created:
{
project(fullPath: "root/my-project") {
issue(iid: "1") {
designCollection {
designs {
nodes {
notes {
nodes {
id
position {
x
y
}
}
}
}
}
}
}
}
}
Then, use the id
of the note to reposition it.
mutation {
repositionImageDiffNote(input: { id: "gid://gitlab/DiffNote/1", position: { x: 50, y: 100 } }) {
errors
note {
id
}
}
}
Reload the design in your browser and the note should be repositioned.
- Issue: #207334 (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