diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-03-08 21:22:50 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2016-05-17 12:17:45 +0300 |
commit | 6b834f2cbcfc26fe3123b6682ed7e20618e31d1b (patch) | |
tree | 0b812d498079fdcaaf0d004a5bce716560b99be0 /app/helpers/todos_helper.rb | |
parent | 78a67fc48dab434b43a080e5b15491963656661a (diff) |
Create a todo on failing MR build
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.
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 |