forked from GNUsocial/gnu-social
[NOTE] Add isVisibleTo
This commit is contained in:
parent
0c0b00da93
commit
a6c24393b5
@ -232,6 +232,21 @@ class Note extends Entity
|
||||
return null;
|
||||
}
|
||||
|
||||
public function isVisibleTo(/* GSActor|LocalUser */ $a): bool
|
||||
{
|
||||
$scope = NoteScope::create($this->scope);
|
||||
return $scope->public
|
||||
|| ($scope->follower
|
||||
&& 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]));
|
||||
}
|
||||
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
return [
|
||||
|
Loading…
Reference in New Issue
Block a user