Commit 33b4fc31 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'approval-required-todo' into 'master'

Add approval required todos

Ports the 'approval required' todo type from EE - https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/547

See merge request !5217
parents 7937014e d957d5f1
...@@ -37,7 +37,7 @@ class TodosFinder ...@@ -37,7 +37,7 @@ class TodosFinder
private private
def action_id? def action_id?
action_id.present? && [Todo::ASSIGNED, Todo::MENTIONED, Todo::BUILD_FAILED, Todo::MARKED].include?(action_id.to_i) action_id.present? && Todo::ACTION_NAMES.has_key?(action_id.to_i)
end end
def action_id def action_id
......
...@@ -13,6 +13,7 @@ module TodosHelper ...@@ -13,6 +13,7 @@ module TodosHelper
when Todo::MENTIONED then 'mentioned you on' when Todo::MENTIONED then 'mentioned you on'
when Todo::BUILD_FAILED then 'The build failed for your' when Todo::BUILD_FAILED then 'The build failed for your'
when Todo::MARKED then 'added a todo for' when Todo::MARKED then 'added a todo for'
when Todo::APPROVAL_REQUIRED then 'set you as an approver for'
end end
end end
......
...@@ -3,12 +3,14 @@ class Todo < ActiveRecord::Base ...@@ -3,12 +3,14 @@ class Todo < ActiveRecord::Base
MENTIONED = 2 MENTIONED = 2
BUILD_FAILED = 3 BUILD_FAILED = 3
MARKED = 4 MARKED = 4
APPROVAL_REQUIRED = 5 # This is an EE-only feature
ACTION_NAMES = { ACTION_NAMES = {
ASSIGNED => :assigned, ASSIGNED => :assigned,
MENTIONED => :mentioned, MENTIONED => :mentioned,
BUILD_FAILED => :build_failed, BUILD_FAILED => :build_failed,
MARKED => :marked MARKED => :marked,
APPROVAL_REQUIRED => :approval_required
} }
belongs_to :author, class_name: "User" belongs_to :author, class_name: "User"
......
...@@ -15,7 +15,7 @@ Parameters: ...@@ -15,7 +15,7 @@ Parameters:
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- | | --------- | ---- | -------- | ----------- |
| `action` | string | no | The action to be filtered. Can be `assigned`, `mentioned`, `build_failed`, or `marked`. | | `action` | string | no | The action to be filtered. Can be `assigned`, `mentioned`, `build_failed`, `marked`, or `approval_required`. |
| `author_id` | integer | no | The ID of an author | | `author_id` | integer | no | The ID of an author |
| `project_id` | integer | no | The ID of a project | | `project_id` | integer | no | The ID of a project |
| `state` | string | no | The state of the todo. Can be either `pending` or `done` | | `state` | string | no | The state of the todo. Can be either `pending` or `done` |
......
...@@ -23,6 +23,10 @@ FactoryGirl.define do ...@@ -23,6 +23,10 @@ FactoryGirl.define do
action { Todo::BUILD_FAILED } action { Todo::BUILD_FAILED }
end end
trait :approval_required do
action { Todo::APPROVAL_REQUIRED }
end
trait :done do trait :done do
state :done state :done
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment