mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-26 03:47:40 -07:00
fix: assume remote users are following each other (#8734)
Misskey does not know if two remote users are following each other. Because ActivityPub actions would otherwise fail on followers only notes, we have to assume that two remote users are following each other when an interaction about a remote note occurs.
This commit is contained in:
parent
fc25935360
commit
62ab5b4015
1 changed files with 15 additions and 9 deletions
|
@ -168,16 +168,22 @@ export const NoteRepository = db.getRepository(Note).extend({
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// フォロワーかどうか
|
// フォロワーかどうか
|
||||||
const following = await Followings.findOneBy({
|
const [following, user] = await Promise.all([
|
||||||
|
Followings.findOneBy({
|
||||||
followeeId: note.userId,
|
followeeId: note.userId,
|
||||||
followerId: meId,
|
followerId: meId,
|
||||||
});
|
}),
|
||||||
|
Users.findOneByOrFail({ id: meId }),
|
||||||
|
]);
|
||||||
|
|
||||||
if (following == null) {
|
/* If we know the following, everyhting is fine.
|
||||||
return false;
|
|
||||||
} else {
|
But if we do not know the following, it might be that both the
|
||||||
return true;
|
author of the note and the author of the like are remote users,
|
||||||
}
|
in which case we can never know the following. Instead we have
|
||||||
|
to assume that the users are following each other.
|
||||||
|
*/
|
||||||
|
return following != null || (note.userHost != null && user.host != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue