From f53fa96fc6d4c34ffdf2d58fad3efd862647d1d7 Mon Sep 17 00:00:00 2001 From: Namekuji Date: Fri, 30 Jun 2023 18:35:05 -0400 Subject: [PATCH] refactor: no url instantiation --- packages/backend/src/services/note/create.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/services/note/create.ts b/packages/backend/src/services/note/create.ts index dd08aca41d..369b3e4f77 100644 --- a/packages/backend/src/services/note/create.ts +++ b/packages/backend/src/services/note/create.ts @@ -461,16 +461,16 @@ export default async ( } if (!dontFederateInitially) { - if (!note.userHost) { + if (Users.isLocalUser(user)) { // Publish if the post is local publishNotesStream(note); } else { const relays = await getCachedRelays(); // Some relays (e.g., aode-relay) deliver posts by boosting them as // Announce activities. In that case, user is the relay's actor. - const boostedByRelay = relays - .map((relay) => new URL(relay.inbox).host) - .includes(note.userHost); + const boostedByRelay = + !!user.inbox && + relays.map((relay) => relay.inbox).includes(user.inbox); if (boostedByRelay && data.renote && data.renote.userHost) { /* A relay boosted a remote post. */