fix refollowing locked account

This commit is contained in:
Namekuji 2023-04-15 02:01:34 -04:00
parent 17c80e82e0
commit 2f5d9b86ef
2 changed files with 23 additions and 15 deletions

View file

@ -86,7 +86,7 @@ export class UserFollowingService implements OnModuleInit {
@bindThis
public async follow(_follower: { id: User['id'] }, _followee: { id: User['id'] }, requestId?: string, silent = false): Promise<void> {
const [follower, followee] = await Promise.all([
let [follower, followee] = await Promise.all([
this.usersRepository.findOneByOrFail({ id: _follower.id }),
this.usersRepository.findOneByOrFail({ id: _followee.id }),
]);
@ -140,7 +140,12 @@ export class UserFollowingService implements OnModuleInit {
}
// Automatically accept if the follower is an account who has moved and the locked followee had accepted the old account.
if (followee.isLocked && !autoAccept && follower.alsoKnownAs) {
if (followee.isLocked && !autoAccept) {
if (this.userEntityService.isRemoteUser(follower)) {
await this.apPersonService.updatePerson(follower.uri);
follower = await this.apPersonService.resolvePerson(follower.uri);
}
if (follower.alsoKnownAs) {
for (const oldUri of follower.alsoKnownAs) {
try {
await this.apPersonService.updatePerson(oldUri);
@ -158,6 +163,7 @@ export class UserFollowingService implements OnModuleInit {
}
}
}
}
if (!autoAccept) {
await this.createFollowRequest(follower, followee, requestId);

View file

@ -527,6 +527,8 @@ export class ApPersonService implements OnModuleInit {
await this.updateFeatured(exist.id, resolver).catch(err => this.logger.error(err));
this.cacheService.uriPersonCache.set(uri, Object.assign(exist, updates));
// Copy blocking and muting if we know its moving for the first time.
if (!exist.movedToUri && updates.movedToUri) {
try {