From 79215bc4390aafd328112039aa0ff07f040871ab Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Wed, 18 Aug 2021 17:27:51 +0100 Subject: [PATCH] [Note] Fix scope check for group notes, move away from SQL, to DQL --- src/Entity/Note.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Entity/Note.php b/src/Entity/Note.php index 0ebb455089..08c982aa6f 100644 --- a/src/Entity/Note.php +++ b/src/Entity/Note.php @@ -267,11 +267,11 @@ class Note extends Entity && null != DB::find('follow', ['follower' => $a->getId(), 'followed' => $this->gsactor_id])) || ($scope->addressee && null != DB::find('notification', ['activity_id' => $this->id, 'gsactor_id' => $a->getId()])) - || ($scope->group - && [] != DB::sql('select m.gsactor_id from group_member m ' . - 'inner join group_inbox i on m.group_id = i.group_id ' . - 'inner join note n on i.activity_id = n.id where n.id = :id', - [], ['id' => $this->id])); + || ($scope->group && [] != DB::dql('select m from group_member m ' . + 'join group_inbox i with m.group_id = i.group_id ' . + 'join note n with i.activity_id = n.id ' . + 'where n.id = :note_id and m.gsactor_id = :actor_id', + ['note_id' => $this->id, 'actor_id' => $a->getId()])); } public function jsonSerialize()