[Note] Fix scope check for group notes, move away from SQL, to DQL

This commit is contained in:
Hugo Sales 2021-08-18 17:27:51 +01:00
parent 0b3ebf841d
commit 20901d26df
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -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()