1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-18 07:15:33 +02:00

Deliver update person when new key generated (not tested)

https://github.com/misskey-dev/misskey/pull/13464#issuecomment-1977049061
This commit is contained in:
tamaina
2024-03-04 18:47:07 +00:00
parent 1af1bc87bd
commit 7d77c7044e
7 changed files with 53 additions and 17 deletions

View File

@@ -27,15 +27,22 @@ export class AccountUpdateService {
}
@bindThis
public async publishToFollowers(userId: MiUser['id']) {
/**
* ユーザーのアップデートをフォロワーに配信する
* @param userId ユーザーID
* @param isKeyUpdation Ed25519キーの作成など公開鍵のアップデートによる呼び出しか trueにするとメインキーを使うようになる
*/
public async publishToFollowers(userId: MiUser['id'], isKeyUpdation: boolean = false) {
const user = await this.usersRepository.findOneBy({ id: userId });
if (user == null) throw new Error('user not found');
// フォロワーがリモートユーザーかつ投稿者がローカルユーザーならUpdateを配信
if (this.userEntityService.isLocalUser(user)) {
const content = this.apRendererService.addContext(this.apRendererService.renderUpdate(await this.apRendererService.renderPerson(user), user));
this.apDeliverManagerService.deliverToFollowers(user, content);
this.relayService.deliverToRelays(user, content);
await Promise.allSettled([
this.apDeliverManagerService.deliverToFollowers(user, content, isKeyUpdation),
this.relayService.deliverToRelays(user, content, isKeyUpdation),
]);
}
}
}