Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,20 @@ def test_invalid_comment(app, mocker):
)
},
],
"UnreactCommentNotExisting": [
{
"args": AttributeDict(
{
"_entityId": 1,
"_entityType": "Comment",
"_userId": 1,
"_action": "Unreact",
"_metadata": "",
"_signer": "user1wallet",
}
)
},
],
}

db, index_transaction = setup_test(app, mocker, entities, tx_receipts)
Expand All @@ -269,6 +283,8 @@ def test_invalid_comment(app, mocker):
session.query(Track).filter(Track.pinned_comment_id != None).all()
)
assert len(pinned_comments) == 0
comment_reactions: List[CommentReaction] = session.query(CommentReaction).all()
assert len(comment_reactions) == 0


def test_comment_reply(app, mocker):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,14 @@ def validate_comment_reaction_tx(params: ManageEntityParameters):
raise IndexingValidationError(
f"User {user_id} already reacted to comment {comment_id}"
)
if (
params.action == Action.UNREACT
and (user_id, comment_id)
not in params.existing_records[EntityType.COMMENT_REACTION.value]
):
raise IndexingValidationError(
f"User {user_id} has not reacted to comment {comment_id}"
)


def react_comment(params: ManageEntityParameters):
Expand Down Expand Up @@ -613,7 +621,7 @@ def react_comment(params: ManageEntityParameters):


def unreact_comment(params: ManageEntityParameters):
validate_signer(params)
validate_comment_reaction_tx(params)
comment_id = params.entity_id
user_id = params.user_id

Expand Down