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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
9f6299c4
Commit
9f6299c4
authored
Mar 16, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '29534-todos-performance' into 'master'
Improve TODOs performance See merge request !10004
parents
8f92de7b
398a70f3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
app/helpers/todos_helper.rb
app/helpers/todos_helper.rb
+1
-2
spec/helpers/todos_helper_spec.rb
spec/helpers/todos_helper_spec.rb
+23
-0
No files found.
app/helpers/todos_helper.rb
View file @
9f6299c4
...
...
@@ -99,8 +99,7 @@ module TodosHelper
end
def
todo_projects_options
projects
=
current_user
.
authorized_projects
.
sorted_by_activity
.
non_archived
projects
=
projects
.
includes
(
:namespace
)
projects
=
current_user
.
authorized_projects
.
sorted_by_activity
.
non_archived
.
with_route
projects
=
projects
.
map
do
|
project
|
{
id:
project
.
id
,
text:
project
.
name_with_namespace
}
...
...
spec/helpers/todos_helper_spec.rb
0 → 100644
View file @
9f6299c4
require
"spec_helper"
describe
TodosHelper
do
describe
'#todo_projects_options'
do
let
(
:projects
)
{
create_list
(
:empty_project
,
3
)
}
let
(
:user
)
{
create
(
:user
)
}
it
'returns users authorised projects in json format'
do
projects
.
first
.
add_developer
(
user
)
projects
.
second
.
add_developer
(
user
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
expected_results
=
[
{
'id'
=>
''
,
'text'
=>
'Any Project'
},
{
'id'
=>
projects
.
second
.
id
,
'text'
=>
projects
.
second
.
name_with_namespace
},
{
'id'
=>
projects
.
first
.
id
,
'text'
=>
projects
.
first
.
name_with_namespace
}
]
expect
(
JSON
.
parse
(
helper
.
todo_projects_options
)).
to
match_array
(
expected_results
)
end
end
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