feat: reply contexts that show the post (v2.19.0)
Replies to Mastodon posts showed only the server's domain: the page has no h-entry, so nothing was found and the host stood in for the author. - Context sources in order: Bluesky AppView API, microformats, the origin's Mastodon API or this site's GoToSocial instance, OpenGraph - Migration 024: author_handle, photo, photo_alt, source; rows without a source are fetched again once by the webmention worker - Note page: a card with avatar, name, handle, text, image and date; home/tag/likes: "In reply to <author>" with a short quote - Avatars and images saved locally (CSP allows only this site's images); avatar upkeep now covers reply contexts so their avatars aren't removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
22e588377f
commit
62e257e0e0
14 files changed
+1094
-309
No files matched your search
@@ -127,8 +127,8 @@ class MastodonClient:
|
||||
can_edit = True
|
||||
NATIVE = ("favourite", "reblog") # remote_id prefixes for likes/boosts (v2.5.0)
|
||||
|
||||
def find_status(self, url: str) -> Optional[str]:
|
||||
"""Local id of a fediverse post, fetching it if needed; None if the URL isn't one"""
|
||||
def resolve_status(self, url: str) -> Optional[dict]:
|
||||
"""A fediverse post as a Mastodon status, fetching it if needed; None if the URL isn't one"""
|
||||
try:
|
||||
response = self._call("GET", "/api/v2/search", params={
|
||||
"q": url, "resolve": "true", "type": "statuses", "limit": 1,
|
||||
@@ -136,7 +136,12 @@ class MastodonClient:
|
||||
except RemoteGone:
|
||||
return None
|
||||
statuses = response.json().get("statuses") or []
|
||||
return statuses[0]["id"] if statuses else None
|
||||
return statuses[0] if statuses else None
|
||||
|
||||
def find_status(self, url: str) -> Optional[str]:
|
||||
"""Local id of a fediverse post, fetching it if needed; None if the URL isn't one"""
|
||||
status = self.resolve_status(url)
|
||||
return status["id"] if status else None
|
||||
|
||||
def _prepare(self, post: "Post") -> tuple:
|
||||
if post.kind == "repost":
|
||||
|
||||
Reference in new issue
Block a user