diff --git a/src/components/detail/Profile.tsx b/src/components/detail/Profile.tsx index 94335286..3b6e8dc5 100644 --- a/src/components/detail/Profile.tsx +++ b/src/components/detail/Profile.tsx @@ -34,6 +34,7 @@ const Profile: React.FC = props => { const { formatMessage } = useIntl() const [client, setClient] = useState(null) + const [myself, setMyself] = useState(null) const [account, setAccount] = useState(null) const [server, setServer] = useState(null) const [user, setUser] = useState(null) @@ -59,6 +60,8 @@ const Profile: React.FC = props => { setServer(server) cli = generator(server.sns, server.base_url, account.access_token, 'Fedistar') setClient(cli) + const u = await cli.verifyAccountCredentials() + setMyself(u.data) } else if (router.query.server_id) { const server = await invoke('get_server', { id: parseInt(router.query.server_id.toString()) }) setAccount(null) @@ -231,7 +234,7 @@ const Profile: React.FC = props => { - + = props => { top, onClose, client, + myself, user, relationship, onChange: () => { @@ -320,6 +324,7 @@ type ProfileMenuProps = { top?: number onClose: (delay?: number) => NodeJS.Timeout | void client: MegalodonInterface + myself: Entity.Account user: Entity.Account relationship: Entity.Relationship | null onChange: () => void @@ -327,7 +332,7 @@ type ProfileMenuProps = { } const profileMenu = ( - { className, left, top, onClose, client, user, relationship, onChange, openAddListMember }: ProfileMenuProps, + { className, left, top, onClose, client, myself, user, relationship, onChange, openAddListMember }: ProfileMenuProps, ref: React.RefCallback ): ReactElement => { const domain = domainFromAcct(user.acct) @@ -381,14 +386,14 @@ const profileMenu = ( {relationship && ( <> - + {relationship.muting ? ( ) : ( )} - + {relationship.blocking ? ( ) : ( @@ -402,7 +407,7 @@ const profileMenu = ( {domain && ( <> - + {relationship.domain_blocking ? ( ) : ( @@ -430,6 +435,8 @@ const precision = (num: number): string => { type FollowButtonProps = { relationship: Entity.Relationship + myself: Entity.Account + user: Entity.Account follow: () => Promise unfollow: () => Promise } @@ -444,6 +451,9 @@ const FollowButton: React.FC = props => { if (!props.relationship) { return null } + if (props.user.acct === props.myself.acct) { + return null + } if (props.relationship.following) { return (