mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Ensure hidden comments can't be replied to
This commit is contained in:
parent
d0e272e61f
commit
fbd047b8f5
@ -10,7 +10,7 @@
|
||||
"""
|
||||
|
||||
__all__ = ['DocumentNotFoundError', 'SrcdirNotSpecifiedError',
|
||||
'UserNotAuthorizedError']
|
||||
'UserNotAuthorizedError', 'CommentNotAllowedError']
|
||||
|
||||
class DocumentNotFoundError(Exception):
|
||||
pass
|
||||
@ -22,3 +22,7 @@ class SrcdirNotSpecifiedError(Exception):
|
||||
|
||||
class UserNotAuthorizedError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class CommentNotAllowedError(Exception):
|
||||
pass
|
||||
|
@ -81,8 +81,14 @@ def test_comments(support):
|
||||
comment = support.add_comment('First test comment',
|
||||
node_id=str(first_node.id),
|
||||
username='user_one')
|
||||
support.add_comment('Hidden comment', node_id=str(first_node.id),
|
||||
displayed=False)
|
||||
hidden_comment = support.add_comment('Hidden comment',
|
||||
node_id=str(first_node.id),
|
||||
displayed=False)
|
||||
# Make sure that comments can't be added to a comment where
|
||||
# displayed == False, since it could break the algorithm that
|
||||
# converts a nodes comments to a tree.
|
||||
raises(CommentNotAllowedError, support.add_comment, 'Not allowed',
|
||||
parent_id=str(hidden_comment['id']))
|
||||
# Add a displayed and not displayed child to the displayed comment.
|
||||
support.add_comment('Child test comment', parent_id=str(comment['id']),
|
||||
username='user_one')
|
||||
@ -144,6 +150,7 @@ def test_voting(support):
|
||||
comment = data['comments'][0]
|
||||
assert comment['vote'] == 1, '%s != 1' % comment['vote']
|
||||
|
||||
|
||||
@with_support()
|
||||
def test_proposals(support):
|
||||
session = Session()
|
||||
|
Loading…
Reference in New Issue
Block a user