From ddd803e1daa7c1e6256ae5fcf8b850b0c8baf4b4 Mon Sep 17 00:00:00 2001 From: Fabien O'Carroll Date: Wed, 15 May 2024 13:13:25 +0700 Subject: [PATCH] Fixed usernames in Following list This is a temporary solution whilst we only support Ghost2Ghost --- ghost/ghost/src/core/activitypub/actor.entity.test.ts | 1 + ghost/ghost/src/core/activitypub/actor.entity.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ghost/ghost/src/core/activitypub/actor.entity.test.ts b/ghost/ghost/src/core/activitypub/actor.entity.test.ts index ab4564ef4c..87d5db6c3c 100644 --- a/ghost/ghost/src/core/activitypub/actor.entity.test.ts +++ b/ghost/ghost/src/core/activitypub/actor.entity.test.ts @@ -175,6 +175,7 @@ describe('Actor', function () { await actor.postToInbox(activity); assert(actor.following.find(follower => follower.id.href === newFollower.href)); + assert(actor.following.find(follower => follower.username === '@index@activitypub.server')); }); }); diff --git a/ghost/ghost/src/core/activitypub/actor.entity.ts b/ghost/ghost/src/core/activitypub/actor.entity.ts index 35ecb98175..f3f5992bef 100644 --- a/ghost/ghost/src/core/activitypub/actor.entity.ts +++ b/ghost/ghost/src/core/activitypub/actor.entity.ts @@ -69,7 +69,10 @@ export class Actor extends Entity { } if (activity.type === 'Accept') { // TODO: Check that the Accept is for a real Follow activity - this.attr.following.push(activity.getObject()); + this.attr.following.push({ + id: activity.actorId, + username: `@index@${activity.actorId.hostname}` + }); } }