Skip to content

Allow managing comments on Noteables through GraphQL

We should add a mutations for managing comments on Noteables through GraphQL, for the noteables are already exposed in GraphQL:

  • Issues
  • Merge Requests
  • Designs (EE-Only)

Creating comments

We should allow posting comments using the GlobalID of those noteables, and return a meaningful error if a wrong id (not a class implementing Noteable) is passed.

Optionally, for DiffNotes we should allow specifying attributes that signify the position for the notes. We add sane defaults for the sha-attributes if the Noteable provides these (using MergeRequest#diff_refs or Design#diff_refs). For Designs in particulare we can also use Design#full_path to populate the file paths in the position.

The mutation should authorize :create_note on the noteable.

The mutation should use the Notes::CreateService to create the notes.


Deleting comments

We should allow deleting comments through GraphQL using the GlobalID of a note.

When an invalid GlobalID is passed we should return a meaningful error.

The mutation should authorize :destroy_note on the note loaded using the global id.

The mutation should use the Notes::DestroyService to actually destroy the notes.


Updating comments

We should allow updating comments through GraphQL using the GlobalID of a note.

When an invalid GlobalID is passed we should return a meaningful error.

The mutation should authorize :admin_note (?) on the note loaded using the global id.

The mutation should use the Notes::UpdateService to actually update the notes.


Awarding emoji

We should allow awarding and removing emoji to all Awardable objects through GraphQL using the GlobalID of that Awardable.

I think we'll want to have 3 mutations for that: AddAwardEmoji, RemoveAwardEmoji and the convenience mutation ToggleAwardEmoji.

The mutations should use Awardable#create_award_emoji, Awardable#remove_award_emoji and Awardable#toggle_award_emoji.

The mutations should return a meaningful error when a wrong GlobalID is passed.

The mutations should authorize :award_emoji on the Awardable.

Edited by 🤖 GitLab Bot 🤖