Console log followers
This commit is contained in:
parent
cc44d46da7
commit
68eaf23844
|
@ -45,23 +45,24 @@ export async function handleFollow(
|
||||||
|
|
||||||
assert.exists(followerId);
|
assert.exists(followerId);
|
||||||
|
|
||||||
const followee = object;
|
const user = object;
|
||||||
const followeeId = getId(followee);
|
const userId = getId(user);
|
||||||
|
|
||||||
assert.exists(followeeId);
|
assert.exists(userId);
|
||||||
|
|
||||||
if (followeeId.href !== getId(recipient)?.href) {
|
if (userId.href !== getId(recipient)?.href) {
|
||||||
// Not applicable to this Actor.
|
// Not applicable to this Actor.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const followersId = getId(followee.followers);
|
const followersId = getId(user.followers);
|
||||||
|
|
||||||
assert.exists(followersId);
|
assert.exists(followersId);
|
||||||
|
|
||||||
const followers = await this.core.findEntityById(followersId);
|
const followers = await this.core.findEntityById(followersId);
|
||||||
|
|
||||||
assert.isApType<AP.Collection>(followers, AP.CollectionTypes.COLLECTION);
|
assert.isApType<AP.Collection>(followers, AP.CollectionTypes.COLLECTION);
|
||||||
|
console.log({ followers });
|
||||||
assert.isArray(followers.items);
|
assert.isArray(followers.items);
|
||||||
|
|
||||||
// Already a follower.
|
// Already a follower.
|
||||||
|
@ -74,8 +75,8 @@ export async function handleFollow(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (followee.manuallyApprovesFollowers) {
|
if (user.manuallyApprovesFollowers) {
|
||||||
const requests = await this.core.getStreamByName(followee, 'Requests');
|
const requests = await this.core.getStreamByName(user, 'Requests');
|
||||||
|
|
||||||
assert.isApType<AP.Collection>(requests, AP.CollectionTypes.COLLECTION);
|
assert.isApType<AP.Collection>(requests, AP.CollectionTypes.COLLECTION);
|
||||||
|
|
||||||
|
@ -102,20 +103,20 @@ export async function handleFollow(
|
||||||
url: new URL(acceptActivityId),
|
url: new URL(acceptActivityId),
|
||||||
type: AP.ActivityTypes.ACCEPT,
|
type: AP.ActivityTypes.ACCEPT,
|
||||||
to: [new URL(PUBLIC_ACTOR), followerId],
|
to: [new URL(PUBLIC_ACTOR), followerId],
|
||||||
actor: followeeId,
|
actor: userId,
|
||||||
object: activityId,
|
object: activityId,
|
||||||
published: publishedDate,
|
published: publishedDate,
|
||||||
});
|
});
|
||||||
|
|
||||||
const followeeOutboxId = getId(followee.outbox);
|
const userOutboxId = getId(user.outbox);
|
||||||
|
|
||||||
assert.exists(followeeOutboxId);
|
assert.exists(userOutboxId);
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.core.saveEntity(acceptActivity),
|
this.core.saveEntity(acceptActivity),
|
||||||
this.core.insertOrderedItem(followeeOutboxId, new URL(acceptActivityId)),
|
this.core.insertOrderedItem(userOutboxId, new URL(acceptActivityId)),
|
||||||
this.core.insertItem(followersId, followerId),
|
this.core.insertItem(followersId, followerId),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await this.core.broadcast(acceptActivity, followee);
|
await this.core.broadcast(acceptActivity, user);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue