From e63934c25b4aa56b774f7cda9d57d233a00ca18b Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Thu, 19 Jan 2017 13:57:46 +0100 Subject: [PATCH] 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. --- rhodecode/model/comment.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/rhodecode/model/comment.py b/rhodecode/model/comment.py index 8dab06b4..f1f1556a 100644 --- 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