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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
16970d07
Commit
16970d07
authored
Jun 09, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Returns created todos to control rather than re-query
parent
8abd7b35
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
app/controllers/projects/todos_controller.rb
app/controllers/projects/todos_controller.rb
+2
-2
app/services/todo_service.rb
app/services/todo_service.rb
+1
-1
app/views/layouts/header/_default.html.haml
app/views/layouts/header/_default.html.haml
+1
-1
No files found.
app/controllers/projects/todos_controller.rb
View file @
16970d07
class
Projects::TodosController
<
Projects
::
ApplicationController
def
create
TodoService
.
new
.
mark_todo
(
issuable
,
current_user
)
todos
=
TodoService
.
new
.
mark_todo
(
issuable
,
current_user
)
render
json:
{
todo:
current_user
.
todos
.
find_by
(
state: :pending
,
action:
Todo
::
MARKED
,
target_id:
issuable
.
id
)
,
todo:
todos
,
count:
current_user
.
todos
.
pending
.
count
,
}
end
...
...
app/services/todo_service.rb
View file @
16970d07
...
...
@@ -148,7 +148,7 @@ class TodoService
private
def
create_todos
(
users
,
attributes
)
Array
(
users
).
each
do
|
user
|
Array
(
users
).
map
do
|
user
|
next
if
pending_todos
(
user
,
attributes
).
exists?
Todo
.
create
(
attributes
.
merge
(
user_id:
user
.
id
))
end
...
...
app/views/layouts/header/_default.html.haml
View file @
16970d07
...
...
@@ -27,7 +27,7 @@
%li
=
link_to
dashboard_todos_path
,
title:
'Todos'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
icon
(
'bell fw'
)
%span
.badge.todos-pending-count
{
class:
(
"hidden"
if
todos_pending_count
==
0
)}
%span
.badge.todos-pending-count
{
class:
(
"hidden"
if
todos_pending_count
==
0
)
}
=
todos_pending_count
-
if
current_user
.
can_create_project?
%li
...
...
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