From 0a686d7ab4d0a591ae1fe0f93193b7c7a41316b9 Mon Sep 17 00:00:00 2001 From: svemagie <869694+svemagie@users.noreply.github.com> Date: Sun, 22 Mar 2026 20:28:12 +0100 Subject: [PATCH] fix: support plain-object collections in resolveAuthor (Mastodon Client API like/reblog) resolveAuthor() called collections.get("ap_timeline") assuming a Map, but the Mastodon Client API passes collections as a plain object (req.app.locals.mastodonCollections). This caused "collection.get is not a function" on every favourite/reblog action from Mastodon clients (Phanpy, Elk, etc.). Now checks typeof collections.get before deciding which access pattern to use. Co-Authored-By: Claude Sonnet 4.6 --- lib/resolve-author.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/resolve-author.js b/lib/resolve-author.js index 051a5ef..cfdd9f6 100644 --- a/lib/resolve-author.js +++ b/lib/resolve-author.js @@ -92,8 +92,8 @@ export async function resolveAuthor( // Strategy 2: Use author URL from timeline or notifications if (collections) { - const ap_timeline = collections.get("ap_timeline"); - const ap_notifications = collections.get("ap_notifications"); + const ap_timeline = typeof collections.get === "function" ? collections.get("ap_timeline") : collections.ap_timeline; + const ap_notifications = typeof collections.get === "function" ? collections.get("ap_notifications") : collections.ap_notifications; // Search timeline by both uid (canonical) and url (display) let authorUrl = null;