aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Comments/Comment.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-12-13 13:29:12 +0100
committerJoas Schilling <coding@schilljs.com>2023-12-14 14:32:00 +0100
commit6056928dc6185cb22a55dbbc1d37f5abaf59ead2 (patch)
treec0b05f4c45d6212c985ee4a176c112ea58b1d319 /lib/private/Comments/Comment.php
parentbac05cae5b53cc208b7edaa6b2b2a5de86f25035 (diff)
downloadnextcloud-server-6056928dc6185cb22a55dbbc1d37f5abaf59ead2.tar.gz
nextcloud-server-6056928dc6185cb22a55dbbc1d37f5abaf59ead2.zip
feat(comments): Add a meta data column for comments
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Comments/Comment.php')
-rw-r--r--lib/private/Comments/Comment.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php
index 35e88c74438..183821e37b1 100644
--- a/lib/private/Comments/Comment.php
+++ b/lib/private/Comments/Comment.php
@@ -42,6 +42,7 @@ class Comment implements IComment {
'objectType' => '',
'objectId' => '',
'referenceId' => null,
+ 'metaData' => null,
'creationDT' => null,
'latestChildDT' => null,
'reactions' => null,
@@ -403,6 +404,34 @@ class Comment implements IComment {
/**
* @inheritDoc
*/
+ public function getMetaData(): ?array {
+ if ($this->data['metaData'] === null) {
+ return null;
+ }
+
+ try {
+ $metaData = json_decode($this->data['metaData'], true, flags: JSON_THROW_ON_ERROR);
+ } catch (\JsonException $e) {
+ return null;
+ }
+ return is_array($metaData) ? $metaData : null;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function setMetaData(?array $metaData): IComment {
+ if ($metaData === null) {
+ $this->data['metaData'] = null;
+ } else {
+ $this->data['metaData'] = json_encode($metaData, JSON_THROW_ON_ERROR);
+ }
+ return $this;
+ }
+
+ /**
+ * @inheritDoc
+ */
public function getReactions(): array {
return $this->data['reactions'] ?? [];
}