Fix user with id 0 to be able to comment

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2019-09-25 09:07:07 +02:00
parent 61d22ff6cf
commit e4b36f4f47
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
2 changed files with 5 additions and 5 deletions

View File

@ -299,12 +299,12 @@ class Comment implements IComment {
public function setActor($actorType, $actorId) {
if(
!is_string($actorType) || !trim($actorType)
|| !is_string($actorId) || !trim($actorId)
|| !is_string($actorId) || $actorId === ''
) {
throw new \InvalidArgumentException('String expected.');
}
$this->data['actorType'] = trim($actorType);
$this->data['actorId'] = trim($actorId);
$this->data['actorId'] = $actorId;
return $this;
}
@ -385,7 +385,7 @@ class Comment implements IComment {
public function setObject($objectType, $objectId) {
if(
!is_string($objectType) || !trim($objectType)
|| !is_string($objectId) || !trim($objectId)
|| !is_string($objectId) || trim($objectId) === ''
) {
throw new \InvalidArgumentException('String expected.');
}

View File

@ -118,9 +118,9 @@ class Manager implements ICommentsManager {
*/
protected function prepareCommentForDatabaseWrite(IComment $comment) {
if (!$comment->getActorType()
|| !$comment->getActorId()
|| $comment->getActorId() === ''
|| !$comment->getObjectType()
|| !$comment->getObjectId()
|| $comment->getObjectId() === ''
|| !$comment->getVerb()
) {
throw new \UnexpectedValueException('Actor, Object and Verb information must be provided for saving');