···
import { BskyAgent } from "@atproto/api";
const [unfollowNotice, setUnfollowNotice] = createSignal("");
7
-
let unfollowURIs: number[] = [];
7
+
let unfollowURIsIndexes: number[] = [];
let followRecords: any[];
const fetchFollows = async (agent: any) => {
···
49
-
if (unfollowURIs.length == 0 || preview) {
50
-
if (preview) unfollowURIs = [];
49
+
if (unfollowURIsIndexes.length == 0 || preview) {
50
+
if (preview) unfollowURIsIndexes = [];
followRecords = await fetchFollows(agent);
let followsDID: string[] = [];
···
for (let i = 0; i < res.data.profiles.length; i++) {
tmpDID[i] = res.data.profiles[i].did;
if (res.data.profiles[i].viewer?.blockedBy) {
66
-
unfollowURIs.push(i + n);
67
-
//await agent.deleteFollow(followRecords[i + n].uri);
66
+
unfollowURIsIndexes.push(i + n);
"Found blocked account: " +
···
for (let i = 0; i < res.data.profiles.length; i++) {
if (!tmpDID.includes(followsDID[i + n])) {
80
-
unfollowURIs.push(i + n);
81
-
//await agent.deleteFollow(followRecords[i + n].uri);
79
+
unfollowURIsIndexes.push(i + n);
"Found deleted account: " +
···
94
-
for (const i of unfollowURIs) {
92
+
for (const i of unfollowURIsIndexes) {
await agent.deleteFollow(followRecords[i].uri);
···
101
+
unfollowURIsIndexes = [];