mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-02 16:45:54 +02:00
Implement unfollow by remote account
This commit is contained in:
23
src/remote/activitypub/act/undo/index.ts
Normal file
23
src/remote/activitypub/act/undo/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import act from '../../act';
|
||||
import unfollow from './unfollow';
|
||||
|
||||
export default async (resolver, actor, activity) => {
|
||||
if ('actor' in activity && actor.account.uri !== activity.actor) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
const results = await act(resolver, actor, activity.object);
|
||||
|
||||
await Promise.all(results.map(async result => {
|
||||
if (result === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (result.object.$ref) {
|
||||
case 'following':
|
||||
await unfollow(result.resolver, result.object);
|
||||
}
|
||||
}));
|
||||
|
||||
return null;
|
||||
};
|
||||
Reference in New Issue
Block a user