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