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 @bindThis
public async follow(_follower: { id: User['id'] }, _followee: { id: User['id'] }, requestId?: string, silent = false): Promise<void> { 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: _follower.id }),
this.usersRepository.findOneByOrFail({ id: _followee.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. // 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) { for (const oldUri of follower.alsoKnownAs) {
try { try {
await this.apPersonService.updatePerson(oldUri); await this.apPersonService.updatePerson(oldUri);
@ -158,6 +163,7 @@ export class UserFollowingService implements OnModuleInit {
} }
} }
} }
}
if (!autoAccept) { if (!autoAccept) {
await this.createFollowRequest(follower, followee, requestId); 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)); 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. // Copy blocking and muting if we know its moving for the first time.
if (!exist.movedToUri && updates.movedToUri) { if (!exist.movedToUri && updates.movedToUri) {
try { try {