Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d957d5f1
Commit
d957d5f1
authored
Jul 11, 2016
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add approval required todos
parent
eac0433f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
7 deletions
+14
-7
app/finders/todos_finder.rb
app/finders/todos_finder.rb
+1
-1
app/helpers/todos_helper.rb
app/helpers/todos_helper.rb
+1
-0
app/models/todo.rb
app/models/todo.rb
+7
-5
doc/api/todos.md
doc/api/todos.md
+1
-1
spec/factories/todos.rb
spec/factories/todos.rb
+4
-0
No files found.
app/finders/todos_finder.rb
View file @
d957d5f1
...
...
@@ -37,7 +37,7 @@ class TodosFinder
private
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
def
action_id
...
...
app/helpers/todos_helper.rb
View file @
d957d5f1
...
...
@@ -13,6 +13,7 @@ module TodosHelper
when
Todo
::
MENTIONED
then
'mentioned you on'
when
Todo
::
BUILD_FAILED
then
'The build failed for your'
when
Todo
::
MARKED
then
'added a todo for'
when
Todo
::
APPROVAL_REQUIRED
then
'set you as an approver for'
end
end
...
...
app/models/todo.rb
View file @
d957d5f1
class
Todo
<
ActiveRecord
::
Base
ASSIGNED
=
1
MENTIONED
=
2
BUILD_FAILED
=
3
MARKED
=
4
ASSIGNED
=
1
MENTIONED
=
2
BUILD_FAILED
=
3
MARKED
=
4
APPROVAL_REQUIRED
=
5
# This is an EE-only feature
ACTION_NAMES
=
{
ASSIGNED
=>
:assigned
,
MENTIONED
=>
:mentioned
,
BUILD_FAILED
=>
:build_failed
,
MARKED
=>
:marked
MARKED
=>
:marked
,
APPROVAL_REQUIRED
=>
:approval_required
}
belongs_to
:author
,
class_name:
"User"
...
...
doc/api/todos.md
View file @
d957d5f1
...
...
@@ -15,7 +15,7 @@ Parameters:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
|
`action`
| string | no | The action to be filtered. Can be
`assigned`
,
`mentioned`
,
`build_failed`
,
or
`mark
ed`
. |
|
`action`
| string | no | The action to be filtered. Can be
`assigned`
,
`mentioned`
,
`build_failed`
,
`marked`
, or
`approval_requir
ed`
. |
|
`author_id`
| integer | no | The ID of an author |
|
`project_id`
| integer | no | The ID of a project |
|
`state`
| string | no | The state of the todo. Can be either
`pending`
or
`done`
|
...
...
spec/factories/todos.rb
View file @
d957d5f1
...
...
@@ -23,6 +23,10 @@ FactoryGirl.define do
action
{
Todo
::
BUILD_FAILED
}
end
trait
:approval_required
do
action
{
Todo
::
APPROVAL_REQUIRED
}
end
trait
:done
do
state
:done
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment