Skip to content

Feature Proposal - Support for attributed author in discussions api for merge request diffs

Proposal

When using the discussions api to create a thread on an MR, it would be great if we could pass an attributed_author(name, email) so the attributed author is displayed instead of the user who made the api request.

For example, we have this case:

  • A user wants to add a code linting or quality tool (external tool).
  • They authorize it via a Personal Access Token (PAT) or OAuth 2.0.
  • The code quality tool then adds comments to Merge Requests.
  • Currently, these comments appear as if they were made by the user, which is very confusing.
  • We fix this by allowing the bot to declare: "It's me, here is my name" on behalf of user.

Screenshot_2025-02-27_at_11.34.57

Suggested Implementation:

I have created a draft MR that achieves the above and includes the following changes:

  • Migration to add attributed_author_name and attributed_author_email to the note_metadata table (the attributed_author_email is used to retrieve the gravatar icon)
  • Update the discussions API for MRs to accept an optional attributed_author hash
...
  "attributed_author": {
     "name": 'Aikido',
     "email": 'willem@aikido.dev'
  }
  • Update the views to display the attributed_author when applicable

Demo:

Screen_Recording_2025-02-27_at_11.31.08

Edited by Ivane Gkomarteli