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.
This commit is contained in:
Lim Chee Aun 2022-12-25 23:31:50 +08:00
parent 3daa7e4f9d
commit 86f38ee3b8
2 changed files with 10 additions and 2 deletions

View file

@ -5,7 +5,7 @@ import states from '../utils/states';
import Avatar from './avatar'; 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; const { acct, avatar, avatarStatic, id, url, displayName, emojis } = account;
let { username } = account; let { username } = account;
@ -31,6 +31,7 @@ function NameText({ account, showAvatar, showAcct, short, external }) {
onClick={(e) => { onClick={(e) => {
if (external) return; if (external) return;
e.preventDefault(); e.preventDefault();
if (onClick) return onClick(e);
states.showAccount = account; states.showAccount = account;
}} }}
> >

View file

@ -5,6 +5,7 @@ import { useRef, useState } from 'preact/hooks';
import Avatar from '../components/avatar'; import Avatar from '../components/avatar';
import Icon from '../components/icon'; import Icon from '../components/icon';
import NameText from '../components/name-text'; import NameText from '../components/name-text';
import states from '../utils/states';
import store from '../utils/store'; import store from '../utils/store';
/* /*
@ -42,7 +43,13 @@ function Settings({ onClose }) {
</span> </span>
)} )}
<Avatar url={account.info.avatarStatic} size="xxl" /> <Avatar url={account.info.avatarStatic} size="xxl" />
<NameText account={account.info} showAcct /> <NameText
account={account.info}
showAcct
onClick={() => {
states.showAccount = `${account.info.username}@${account.instanceURL}`;
}}
/>
</div> </div>
<div class="actions"> <div class="actions">
{isDefault && moreThanOneAccount && ( {isDefault && moreThanOneAccount && (