[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 e392a9c90c
commit 79215bc439
Signed by: 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])) && null != DB::find('follow', ['follower' => $a->getId(), 'followed' => $this->gsactor_id]))
|| ($scope->addressee || ($scope->addressee
&& null != DB::find('notification', ['activity_id' => $this->id, 'gsactor_id' => $a->getId()])) && null != DB::find('notification', ['activity_id' => $this->id, 'gsactor_id' => $a->getId()]))
|| ($scope->group || ($scope->group && [] != DB::dql('select m from group_member m ' .
&& [] != DB::sql('select m.gsactor_id from group_member m ' . 'join group_inbox i with m.group_id = i.group_id ' .
'inner join group_inbox i on m.group_id = i.group_id ' . 'join note n with i.activity_id = n.id ' .
'inner join note n on i.activity_id = n.id where n.id = :id', 'where n.id = :note_id and m.gsactor_id = :actor_id',
[], ['id' => $this->id])); ['note_id' => $this->id, 'actor_id' => $a->getId()]));
} }
public function jsonSerialize() public function jsonSerialize()