From 33698c91cccf2821ca5e62007ed8d3914ee009e7 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 10 Sep 2023 09:13:00 +0800 Subject: [PATCH] Add one more account resolver fallback --- src/components/account-sheet.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/account-sheet.jsx b/src/components/account-sheet.jsx index fc21ed95..cf7ccc30 100644 --- a/src/components/account-sheet.jsx +++ b/src/components/account-sheet.jsx @@ -58,6 +58,18 @@ function AccountSheet({ account, instance: propInstance, onClose }) { }); if (result.accounts.length) { return result.accounts[0]; + } else if (/https?:\/\/[^/]+\/@/.test(account)) { + const accountURL = new URL(account); + const acct = accountURL.pathname.replace(/^\//, ''); + const result = await masto.v2.search({ + q: acct, + type: 'accounts', + limit: 1, + resolve: authenticated, + }); + if (result.accounts.length) { + return result.accounts[0]; + } } } } else {