note only post check 2

This commit is contained in:
Yuri Kuznetsov
2022-07-02 14:37:05 +03:00
parent 9af6b6a8bd
commit 08e5f3cf40
+5
View File
@@ -169,6 +169,7 @@ class Note extends Record
/**
* @param NoteEntity $entity
* @param stdClass $data
* @throws Forbidden
*/
protected function beforeUpdateEntity(Entity $entity, $data)
{
@@ -178,6 +179,10 @@ class Note extends Record
$this->handlePostText($entity);
}
if (!$entity->isPost() && !$this->user->isAdmin()) {
throw new ForbiddenSilent("Only 'Post' type allowed.");
}
$entity->clear('targetType');
$entity->clear('usersIds');
$entity->clear('teamsIds');