diff options
-rw-r--r-- | app/models/commit.rb | 4 | ||||
-rw-r--r-- | app/models/todo.rb | 4 | ||||
-rw-r--r-- | app/views/dashboard/todos/index.html.haml | 8 | ||||
-rw-r--r-- | features/steps/dashboard/todos.rb | 45 | ||||
-rw-r--r-- | spec/features/todos/todos_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/todo_spec.rb | 8 |
6 files changed, 38 insertions, 33 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index 316bd2e512b..46f06733da1 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -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 diff --git a/app/models/todo.rb b/app/models/todo.rb index 4c99aa0d3be..2adf494ce11 100644 --- a/app/models/todo.rb +++ b/app/models/todo.rb @@ -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 diff --git a/app/views/dashboard/todos/index.html.haml b/app/views/dashboard/todos/index.html.haml index f4efcfb27b2..0b471f142d0 100644 --- a/app/views/dashboard/todos/index.html.haml +++ b/app/views/dashboard/todos/index.html.haml @@ -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" diff --git a/features/steps/dashboard/todos.rb b/features/steps/dashboard/todos.rb index 344b6fda9a6..2bbc43b491f 100644 --- a/features/steps/dashboard/todos.rb +++ b/features/steps/dashboard/todos.rb @@ -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 diff --git a/spec/features/todos/todos_spec.rb b/spec/features/todos/todos_spec.rb index 3850e930b6d..1b352be9331 100644 --- a/spec/features/todos/todos_spec.rb +++ b/spec/features/todos/todos_spec.rb @@ -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 diff --git a/spec/models/todo_spec.rb b/spec/models/todo_spec.rb index 8017d1c3324..581305ad39f 100644 --- a/spec/models/todo_spec.rb +++ b/spec/models/todo_spec.rb @@ -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 |