From 75c9873796d44d9a0cbd9f1d9176c16c190111c9 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sun, 15 Oct 2023 22:26:51 +0200 Subject: [PATCH] [backend] Update user profile mentions on createPerson and updatePerson --- packages/backend/src/remote/activitypub/models/person.ts | 6 ++++++ packages/backend/src/remote/resolve-user.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index d1f988b34..ade7ecf2b 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -386,6 +386,9 @@ export async function createPerson( // Hashtag update updateUsertags(user!, tags); + // Mentions update + await UserProfiles.updateMentions(user!.id); + //#region Fetch avatar and header image const [avatar, banner] = await Promise.all( [person.icon, person.image].map((img) => @@ -603,6 +606,9 @@ export async function updatePerson( // Hashtag Update updateUsertags(user, tags); + // Mentions update + await UserProfiles.updateMentions(user!.id); + // If the user in question is a follower, followers will also be updated. await Followings.update( { diff --git a/packages/backend/src/remote/resolve-user.ts b/packages/backend/src/remote/resolve-user.ts index 9a4068563..94f27977f 100644 --- a/packages/backend/src/remote/resolve-user.ts +++ b/packages/backend/src/remote/resolve-user.ts @@ -102,7 +102,7 @@ export async function resolveUser( return await createPerson(fingerRes.self.href, undefined, subjectHost); } - // If user information is out of date, return it by starting over from WebFilger + // If user information is out of date, return it by starting over from WebFinger if ( refresh && ( user.lastFetchedAt == null ||