Commit 441501e4 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Present TODO's list without grouping by project

parent aeb9db67
...@@ -100,8 +100,8 @@ class Commit ...@@ -100,8 +100,8 @@ class Commit
commit_reference(from_project, id, full: full) commit_reference(from_project, id, full: full)
end end
def reference_link_text(from_project = nil) def reference_link_text(from_project = nil, full: false)
commit_reference(from_project, short_id) commit_reference(from_project, short_id, full: full)
end end
def diff_line_count def diff_line_count
......
...@@ -103,9 +103,9 @@ class Todo < ActiveRecord::Base ...@@ -103,9 +103,9 @@ class Todo < ActiveRecord::Base
def target_reference def target_reference
if for_commit? if for_commit?
target.short_id target.reference_link_text(full: true)
else else
target.to_reference target.to_reference(full: true)
end end
end end
......
...@@ -70,15 +70,11 @@ ...@@ -70,15 +70,11 @@
.prepend-top-default .prepend-top-default
- if @todos.any? - if @todos.any?
.js-todos-options{ data: {per_page: @todos.limit_value, current_page: @todos.current_page, total_pages: @todos.total_pages} } .js-todos-options{ data: {per_page: @todos.limit_value, current_page: @todos.current_page, total_pages: @todos.total_pages} }
- @todos.group_by(&:project).each do |group|
.panel.panel-default.panel-small .panel.panel-default.panel-small
- project = group[0]
.panel-heading
= link_to project.name_with_namespace, namespace_project_path(project.namespace, project)
%ul.content-list.todos-list %ul.content-list.todos-list
= render group[1] = render @todos
= paginate @todos, theme: "gitlab" = paginate @todos, theme: "gitlab"
- elsif current_user.todos.any? - elsif current_user.todos.any?
.todos-all-done .todos-all-done
= render "shared/empty_states/todos_all_done.svg" = render "shared/empty_states/todos_all_done.svg"
......
...@@ -25,15 +25,18 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps ...@@ -25,15 +25,18 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
end end
step 'I should see todos assigned to me' do step 'I should see todos assigned to me' do
merge_request_reference = merge_request.to_reference(full: true)
issue_reference = issue.to_reference(full: true)
page.within('.todos-pending-count') { expect(page).to have_content '4' } page.within('.todos-pending-count') { expect(page).to have_content '4' }
expect(page).to have_content 'To do 4' expect(page).to have_content 'To do 4'
expect(page).to have_content 'Done 0' expect(page).to have_content 'Done 0'
expect(page).to have_link project.name_with_namespace expect(page).to have_link project.name_with_namespace
should_see_todo(1, "John Doe assigned you merge request #{merge_request.to_reference}", merge_request.title) should_see_todo(1, "John Doe assigned you merge request #{merge_request_reference}", merge_request.title)
should_see_todo(2, "John Doe mentioned you on issue #{issue.to_reference}", "#{current_user.to_reference} Wdyt?") should_see_todo(2, "John Doe mentioned you on issue #{issue_reference}", "#{current_user.to_reference} Wdyt?")
should_see_todo(3, "John Doe assigned you issue #{issue.to_reference}", issue.title) should_see_todo(3, "John Doe assigned you issue #{issue_reference}", issue.title)
should_see_todo(4, "Mary Jane mentioned you on issue #{issue.to_reference}", issue.title) should_see_todo(4, "Mary Jane mentioned you on issue #{issue_reference}", issue.title)
end end
step 'I mark the todo as done' do step 'I mark the todo as done' do
...@@ -44,10 +47,13 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps ...@@ -44,10 +47,13 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
page.within('.todos-pending-count') { expect(page).to have_content '3' } page.within('.todos-pending-count') { expect(page).to have_content '3' }
expect(page).to have_content 'To do 3' expect(page).to have_content 'To do 3'
expect(page).to have_content 'Done 1' expect(page).to have_content 'Done 1'
should_not_see_todo "John Doe assigned you merge request #{merge_request.to_reference}" should_not_see_todo "John Doe assigned you merge request #{merge_request.to_reference(full: true)}"
end end
step 'I mark all todos as done' do step 'I mark all todos as done' do
merge_request_reference = merge_request.to_reference(full: true)
issue_reference = issue.to_reference(full: true)
click_link 'Mark all as done' click_link 'Mark all as done'
page.within('.todos-pending-count') { expect(page).to have_content '0' } page.within('.todos-pending-count') { expect(page).to have_content '0' }
...@@ -55,27 +61,30 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps ...@@ -55,27 +61,30 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
expect(page).to have_content 'Done 4' expect(page).to have_content 'Done 4'
expect(page).to have_content "You're all done!" expect(page).to have_content "You're all done!"
expect('.prepend-top-default').not_to have_link project.name_with_namespace expect('.prepend-top-default').not_to have_link project.name_with_namespace
should_not_see_todo "John Doe assigned you merge request #{merge_request.to_reference}" should_not_see_todo "John Doe assigned you merge request #{merge_request_reference}"
should_not_see_todo "John Doe mentioned you on issue #{issue.to_reference}" should_not_see_todo "John Doe mentioned you on issue #{issue_reference}"
should_not_see_todo "John Doe assigned you issue #{issue.to_reference}" should_not_see_todo "John Doe assigned you issue #{issue_reference}"
should_not_see_todo "Mary Jane mentioned you on issue #{issue.to_reference}" should_not_see_todo "Mary Jane mentioned you on issue #{issue_reference}"
end end
step 'I should see the todo marked as done' do step 'I should see the todo marked as done' do
click_link 'Done 1' click_link 'Done 1'
expect(page).to have_link project.name_with_namespace expect(page).to have_link project.name_with_namespace
should_see_todo(1, "John Doe assigned you merge request #{merge_request.to_reference}", merge_request.title, false) should_see_todo(1, "John Doe assigned you merge request #{merge_request.to_reference(full: true)}", merge_request.title, false)
end end
step 'I should see all todos marked as done' do step 'I should see all todos marked as done' do
merge_request_reference = merge_request.to_reference(full: true)
issue_reference = issue.to_reference(full: true)
click_link 'Done 4' click_link 'Done 4'
expect(page).to have_link project.name_with_namespace expect(page).to have_link project.name_with_namespace
should_see_todo(1, "John Doe assigned you merge request #{merge_request.to_reference}", merge_request.title, false) should_see_todo(1, "John Doe assigned you merge request #{merge_request_reference}", merge_request.title, false)
should_see_todo(2, "John Doe mentioned you on issue #{issue.to_reference}", "#{current_user.to_reference} Wdyt?", false) should_see_todo(2, "John Doe mentioned you on issue #{issue_reference}", "#{current_user.to_reference} Wdyt?", false)
should_see_todo(3, "John Doe assigned you issue #{issue.to_reference}", issue.title, false) should_see_todo(3, "John Doe assigned you issue #{issue_reference}", issue.title, false)
should_see_todo(4, "Mary Jane mentioned you on issue #{issue.to_reference}", issue.title, false) should_see_todo(4, "Mary Jane mentioned you on issue #{issue_reference}", issue.title, false)
end end
step 'I filter by "Enterprise"' do step 'I filter by "Enterprise"' do
...@@ -111,16 +120,16 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps ...@@ -111,16 +120,16 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
end end
step 'I should not see todos related to "Mary Jane" in the list' do step 'I should not see todos related to "Mary Jane" in the list' do
should_not_see_todo "Mary Jane mentioned you on issue #{issue.to_reference}" should_not_see_todo "Mary Jane mentioned you on issue #{issue.to_reference(full: true)}"
end end
step 'I should not see todos related to "Merge Requests" in the list' do step 'I should not see todos related to "Merge Requests" in the list' do
should_not_see_todo "John Doe assigned you merge request #{merge_request.to_reference}" should_not_see_todo "John Doe assigned you merge request #{merge_request.to_reference(full: true)}"
end end
step 'I should not see todos related to "Assignments" in the list' do step 'I should not see todos related to "Assignments" in the list' do
should_not_see_todo "John Doe assigned you merge request #{merge_request.to_reference}" should_not_see_todo "John Doe assigned you merge request #{merge_request.to_reference(full: true)}"
should_not_see_todo "John Doe assigned you issue #{issue.to_reference}" should_not_see_todo "John Doe assigned you issue #{issue.to_reference(full: true)}"
end end
step 'I click on the todo' do step 'I click on the todo' do
......
...@@ -171,7 +171,7 @@ describe 'Dashboard Todos', feature: true do ...@@ -171,7 +171,7 @@ describe 'Dashboard Todos', feature: true do
it 'links to the pipelines for the merge request' do it 'links to the pipelines for the merge request' do
href = pipelines_namespace_project_merge_request_path(project.namespace, project, todo.target) href = pipelines_namespace_project_merge_request_path(project.namespace, project, todo.target)
expect(page).to have_link "merge request #{todo.target.to_reference}", href expect(page).to have_link "merge request #{todo.target.to_reference(full: true)}", href
end end
end end
end end
......
...@@ -109,7 +109,7 @@ describe Todo, models: true do ...@@ -109,7 +109,7 @@ describe Todo, models: true do
end end
describe '#target_reference' do describe '#target_reference' do
it 'returns the short commit id for commits' do it 'returns commit full reference with short id' do
project = create(:project, :repository) project = create(:project, :repository)
commit = project.commit commit = project.commit
...@@ -117,12 +117,12 @@ describe Todo, models: true do ...@@ -117,12 +117,12 @@ describe Todo, models: true do
subject.target_type = 'Commit' subject.target_type = 'Commit'
subject.commit_id = commit.id subject.commit_id = commit.id
expect(subject.target_reference).to eq commit.short_id expect(subject.target_reference).to eq commit.reference_link_text(full: true)
end end
it 'returns reference for issuables' do it 'returns full reference for issuables' do
subject.target = issue subject.target = issue
expect(subject.target_reference).to eq issue.to_reference expect(subject.target_reference).to eq issue.to_reference(full: true)
end end
end end
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