Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose annotation.text_rendered on the authority queue #9413

Merged
merged 1 commit into from
Mar 24, 2025
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
2 changes: 2 additions & 0 deletions h/services/annotation_authority_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def publish(self, event_action: str, annotation_id: str) -> None:
annotation_dict = self._annotation_json_service.present_for_user(
annotation=annotation, user=annotation.slim.user, with_metadata=True
)
# We already done the work to sanitize the text, send that value to the queue
annotation_dict["text_rendered"] = annotation.text_rendered

payload = {
"action": event_action,
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/h/services/annotation_authority_queue_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def test_publish(
annotation,
Connection,
):
annotation_presented = {"id": annotation.id}
annotation_json_service.present_for_user.return_value = annotation_presented
annotation_read_service.get_annotation_by_id.return_value = annotation

svc.publish("create", sentinel.annotation_id)
Expand All @@ -56,6 +58,7 @@ def test_publish(
user=annotation_read_service.get_annotation_by_id.return_value.slim.user,
with_metadata=True,
)
assert annotation_presented["text_rendered"] == annotation.text_rendered
Celery.assert_called_once_with(
annotation_read_service.get_annotation_by_id.return_value.authority,
)
Expand All @@ -67,7 +70,7 @@ def test_publish(
kwargs={
"event": {
"action": "create",
"annotation": annotation_json_service.present_for_user.return_value,
"annotation": annotation_presented,
}
},
)
Expand Down
Loading