summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-09-26 11:30:56 +0200
committerGitHub <noreply@github.com>2019-09-26 11:30:56 +0200
commit1cb1b132ca4408a94dcae34ac4b431c2c45b7df0 (patch)
tree1dd80135144e54005cbed2d0149a423cb1a49917
parent6ac67011f44c20ca88bc0b055a7aa727b16f9028 (diff)
parente4b36f4f47e40529fd41a0b0c55a68a093f725f1 (diff)
downloadnextcloud-server-1cb1b132ca4408a94dcae34ac4b431c2c45b7df0.tar.gz
nextcloud-server-1cb1b132ca4408a94dcae34ac4b431c2c45b7df0.zip
Merge pull request #17252 from nextcloud/bugfix/noid/user-0-can-not-comment
Fix user with id 0 to be able to comment
-rw-r--r--lib/private/Comments/Comment.php6
-rw-r--r--lib/private/Comments/Manager.php4
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php
index c9862c64ca6..7c935930f28 100644
--- a/lib/private/Comments/Comment.php
+++ b/lib/private/Comments/Comment.php
@@ -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.');
}
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php
index e54218509dc..024dd58b89c 100644
--- a/lib/private/Comments/Manager.php
+++ b/lib/private/Comments/Manager.php
@@ -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');