Create issue note only with quick actions returns 404

Summary

I tried using the new time tracking feature and whenever I do a POST /projects/:project_id/issues/:issue_id/notes with {"body": "/spend 10m"} I get

{
  "message": "404 Note {:note=>[\"can't be blank\"]} Not Found"
}

Steps to reproduce

Do a POST /projects/:project_id/issues/:issue_id/notes with {"body": "/spend 10m"}.

Expected behavior

It should return a 201 or a message saying that X time was tracked.

Actual behavior

The response body is {"message": "404 Note {:note=>[\"can't be blank\"]} Not Found"}.

Relevant logs and/or screenshots

https://www.dropbox.com/s/f2o9ntaj9od1ac7/Screenshot%202016-12-14%2015.35.25.png?dl=0

Output of checks

This happens on the GitLab API.

Possible fixes

The problem is that you verify if the note is valid: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/api/notes.rb#L86 , but in your code if the note contains only a slash command you don't create the note anymore, extract the slash command, execute it and empty the note body. Hence due to the note model validation the note.valid? fails.

Another fix would be to actually add a separate endpoint for tracking time to an issue. It's not reliable to do it via the issue body or notes.

Possible endpoint: POST /projects/:project_id/issues/:issue_id/time_entries

Edited Jul 20, 2017 by Rémy Coutable
Assignee Loading
Time tracking Loading