diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2016-01-26 12:08:51 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2016-01-26 12:10:56 +0100 |
commit | 11ae468c89eb78c4a862fe5670303513e1d2a3b1 (patch) | |
tree | badc2e7b93849c129196e1e0c4ccc96e2b724670 /apps/dav/lib/comments | |
parent | ed546bd2a591d0d9029e9f3989e159f8b1e4e8c5 (diff) | |
download | nextcloud-server-11ae468c89eb78c4a862fe5670303513e1d2a3b1.tar.gz nextcloud-server-11ae468c89eb78c4a862fe5670303513e1d2a3b1.zip |
smaller changes related to reviews
Diffstat (limited to 'apps/dav/lib/comments')
-rw-r--r-- | apps/dav/lib/comments/commentnode.php | 3 | ||||
-rw-r--r-- | apps/dav/lib/comments/commentsplugin.php | 43 |
2 files changed, 17 insertions, 29 deletions
diff --git a/apps/dav/lib/comments/commentnode.php b/apps/dav/lib/comments/commentnode.php index b78b4765ca4..376c1bf3274 100644 --- a/apps/dav/lib/comments/commentnode.php +++ b/apps/dav/lib/comments/commentnode.php @@ -135,8 +135,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { * @return int */ function getLastModified() { - // we do not have a separate "mDateTime" field for updates currently. - return $this->comment->getCreationDateTime()->getTimestamp(); + return null; } /** diff --git a/apps/dav/lib/comments/commentsplugin.php b/apps/dav/lib/comments/commentsplugin.php index 59ce3f12f6c..2f9b7bab59f 100644 --- a/apps/dav/lib/comments/commentsplugin.php +++ b/apps/dav/lib/comments/commentsplugin.php @@ -103,31 +103,25 @@ class CommentsPlugin extends ServerPlugin { */ public function httpPost(RequestInterface $request, ResponseInterface $response) { $path = $request->getPath(); - - // Making sure the node exists - try { - $node = $this->server->tree->getNodeForPath($path); - } catch (NotFound $e) { + $node = $this->server->tree->getNodeForPath($path); + if (!$node instanceof EntityCollection) { return null; } - if ($node instanceof EntityCollection) { - $data = $request->getBodyAsString(); - - $comment = $this->createComment( - $node->getName(), - $node->getId(), - $data, - $request->getHeader('Content-Type') - ); - $url = $request->getUrl() . '/' . urlencode($comment->getId()); + $data = $request->getBodyAsString(); + $comment = $this->createComment( + $node->getName(), + $node->getId(), + $data, + $request->getHeader('Content-Type') + ); + $url = $request->getUrl() . '/' . urlencode($comment->getId()); - $response->setHeader('Content-Location', $url); + $response->setHeader('Content-Location', $url); - // created - $response->setStatus(201); - return false; - } + // created + $response->setStatus(201); + return false; } /** @@ -224,13 +218,8 @@ class CommentsPlugin extends ServerPlugin { try { $comment = $this->commentsManager->create($actorType, $actorId, $objectType, $objectId); - $properties = [ - 'message' => 'setMessage', - 'verb' => 'setVerb', - ]; - foreach($properties as $property => $setter) { - $comment->$setter($data[$property]); - } + $comment->setMessage($data['message']); + $comment->setVerb($data['verb']); $this->commentsManager->save($comment); return $comment; } catch (\InvalidArgumentException $e) { |