Browse Source

Merge pull request #17252 from nextcloud/bugfix/noid/user-0-can-not-comment

Fix user with id 0 to be able to comment
tags/v18.0.0beta1
Roeland Jago Douma 4 years ago
parent
commit
1cb1b132ca
No account linked to committer's email address
2 changed files with 5 additions and 5 deletions
  1. 3
    3
      lib/private/Comments/Comment.php
  2. 2
    2
      lib/private/Comments/Manager.php

+ 3
- 3
lib/private/Comments/Comment.php 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.');
}

+ 2
- 2
lib/private/Comments/Manager.php 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');

Loading…
Cancel
Save