Reformatted code and added import to resolve PyCharm warnings
This commit is contained in:
parent
3904c188ac
commit
8a19efe7a7
@ -13,7 +13,7 @@ from pillar import current_app, shortcodes
|
|||||||
from pillar.api.nodes.custom.comment import patch_comment
|
from pillar.api.nodes.custom.comment import patch_comment
|
||||||
from pillar.api.utils import jsonify, gravatar
|
from pillar.api.utils import jsonify, gravatar
|
||||||
from pillar.auth import current_user
|
from pillar.auth import current_user
|
||||||
|
import pillar.markdown
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -79,7 +79,8 @@ class CommentTreeBuilder:
|
|||||||
self.nbr_of_Comments: int = 0
|
self.nbr_of_Comments: int = 0
|
||||||
|
|
||||||
def build(self) -> CommentTreeDO:
|
def build(self) -> CommentTreeDO:
|
||||||
enriched_comments = self.child_comments(self.node_id,
|
enriched_comments = self.child_comments(
|
||||||
|
self.node_id,
|
||||||
sort={'properties.rating_positive': pymongo.DESCENDING,
|
sort={'properties.rating_positive': pymongo.DESCENDING,
|
||||||
'_created': pymongo.DESCENDING})
|
'_created': pymongo.DESCENDING})
|
||||||
project_id = self.get_project_id()
|
project_id = self.get_project_id()
|
||||||
@ -181,7 +182,10 @@ def find_node_or_raise(node_id, *args):
|
|||||||
return node_to_comment
|
return node_to_comment
|
||||||
|
|
||||||
|
|
||||||
def patch_node_comment(parent_id: bson.ObjectId, comment_id: bson.ObjectId, markdown_msg: str, attachments: dict):
|
def patch_node_comment(parent_id: bson.ObjectId,
|
||||||
|
comment_id: bson.ObjectId,
|
||||||
|
markdown_msg: str,
|
||||||
|
attachments: dict):
|
||||||
_, _ = find_parent_and_comment_or_raise(parent_id, comment_id)
|
_, _ = find_parent_and_comment_or_raise(parent_id, comment_id)
|
||||||
|
|
||||||
patch = dict(
|
patch = dict(
|
||||||
@ -214,10 +218,9 @@ def find_parent_and_comment_or_raise(parent_id, comment_id):
|
|||||||
|
|
||||||
def validate_comment_parent_relation(comment, parent):
|
def validate_comment_parent_relation(comment, parent):
|
||||||
if comment['parent'] != parent['_id']:
|
if comment['parent'] != parent['_id']:
|
||||||
log.warning('User %s tried to update comment with bad parent/comment pair. parent_id: %s comment_id: %s',
|
log.warning('User %s tried to update comment with bad parent/comment pair.'
|
||||||
current_user.objectid,
|
' parent_id: %s comment_id: %s',
|
||||||
parent['_id'],
|
current_user.objectid, parent['_id'], comment['_id'])
|
||||||
comment['_id'])
|
|
||||||
raise wz_exceptions.BadRequest()
|
raise wz_exceptions.BadRequest()
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,7 +32,8 @@
|
|||||||
user-select: none
|
user-select: none
|
||||||
position: relative
|
position: relative
|
||||||
|
|
||||||
img.gravatar
|
img.user-avatar
|
||||||
|
border-radius: 4px
|
||||||
height: 28px
|
height: 28px
|
||||||
position: relative
|
position: relative
|
||||||
width: 28px
|
width: 28px
|
||||||
|
Loading…
x
Reference in New Issue
Block a user