fix cache sync after populating user's banner

This commit is contained in:
Hazelnoot 2025-09-17 11:55:08 -04:00
parent 09de5dff44
commit 3c64fbc9a5

View file

@ -594,10 +594,8 @@ export class ApPersonService implements OnModuleInit {
try { try {
const updates = await this.resolveAvatarAndBanner(user, person.icon, person.image, person.backgroundUrl); const updates = await this.resolveAvatarAndBanner(user, person.icon, person.image, person.backgroundUrl);
await this.usersRepository.update(user.id, updates); await this.usersRepository.update(user.id, updates);
await this.internalEventService.emit('remoteUserUpdated', { id: user.id });
user = { ...user, ...updates }; user = { ...user, ...updates };
// Register to the cache
await this.uriPersonCache.set(user.uri, user.id);
} catch (err) { } catch (err) {
// Permanent error implies hidden or inaccessible, which is a normal thing. // Permanent error implies hidden or inaccessible, which is a normal thing.
if (isRetryableError(err)) { if (isRetryableError(err)) {
@ -1013,6 +1011,7 @@ export class ApPersonService implements OnModuleInit {
let dst = await this.fetchPerson(src.movedToUri); let dst = await this.fetchPerson(src.movedToUri);
if (dst && isLocalUser(dst)) { if (dst && isLocalUser(dst)) {
// TODO this branch should not be possible
// targetがローカルユーザーだった場合データベースから引っ張ってくる // targetがローカルユーザーだった場合データベースから引っ張ってくる
dst = await this.usersRepository.findOneByOrFail({ uri: src.movedToUri }) as MiLocalUser; dst = await this.usersRepository.findOneByOrFail({ uri: src.movedToUri }) as MiLocalUser;
} else if (dst) { } else if (dst) {