diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-05-19 21:18:22 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-05-19 21:18:22 +0000 |
commit | 3f6f2bbe14a7b6da59f87918c84617b8a3e4d1f1 (patch) | |
tree | a90fad419c99aa718466832b891b4727d2a20952 /app/helpers/todos_helper.rb | |
parent | 18ef054bc7eb14a7b817af5f66f140f2f3dd4ae6 (diff) | |
parent | 6b834f2cbcfc26fe3123b6682ed7e20618e31d1b (diff) | |
download | gitlab-ce-3f6f2bbe14a7b6da59f87918c84617b8a3e4d1f1.tar.gz |
Merge branch 'create-todo-on-failing-build' into 'master'
Create a todo on failing MR build
Implements #14067. I worked on this with @DouweM (any mistakes are mine).
When a build fails for a commit, create a todo for the author of the merge request that commit is the HEAD of. If the commit isn't the HEAD commit of any MR, don't do anything. If there already is a todo for that user and MR, don't do anything.
Current limitations:
- This isn't configurable by project.
- The author of a merge request might not be the person who pushed the breaking commit.
- I haven't tested this with a working CI setup, just with the unit tests below and by modifying my DB directly.
See merge request !3177
Diffstat (limited to 'app/helpers/todos_helper.rb')
-rw-r--r-- | app/helpers/todos_helper.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 2f066682180..81b9b5d7052 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -11,6 +11,7 @@ module TodosHelper case todo.action when Todo::ASSIGNED then 'assigned you' when Todo::MENTIONED then 'mentioned you on' + when Todo::BUILD_FAILED then 'The build failed for your' end end @@ -28,8 +29,11 @@ module TodosHelper namespace_project_commit_path(todo.project.namespace.becomes(Namespace), todo.project, todo.target, anchor: anchor) else - polymorphic_path([todo.project.namespace.becomes(Namespace), - todo.project, todo.target], anchor: anchor) + path = [todo.project.namespace.becomes(Namespace), todo.project, todo.target] + + path.unshift(:builds) if todo.build_failed? + + polymorphic_path(path, anchor: anchor) end end |