# HG changeset patch # User Marcin Kuzminski # Date 2017-01-19 12:57:46 # Node ID 44fc3039d038c52e16a1eb0a479861751f80825a # Parent 611f8936964bafc382222216daace62927d48ed9 todos: all todos needs to be resolved for merge to happen. This will prevent the outdated todos beeing automatically marked as solved becuase of bigger diff changes. It's better to mark commits quickly as resolved instead of potentially have unresolved todos hidden because of invlidation logic. diff --git a/rhodecode/model/comment.py b/rhodecode/model/comment.py --- a/rhodecode/model/comment.py +++ b/rhodecode/model/comment.py @@ -129,15 +129,20 @@ class CommentsModel(BaseModel): return comment_versions - def get_unresolved_todos(self, pull_request): + def get_unresolved_todos(self, pull_request, show_outdated=True): todos = Session().query(ChangesetComment) \ .filter(ChangesetComment.pull_request == pull_request) \ .filter(ChangesetComment.resolved_by == None) \ .filter(ChangesetComment.comment_type - == ChangesetComment.COMMENT_TYPE_TODO) \ - .filter(coalesce(ChangesetComment.display_state, '') != - ChangesetComment.COMMENT_OUTDATED).all() + == ChangesetComment.COMMENT_TYPE_TODO) + + if not show_outdated: + todos = todos.filter( + coalesce(ChangesetComment.display_state, '') != + ChangesetComment.COMMENT_OUTDATED) + + todos = todos.all() return todos