Skip to content

Gitlab comments don't work #113

@eremeevfd

Description

@eremeevfd

WHAT

Hello, excellent project! I'm very excited to use it in gitlab, but unfortunately I can't. Comments can't be posted to any gitlab mr.

WHY

I think that error is here:

return g.Client.Notes.CreateMergeRequestNote(fmt.Sprintf("%s/%s", g.namespace, g.project), mergeRequest, opt, options...)

To be precise error-prone part is this:
fmt.Sprintf("%s/%s", g.namespace, g.project)

sprint here leads to incorrect api url:
https://gitlab.com/api/v4/projects/{namespace}/{project}/merge_requests/{mr}/notes

because gitlab doesn't have namespace and project, only project, so right url should look like this:

https://gitlab.com/api/v4/projects/{project}/merge_requests/{mr}/notes

also it should be mentioned that underlying gitlab client specifies this signature:
https://github.com/xanzy/go-gitlab/blob/41c6472d936a0ce5f919f7eb1afb8dc8ac46247a/notes.go#L477

func (s *NotesService) CreateMergeRequestNote(pid interface{}, mergeRequest int, opt *CreateMergeRequestNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) {

where pid is for project_id

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions