fix: check visibility when serving Like activity
All checks were successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/test Pipeline was successful

This commit is contained in:
Johann150 2022-09-02 14:34:32 +02:00
parent 375323bc25
commit 2ed46aaebb
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -206,16 +206,19 @@ router.get('/emojis/:emoji', async ctx => {
// like
router.get('/likes/:like', async ctx => {
const reaction = await NoteReactions.findOneBy({ id: ctx.params.like });
const note = await Notes.findOneBy({
id: reaction.noteId,
visibility: In(['public' as const, 'home' as const]),
});
if (reaction == null) {
if (note == null) {
ctx.status = 404;
return;
}
const note = await Notes.findOneBy({ id: reaction.noteId });
const reaction = await NoteReactions.findOneBy({ id: ctx.params.like });
if (note == null) {
if (reaction == null) {
ctx.status = 404;
return;
}