Remove 'project_hidden' state

Compute it using project/context state

Notable change:
todo.hidden? now also returns true if the todo is completed
This commit is contained in:
Carsten Otto 2016-01-24 00:52:23 +01:00
parent 543f49ed8a
commit ed3bca22a4
12 changed files with 66 additions and 106 deletions

View file

@ -99,8 +99,7 @@ class TodosController < ApplicationController
@todo.add_predecessor_list(p.predecessor_list)
@saved = @todo.save
@todo.tag_with(tag_list) if @saved && tag_list.present?
@todo.update_state_from_project if @saved
@todo.block! if @todo.should_be_blocked?
@todo.block! if @todo.uncompleted_predecessors?
else
@saved = false
end
@ -448,7 +447,9 @@ class TodosController < ApplicationController
@todo.reload # refresh context and project object too (not only their id's)
update_dependency_state
update_todo_state_if_project_changed
if @project_changed
@remaining_undone_in_project = current_user.projects.find(@original_item_project_id).todos.active.count if source_view_is :project
end
determine_changes_by_this_update
determine_remaining_in_container_count( (@context_changed || @project_changed) ? @original_item : @todo)
@ -588,7 +589,7 @@ class TodosController < ApplicationController
respond_to do |format|
format.html do
init_not_done_counts
init_project_hidden_todo_counts
init_hidden_todo_counts
init_data_for_sidebar unless mobile?
end
format.m
@ -1189,12 +1190,6 @@ end
end
end
def update_todo_state_if_project_changed
if @project_changed
@todo.update_state_from_project
@remaining_undone_in_project = current_user.projects.find(@original_item_project_id).todos.active.count if source_view_is :project
end
end
def update_context
@context_changed = false