fix(backend): 古いユーザーキャッシュを使うことへの対策 (misskey-dev#13453)

Co-authored-by: tamaina <tamaina@hotmail.co.jp>
This commit is contained in:
まっちゃとーにゅ 2024-02-25 04:20:12 +09:00
parent 4a615ff251
commit 552354c895
No known key found for this signature in database
GPG key ID: 6AFBBF529601C1DB
7 changed files with 27 additions and 27 deletions

View file

@ -100,33 +100,24 @@ export class UserFollowingService implements OnModuleInit {
this.queueService.deliver(followee, content, follower.inbox, false);
}
/**
* ThinUserでなくともユーザーの情報が最新でない場合はこちらを使うべき
*/
@bindThis
public async followByThinUser(
_follower: ThinUser,
_followee: ThinUser,
options: Parameters<typeof this.follow>[2] = {},
) {
const [follower, followee] = await Promise.all([
this.usersRepository.findOneByOrFail({ id: _follower.id }),
this.usersRepository.findOneByOrFail({ id: _followee.id }),
]) as [MiLocalUser | MiRemoteUser, MiLocalUser | MiRemoteUser];
await this.follow(follower, followee, options);
}
@bindThis
public async follow(
follower: MiLocalUser | MiRemoteUser,
followee: MiLocalUser | MiRemoteUser,
_follower: ThinUser,
_followee: ThinUser,
{ requestId, silent = false, withReplies }: {
requestId?: string,
silent?: boolean,
withReplies?: boolean,
} = {},
): Promise<void> {
/**
*
*/
const [follower, followee] = await Promise.all([
this.usersRepository.findOneByOrFail({ id: _follower.id }),
this.usersRepository.findOneByOrFail({ id: _followee.id }),
]) as [MiLocalUser | MiRemoteUser, MiLocalUser | MiRemoteUser];
if (this.userEntityService.isRemoteUser(follower) && this.userEntityService.isRemoteUser(followee)) {
// What?
throw new Error('Remote user cannot follow remote user.');