summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-02-06 13:22:20 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-02-06 13:22:20 +0100
commit079ebe2be6261a00605ca33e5452b4fd0a634fba (patch)
tree6a9cc4750685585c3d99d61ca6117c7bd52bb5ef /apps
parenta9015d61a7d7d389849d64a4497eda5343d4ecdc (diff)
parentd2a495f19090e68b531710a861c6e1ae2b390189 (diff)
downloadnextcloud-server-079ebe2be6261a00605ca33e5452b4fd0a634fba.tar.gz
nextcloud-server-079ebe2be6261a00605ca33e5452b4fd0a634fba.zip
Merge pull request #22165 from owncloud/comments-markowncommentasread
Mark own comments as read after posting
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/comments/commentsplugin.php5
-rw-r--r--apps/dav/tests/unit/comments/commentsplugin.php4
2 files changed, 9 insertions, 0 deletions
diff --git a/apps/dav/lib/comments/commentsplugin.php b/apps/dav/lib/comments/commentsplugin.php
index 282c14df1e8..56d94cc33e9 100644
--- a/apps/dav/lib/comments/commentsplugin.php
+++ b/apps/dav/lib/comments/commentsplugin.php
@@ -116,6 +116,11 @@ class CommentsPlugin extends ServerPlugin {
$data,
$request->getHeader('Content-Type')
);
+
+ // update read marker for the current user/poster to avoid
+ // having their own comments marked as unread
+ $node->setReadMarker(null);
+
$url = $request->getUrl() . '/' . urlencode($comment->getId());
$response->setHeader('Content-Location', $url);
diff --git a/apps/dav/tests/unit/comments/commentsplugin.php b/apps/dav/tests/unit/comments/commentsplugin.php
index bd0b56fc650..9822137bbea 100644
--- a/apps/dav/tests/unit/comments/commentsplugin.php
+++ b/apps/dav/tests/unit/comments/commentsplugin.php
@@ -92,6 +92,10 @@ class CommentsPlugin extends \Test\TestCase {
->method('getId')
->will($this->returnValue('42'));
+ $node->expects($this->once())
+ ->method('setReadMarker')
+ ->with(null);
+
$this->commentsManager->expects($this->once())
->method('create')
->with('users', 'alice', 'files', '42')