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.
This commit is contained in:
Marcin Kuzminski 2017-01-19 13:57:46 +01:00
parent 82fd870fe4
commit e63934c25b

View file

@ -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