mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-24 00:38:49 +01:00
Handle locked accounts
This commit is contained in:
parent
dbfdd6ec68
commit
a71f66dcbd
1 changed files with 15 additions and 5 deletions
|
@ -197,17 +197,19 @@ function Account({ account }) {
|
|||
{relationshipUIState !== 'loading' && relationship && (
|
||||
<button
|
||||
type="button"
|
||||
class={`${following ? 'light' : ''} swap`}
|
||||
data-swap-state={following ? 'danger' : ''}
|
||||
class={`${following || requested ? 'light swap' : ''}`}
|
||||
data-swap-state={following || requested ? 'danger' : ''}
|
||||
disabled={relationshipUIState === 'loading'}
|
||||
onClick={() => {
|
||||
setRelationshipUIState('loading');
|
||||
(async () => {
|
||||
try {
|
||||
let newRelationship;
|
||||
if (following) {
|
||||
if (following || requested) {
|
||||
const yes = confirm(
|
||||
'Are you sure that you want to unfollow this account?',
|
||||
requested
|
||||
? 'Are you sure that you want to withdraw follow request?'
|
||||
: 'Are you sure that you want to unfollow this account?',
|
||||
);
|
||||
if (yes) {
|
||||
newRelationship = await masto.v1.accounts.unfollow(
|
||||
|
@ -231,10 +233,18 @@ function Account({ account }) {
|
|||
<span>Following</span>
|
||||
<span>Unfollow…</span>
|
||||
</>
|
||||
) : requested ? (
|
||||
<>
|
||||
<span>Requested</span>
|
||||
<span>Withdraw…</span>
|
||||
</>
|
||||
) : locked ? (
|
||||
<>
|
||||
<Icon icon="lock" /> <span>Follow</span>
|
||||
</>
|
||||
) : (
|
||||
'Follow'
|
||||
)}
|
||||
{/* {following ? 'Unfollow…' : 'Follow'} */}
|
||||
</button>
|
||||
)}
|
||||
</p>
|
||||
|
|
Loading…
Reference in a new issue