Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix user with id 0 to be able to comment
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Sep 25, 2019
commit e4b36f4f47e40529fd41a0b0c55a68a093f725f1
6 changes: 3 additions & 3 deletions lib/private/Comments/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,12 @@ public function getActorId() {
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;
}

Expand Down Expand Up @@ -385,7 +385,7 @@ public function getObjectId() {
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.');
}
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Comments/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ public function getCommentFromData(array $data): IComment {
*/
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');
Expand Down