Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Matt Jankowski <matt@jankowski.online> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: GitHub Actions <noreply@github.com>
This commit is contained in:
parent
90f7b90223
commit
24551375cf
1 changed files with 41 additions and 8 deletions
|
@ -11,9 +11,12 @@ import {
|
||||||
unblockAccount,
|
unblockAccount,
|
||||||
muteAccount,
|
muteAccount,
|
||||||
unmuteAccount,
|
unmuteAccount,
|
||||||
|
followAccountSuccess,
|
||||||
} from 'mastodon/actions/accounts';
|
} from 'mastodon/actions/accounts';
|
||||||
|
import { showAlertForError } from 'mastodon/actions/alerts';
|
||||||
import { openModal } from 'mastodon/actions/modal';
|
import { openModal } from 'mastodon/actions/modal';
|
||||||
import { initMuteModal } from 'mastodon/actions/mutes';
|
import { initMuteModal } from 'mastodon/actions/mutes';
|
||||||
|
import { apiFollowAccount } from 'mastodon/api/accounts';
|
||||||
import { Avatar } from 'mastodon/components/avatar';
|
import { Avatar } from 'mastodon/components/avatar';
|
||||||
import { Button } from 'mastodon/components/button';
|
import { Button } from 'mastodon/components/button';
|
||||||
import { FollowersCounter } from 'mastodon/components/counters';
|
import { FollowersCounter } from 'mastodon/components/counters';
|
||||||
|
@ -24,6 +27,7 @@ import { RelativeTimestamp } from 'mastodon/components/relative_timestamp';
|
||||||
import { ShortNumber } from 'mastodon/components/short_number';
|
import { ShortNumber } from 'mastodon/components/short_number';
|
||||||
import { Skeleton } from 'mastodon/components/skeleton';
|
import { Skeleton } from 'mastodon/components/skeleton';
|
||||||
import { VerifiedBadge } from 'mastodon/components/verified_badge';
|
import { VerifiedBadge } from 'mastodon/components/verified_badge';
|
||||||
|
import { me } from 'mastodon/initial_state';
|
||||||
import type { MenuItem } from 'mastodon/models/dropdown_menu';
|
import type { MenuItem } from 'mastodon/models/dropdown_menu';
|
||||||
import { useAppSelector, useAppDispatch } from 'mastodon/store';
|
import { useAppSelector, useAppDispatch } from 'mastodon/store';
|
||||||
|
|
||||||
|
@ -113,14 +117,43 @@ export const Account: React.FC<{
|
||||||
];
|
];
|
||||||
} else if (defaultAction !== 'block') {
|
} else if (defaultAction !== 'block') {
|
||||||
const handleAddToLists = () => {
|
const handleAddToLists = () => {
|
||||||
dispatch(
|
const openAddToListModal = () => {
|
||||||
openModal({
|
dispatch(
|
||||||
modalType: 'LIST_ADDER',
|
openModal({
|
||||||
modalProps: {
|
modalType: 'LIST_ADDER',
|
||||||
accountId: id,
|
modalProps: {
|
||||||
},
|
accountId: id,
|
||||||
}),
|
},
|
||||||
);
|
}),
|
||||||
|
);
|
||||||
|
};
|
||||||
|
if (relationship?.following || relationship?.requested || id === me) {
|
||||||
|
openAddToListModal();
|
||||||
|
} else {
|
||||||
|
dispatch(
|
||||||
|
openModal({
|
||||||
|
modalType: 'CONFIRM_FOLLOW_TO_LIST',
|
||||||
|
modalProps: {
|
||||||
|
accountId: id,
|
||||||
|
onConfirm: () => {
|
||||||
|
apiFollowAccount(id)
|
||||||
|
.then((relationship) => {
|
||||||
|
dispatch(
|
||||||
|
followAccountSuccess({
|
||||||
|
relationship,
|
||||||
|
alreadyFollowing: false,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
openAddToListModal();
|
||||||
|
})
|
||||||
|
.catch((err: unknown) => {
|
||||||
|
dispatch(showAlertForError(err));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
arr = [
|
arr = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue