diff --git a/backend/grant/comment/models.py b/backend/grant/comment/models.py index 6b41cd7b..4fca9241 100644 --- a/backend/grant/comment/models.py +++ b/backend/grant/comment/models.py @@ -3,7 +3,6 @@ import datetime from functools import reduce from grant.extensions import ma, db from grant.utils.ma_fields import UnixDate -from marshmallow import pre_dump from sqlalchemy.orm import raiseload HIDDEN_CONTENT = '~~comment removed by admin~~' @@ -88,13 +87,6 @@ class CommentSchema(ma.Schema): def get_replies(self, obj): return comments_schema.dump(filter_dead(obj.replies)) - # filter out top-level "dead" comments - @pre_dump(pass_many=True) - def clear_hidden(self, data, many): - if many: - return filter_dead(data) - return data - comment_schema = CommentSchema() comments_schema = CommentSchema(many=True) diff --git a/backend/grant/proposal/views.py b/backend/grant/proposal/views.py index dcc8de77..0f51fbaf 100644 --- a/backend/grant/proposal/views.py +++ b/backend/grant/proposal/views.py @@ -70,7 +70,7 @@ def get_proposal_comments(proposal_id, page, filters, search, sort): filters_workaround = request.args.getlist('filters[]') page = pagination.comment( schema=comments_schema, - query=Comment.query.filter_by(proposal_id=proposal_id, parent_comment_id=None), + query=Comment.query.filter_by(proposal_id=proposal_id, parent_comment_id=None, hidden=False), page=page, filters=filters_workaround, search=search,