// MRCreateNote adds a note to a merge request on GitLab
MRCreateNote adds a note to a merge request on GitLab
// MRCreateNote adds a note to a merge request on GitLab
func MRCreateNote(project string, discussionId string, mrNum int, opts *gitlab.CreateMergeRequestNoteOptions) (string, error) {
	p, err := FindProject(project)
	if err != nil {
		return "", err
	}
	var note *gitlab.Note
	if discussionId == "" {
		note, _, err = lab.Notes.CreateMergeRequestNote(p.ID, mrNum, opts)
	} else {
		dopts := gitlab.AddMergeRequestDiscussionNoteOptions{
			Body: opts.Body,
		}
		note, _, err = lab.Discussions.AddMergeRequestDiscussionNote(p.ID, mrNum, discussionId, &dopts)
	}
	if err != nil {
		return "", err
	}
	return fmt.Sprintf("%s/merge_requests/%d#note_%d", p.WebURL, note.NoteableIID, note.ID), nil
}
func MRCreateNote ( project string , discussionId string , mrNum int , opts * gitlab . CreateMergeRequestNoteOptions ) ( string , error ) { p , err := FindProject ( project ) if err != nil { return " " , err } var note * gitlab . Note if discussionId == " " { note , _ , err = lab . Notes . CreateMergeRequestNote ( p . ID , mrNum , opts ) } else { dopts := gitlab . AddMergeRequestDiscussionNoteOptions { Body : opts . Body , } note , _ , err = lab . Discussions . AddMergeRequestDiscussionNote ( p . ID , mrNum , discussionId , & dopts ) } if err != nil { return " " , err } return fmt . Sprintf ( " " , p . WebURL , note . NoteableIID , note . ID ) , nil }
MRCreateNote adds a note to a merge request on GitLab
MRCreateNote adds a note to a merge request on GitLab
// Unlike MR, Note has no WebURL property, so we have to create it // ourselves from the project, noteable id and note id