Skip to content

GET endpoint for discussions on commit rapid diffs

What does this MR do and why?

References

#476245 (comment 2756120583)+

How to set up and validate locally

  1. Navigate to the commits page and select an individual commit (preferably one with discussions already(both general comment and diff line comment), or add some comments if they don't exist already)
  2. On the URL, append /discussions at the end
  3. Check that all discussions(both general comments and diff line comments) are rendered and that the response is in the format below:
  • The note with "diff_discussion": true is a diff line comment while "diff_discussion": false is a general comment
{
"discussions": [
  {
        "id": "7acddf8c31516f80d45ff8501ab6b82091e27c5e",
        "reply_id": "7acddf8c31516f80d45ff8501ab6b82091e27c5e",
        "confidential": false,
        "diff_discussion": true,
        "position": {
            "base_sha": "54fcc214b94e78d7a41a9a8fe6d87a5e59500e51",
            "start_sha": "54fcc214b94e78d7a41a9a8fe6d87a5e59500e51",
            "head_sha": "a5391128b0ef5d21df5dd23d98557f4ef12fae20",
            "old_path": "custom-highlighting/test.gitlab-custom",
            "new_path": "custom-highlighting/test.gitlab-custom",
            "position_type": "text",
            "old_line": null,
            "new_line": 3,
            "line_range": null
        },
        "notes": [
            {
                "id": "1182",
                "type": "DiffNote",
                "author": {
                    "id": 1,
                    "username": "root",
                    "public_email": null,
                    "name": "Administrator",
                    "state": "active",
                    "locked": false,
                    "avatar_url": "https://www.gravatar.com/avatar/54b13cc3a73fa1f32c0c133638de391553752d2441c6c923735d02621bad4e8e?s=80\u0026d=identicon",
                    "status_tooltip_html": null,
                    "show_status": false,
                    "availability": null,
                    "path": "/root",
                    "bot": false,
                    "user_type": "human"
                },
                "created_at": "2025-10-06T13:07:47.844Z",
                "updated_at": "2025-10-06T13:07:47.844Z",
                "system": false,
                "confidential": false,
                "internal": false,
                "imported": false,
                "imported_from": "none",
                "note": "First diff line comment",
                "note_html": "\u003cp data-sourcepos=\"1:1-1:23\" dir=\"auto\"\u003eFirst diff line comment\u003c/p\u003e",
                "current_user": {
                    "can_edit": true,
                    "can_award_emoji": true
                },
                "is_noteable_author": false,
                "discussion_id": "7acddf8c31516f80d45ff8501ab6b82091e27c5e",
                "emoji_awardable": true,
                "award_emoji": [],
                "report_abuse_path": "/-/abuse_reports/add_category",
                "noteable_note_url": "http://127.0.0.1:3000/gitlab-org/gitlab-test/-/commit/a5391128b0ef5d21df5dd23d98557f4ef12fae20#note_1182",
                "human_access": "Owner",
                "is_contributor": false,
                "project_name": "Gitlab Test",
                "toggle_award_path": "/gitlab-org/gitlab-test/notes/1182/toggle_award_emoji",
                "path": "/gitlab-org/gitlab-test/notes/1182"
            }
        ]
    },
    {
        "id": "173bd252ac82437cb44df7aeb839de4855316c72",
        "reply_id": "173bd252ac82437cb44df7aeb839de4855316c72",
        "confidential": false,
        "diff_discussion": false,
        "notes": [
            {
                "id": "1184",
                "type": null,
                "author": {
                    "id": 1,
                    "username": "root",
                    "public_email": null,
                    "name": "Administrator",
                    "state": "active",
                    "locked": false,
                    "avatar_url": "https://www.gravatar.com/avatar/54b13cc3a73fa1f32c0c133638de391553752d2441c6c923735d02621bad4e8e?s=80\u0026d=identicon",
                    "status_tooltip_html": null,
                    "show_status": false,
                    "availability": null,
                    "path": "/root",
                    "bot": false,
                    "user_type": "human"
                },
                "created_at": "2025-10-06T13:08:11.036Z",
                "updated_at": "2025-10-06T13:08:17.309Z",
                "system": false,
                "confidential": false,
                "internal": false,
                "imported": false,
                "imported_from": "none",
                "note": "One general comment",
                "note_html": "\u003cp data-sourcepos=\"1:1-1:19\" dir=\"auto\"\u003eOne general comment\u003c/p\u003e",
                "current_user": {
                    "can_edit": true,
                    "can_award_emoji": true
                },
                "is_noteable_author": false,
                "discussion_id": "173bd252ac82437cb44df7aeb839de4855316c72",
                "emoji_awardable": true,
                "award_emoji": [
                    {
                        "name": "laughing",
                        "user": {
                            "id": 1,
                            "username": "root",
                            "public_email": null,
                            "name": "Administrator"
                        }
                    }
                ],
                "report_abuse_path": "/-/abuse_reports/add_category",
                "noteable_note_url": "http://127.0.0.1:3000/gitlab-org/gitlab-test/-/commit/a5391128b0ef5d21df5dd23d98557f4ef12fae20#note_1184",
                "human_access": "Owner",
                "is_contributor": false,
                "project_name": "Gitlab Test",
                "toggle_award_path": "/gitlab-org/gitlab-test/notes/1184/toggle_award_emoji",
                "path": "/gitlab-org/gitlab-test/notes/1184"
            }
        ]
    }
]
}

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Gloria Odipo

Merge request reports

Loading