Ensure we don't show TODOS for projects pending delete

By joining the Todos on the project table.
This commit is contained in:
DJ Mountney 2016-05-25 18:52:10 -07:00
parent ab75b21c83
commit c3e923c496
2 changed files with 14 additions and 1 deletions

View file

@ -23,7 +23,7 @@ class TodosFinder
end end
def execute def execute
items = current_user.todos items = current_user.todos.joins(:project).where(projects: { pending_delete: false })
items = by_action_id(items) items = by_action_id(items)
items = by_author(items) items = by_author(items)
items = by_project(items) items = by_project(items)

View file

@ -98,5 +98,18 @@ describe 'Dashboard Todos', feature: true do
end end
end end
end end
context 'User has a Todo in a project pending deletion' do
before do
deleted_project = create(:project, pending_delete: true)
create(:todo, :mentioned, user: user, project: deleted_project, target: issue, author: author)
login_as(user)
visit dashboard_todos_path
end
it 'shows "All done" message' do
expect(page).to have_content "You're all done!"
end
end
end end
end end