mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 00:43:49 +01:00
[mastodon-client] Also refresh user profile data on /accounts/:id
This commit is contained in:
parent
7c7c6a09a2
commit
34376b0718
@ -1,5 +1,5 @@
|
||||
import { Note } from "@/models/entities/note.js";
|
||||
import { ILocalUser, User } from "@/models/entities/user.js";
|
||||
import { ILocalUser, IRemoteUser, User } from "@/models/entities/user.js";
|
||||
import {
|
||||
Blockings,
|
||||
Followings,
|
||||
@ -42,6 +42,7 @@ import { verifyLink } from "@/services/fetch-rel-me.js";
|
||||
import { MastoApiError } from "@/server/api/mastodon/middleware/catch-errors.js";
|
||||
import { MastoContext } from "@/server/api/mastodon/index.js";
|
||||
import { resolveUser } from "@/remote/resolve-user.js";
|
||||
import { updatePerson } from "@/remote/activitypub/models/person.js";
|
||||
|
||||
export type AccountCache = {
|
||||
locks: AsyncLock;
|
||||
@ -515,9 +516,18 @@ export class UserHelpers {
|
||||
public static async getUserOr404(id: string): Promise<User> {
|
||||
return getUser(id).catch(_ => {
|
||||
throw new MastoApiError(404);
|
||||
}).then(u => {
|
||||
this.updateUserInBackground(u);
|
||||
return u;
|
||||
});
|
||||
}
|
||||
|
||||
public static updateUserInBackground(user: User) {
|
||||
if (Users.isLocalUser(user)) return;
|
||||
// noinspection JSIgnoredPromiseFromCall
|
||||
updatePerson(user.uri!, undefined, undefined, user as IRemoteUser);
|
||||
}
|
||||
|
||||
public static getFreshAccountCache(): AccountCache {
|
||||
return {
|
||||
locks: new AsyncLock(),
|
||||
|
Loading…
Reference in New Issue
Block a user