Skip to content

Commit

Permalink
Update mention json payload
Browse files Browse the repository at this point in the history
  • Loading branch information
mtomilov committed Feb 7, 2025
1 parent a3a53e9 commit 28d8e5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion h/presenters/mention_json.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Any

from h.models import Mention
from h.util.user import format_userid


class MentionJSONPresenter:
Expand All @@ -12,7 +13,10 @@ def __init__(self, mention: Mention):
def asdict(self) -> dict[str, Any]:
return {
"userid": self._mention.user.userid,
"username": self._mention.username,
"original_userid": format_userid(
self._mention.username, self._mention.user.authority
),
"username": self._mention.user.username,
"display_name": self._mention.user.display_name,
"link": self._mention.user.uri,
}
1 change: 1 addition & 0 deletions tests/unit/h/presenters/mention_json_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def test_as_dict(self, user, annotation):

assert data == {
"userid": user.userid,
"original_userid": user.userid,
"username": user.username,
"display_name": user.display_name,
"link": user.uri,
Expand Down

0 comments on commit 28d8e5d

Please sign in to comment.