summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2019-07-01 16:39:12 +0200
committerGitHub <noreply@github.com>2019-07-01 16:39:12 +0200
commit452f1e04d647fb54e167965713256c666b86c6c4 (patch)
tree1490b7953336221624a7ddaa590ed5f22978aa71
parentc0a48c25aca46fbbefd64c6ca61baab44ff04316 (diff)
parentc15c2e440f72cd02a88be1a4a7d5859a34f320b9 (diff)
downloadnextcloud-server-452f1e04d647fb54e167965713256c666b86c6c4.tar.gz
nextcloud-server-452f1e04d647fb54e167965713256c666b86c6c4.zip
Merge pull request #16175 from nextcloud/followup/16088/allow-apps-to-overwrite-the-maximum-length-when-reading-from-database
Allow apps to overwrite the maximum length when reading from database
-rw-r--r--lib/private/Comments/Manager.php22
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php
index 8df4a84a477..309b682767b 100644
--- a/lib/private/Comments/Manager.php
+++ b/lib/private/Comments/Manager.php
@@ -98,6 +98,15 @@ class Manager implements ICommentsManager {
return $data;
}
+
+ /**
+ * @param array $data
+ * @return IComment
+ */
+ public function getCommentFromData(array $data): IComment {
+ return new Comment($this->normalizeDatabaseData($data));
+ }
+
/**
* prepares a comment for an insert or update operation after making sure
* all necessary fields have a value assigned.
@@ -253,7 +262,8 @@ class Manager implements ICommentsManager {
throw new NotFoundException();
}
- $comment = new Comment($this->normalizeDatabaseData($data));
+
+ $comment = $this->getCommentFromData($data);
$this->cache($comment);
return $comment;
}
@@ -308,7 +318,7 @@ class Manager implements ICommentsManager {
$resultStatement = $query->execute();
while ($data = $resultStatement->fetch()) {
- $comment = new Comment($this->normalizeDatabaseData($data));
+ $comment = $this->getCommentFromData($data);
$this->cache($comment);
$tree['replies'][] = [
'comment' => $comment,
@@ -367,7 +377,7 @@ class Manager implements ICommentsManager {
$resultStatement = $query->execute();
while ($data = $resultStatement->fetch()) {
- $comment = new Comment($this->normalizeDatabaseData($data));
+ $comment = $this->getCommentFromData($data);
$this->cache($comment);
$comments[] = $comment;
}
@@ -455,7 +465,7 @@ class Manager implements ICommentsManager {
$resultStatement = $query->execute();
while ($data = $resultStatement->fetch()) {
- $comment = new Comment($this->normalizeDatabaseData($data));
+ $comment = $this->getCommentFromData($data);
$this->cache($comment);
$comments[] = $comment;
}
@@ -485,7 +495,7 @@ class Manager implements ICommentsManager {
$result->closeCursor();
if ($row) {
- $comment = new Comment($this->normalizeDatabaseData($row));
+ $comment = $this->getCommentFromData($row);
$this->cache($comment);
return $comment;
}
@@ -532,7 +542,7 @@ class Manager implements ICommentsManager {
$comments = [];
$result = $query->execute();
while ($data = $result->fetch()) {
- $comment = new Comment($this->normalizeDatabaseData($data));
+ $comment = $this->getCommentFromData($data);
$this->cache($comment);
$comments[] = $comment;
}