From 86f38ee3b864dbb9b339476394dbdbce84725902 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 25 Dec 2022 23:31:50 +0800 Subject: [PATCH] Fix Account sheet relationship check not working when clicking from Settings page This is because accounts from different instances have different IDs! They're NOT unique cross-instance. So while on one instance, cannot use the account ID of the other instance to query for relationship because the ID doesn't exist on *current* instance. --- src/components/name-text.jsx | 3 ++- src/pages/settings.jsx | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/name-text.jsx b/src/components/name-text.jsx index 8971ce55..b4dafee1 100644 --- a/src/components/name-text.jsx +++ b/src/components/name-text.jsx @@ -5,7 +5,7 @@ import states from '../utils/states'; import Avatar from './avatar'; -function NameText({ account, showAvatar, showAcct, short, external }) { +function NameText({ account, showAvatar, showAcct, short, external, onClick }) { const { acct, avatar, avatarStatic, id, url, displayName, emojis } = account; let { username } = account; @@ -31,6 +31,7 @@ function NameText({ account, showAvatar, showAcct, short, external }) { onClick={(e) => { if (external) return; e.preventDefault(); + if (onClick) return onClick(e); states.showAccount = account; }} > diff --git a/src/pages/settings.jsx b/src/pages/settings.jsx index acd1acca..a3582474 100644 --- a/src/pages/settings.jsx +++ b/src/pages/settings.jsx @@ -5,6 +5,7 @@ import { useRef, useState } from 'preact/hooks'; import Avatar from '../components/avatar'; import Icon from '../components/icon'; import NameText from '../components/name-text'; +import states from '../utils/states'; import store from '../utils/store'; /* @@ -42,7 +43,13 @@ function Settings({ onClose }) { )} - + { + states.showAccount = `${account.info.username}@${account.instanceURL}`; + }} + />
{isDefault && moreThanOneAccount && (