Skip to content
Closed
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
10 changes: 9 additions & 1 deletion apps/comments/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</dependencies>
<types>
<logging/>
<dav/>
</types>

<activity>
<settings>
<setting>OCA\Comments\Activity\Setting</setting>
Expand All @@ -27,4 +27,12 @@
<provider>OCA\Comments\Activity\Provider</provider>
</providers>
</activity>
<sabre>
<plugins>
<plugin>OCA\Comments\Dav\CommentsPlugin</plugin>
</plugins>
<collections>
<collection>OCA\Comments\Dav\RootCollection</collection>
</collections>
</sabre>
</info>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
*/

namespace OCA\DAV\Comments;
namespace OCA\Comments\Dav;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks 3rd party apps, that use comments, because now the file comments app needs to be enabled, while prior it worked because dav is force enabled.

So I'd like to not do this 😞

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comments infrastructure was also intentionally decoupled from comments on files feature, what the comments app eventually does. Also not a fan.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So @LukasReschke want to split the comments moving out of this PR? I think it makes sense to merge the base, but as said above not doing it for existing features.



use OCP\Comments\IComment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
*/

namespace OCA\DAV\Comments;
namespace OCA\Comments\Dav;

use OCP\Comments\IComment;
use OCP\Comments\ICommentsManager;
Expand Down Expand Up @@ -88,6 +88,10 @@ function initialize(Server $server) {
return;
}

if ($this->userSession === null || $this->userSession->getUser() === null) {
return;
}

$this->server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc';

$this->server->xml->classMap['DateTime'] = function(Writer $writer, \DateTime $value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
*/

namespace OCA\DAV\Comments;
namespace OCA\Comments\Dav;

use OCP\Comments\ICommentsManager;
use OCP\Comments\NotFoundException;
Expand All @@ -38,7 +38,7 @@
* this represents a specific holder of comments, identified by an entity type
* (class member $name) and an entity id (class member $id).
*
* @package OCA\DAV\Comments
* @package OCA\Comments\Dav
*/
class EntityCollection extends RootCollection implements IProperties {
const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
*/

namespace OCA\DAV\Comments;
namespace OCA\Comments\Dav;

use OCP\Comments\ICommentsManager;
use OCP\ILogger;
Expand All @@ -39,7 +39,7 @@
* Its children are instances of EntityCollection (representing a specific
* object, for example the file by id).
*
* @package OCA\DAV\Comments
* @package OCA\Comments\Dav
*/
class EntityTypeCollection extends RootCollection {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
*/

namespace OCA\DAV\Comments;
namespace OCA\Comments\Dav;

use OCP\Comments\CommentsEntityEvent;
use OCP\Comments\ICommentsManager;
Expand Down Expand Up @@ -89,6 +89,9 @@ protected function initCollections() {
if($this->entityTypeCollections !== null) {
return;
}
if(is_null($this->userSession)) {
throw new NotAuthenticated();
}
$user = $this->userSession->getUser();
if(is_null($user)) {
throw new NotAuthenticated();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@

namespace OCA\DAV\Tests\unit\Comments;

use OCA\DAV\Comments\CommentNode;
use OCP\Comments\IComment;
use OCP\Comments\ICommentsManager;
use OCA\Comments\Dav\CommentNode;
use OCP\Comments\MessageTooLongException;

class CommentsNodeTest extends \Test\TestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace OCA\DAV\Tests\unit\Comments;

use OC\Comments\Comment;
use OCA\DAV\Comments\CommentsPlugin as CommentsPluginImplementation;
use OCA\Comments\Dav\CommentsPlugin as CommentsPluginImplementation;
use OCP\Comments\IComment;
use Sabre\DAV\Exception\NotFound;

Expand Down Expand Up @@ -93,7 +93,7 @@ public function testCreateComment() {
->method('getUID')
->will($this->returnValue('alice'));

$node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
$node = $this->getMockBuilder('\OCA\Comments\Dav\EntityCollection')
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
Expand All @@ -112,7 +112,7 @@ public function testCreateComment() {
->with('users', 'alice', 'files', '42')
->will($this->returnValue($comment));

$this->userSession->expects($this->once())
$this->userSession->expects($this->any())
->method('getUser')
->will($this->returnValue($user));

Expand Down Expand Up @@ -188,7 +188,7 @@ public function testCreateCommentInvalidObject() {
$user->expects($this->never())
->method('getUID');

$node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
$node = $this->getMockBuilder('\OCA\Comments\Dav\EntityCollection')
->disableOriginalConstructor()
->getMock();
$node->expects($this->never())
Expand All @@ -199,7 +199,7 @@ public function testCreateCommentInvalidObject() {
$this->commentsManager->expects($this->never())
->method('create');

$this->userSession->expects($this->never())
$this->userSession->expects($this->once())
->method('getUser');

// technically, this is a shortcut. Inbetween EntityTypeCollection would
Expand Down Expand Up @@ -272,7 +272,7 @@ public function testCreateCommentInvalidActor() {
$user->expects($this->never())
->method('getUID');

$node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
$node = $this->getMockBuilder('\OCA\Comments\Dav\EntityCollection')
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
Expand All @@ -285,7 +285,7 @@ public function testCreateCommentInvalidActor() {
$this->commentsManager->expects($this->never())
->method('create');

$this->userSession->expects($this->never())
$this->userSession->expects($this->once())
->method('getUser');

// technically, this is a shortcut. Inbetween EntityTypeCollection would
Expand Down Expand Up @@ -360,7 +360,7 @@ public function testCreateCommentUnsupportedMediaType() {
$user->expects($this->never())
->method('getUID');

$node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
$node = $this->getMockBuilder('\OCA\Comments\Dav\EntityCollection')
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
Expand All @@ -373,7 +373,7 @@ public function testCreateCommentUnsupportedMediaType() {
$this->commentsManager->expects($this->never())
->method('create');

$this->userSession->expects($this->never())
$this->userSession->expects($this->once())
->method('getUser');

// technically, this is a shortcut. Inbetween EntityTypeCollection would
Expand Down Expand Up @@ -451,7 +451,7 @@ public function testCreateCommentInvalidPayload() {
->method('getUID')
->will($this->returnValue('alice'));

$node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
$node = $this->getMockBuilder('\OCA\Comments\Dav\EntityCollection')
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
Expand All @@ -466,7 +466,7 @@ public function testCreateCommentInvalidPayload() {
->with('users', 'alice', 'files', '42')
->will($this->returnValue($comment));

$this->userSession->expects($this->once())
$this->userSession->expects($this->any())
->method('getUser')
->will($this->returnValue($user));

Expand Down Expand Up @@ -545,7 +545,7 @@ public function testCreateCommentMessageTooLong() {
->method('getUID')
->will($this->returnValue('alice'));

$node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
$node = $this->getMockBuilder('\OCA\Comments\Dav\EntityCollection')
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
Expand All @@ -563,7 +563,7 @@ public function testCreateCommentMessageTooLong() {
->with('users', 'alice', 'files', '42')
->will($this->returnValue($comment));

$this->userSession->expects($this->once())
$this->userSession->expects($this->any())
->method('getUser')
->will($this->returnValue($user));

Expand Down Expand Up @@ -672,7 +672,7 @@ public function testOnReportDateTimeEmpty() {
]
];

$node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
$node = $this->getMockBuilder('\OCA\Comments\Dav\EntityCollection')
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
Expand Down Expand Up @@ -727,7 +727,7 @@ public function testOnReport() {
]
];

$node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
$node = $this->getMockBuilder('\OCA\Comments\Dav\EntityCollection')
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class EntityCollectionTest extends \Test\TestCase {
protected $userManager;
/** @var \OCP\ILogger|\PHPUnit_Framework_MockObject_MockObject */
protected $logger;
/** @var \OCA\DAV\Comments\EntityCollection */
/** @var \OCA\Comments\Dav\EntityCollection */
protected $collection;
/** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject */
protected $userSession;
Expand All @@ -53,7 +53,7 @@ public function setUp() {
->disableOriginalConstructor()
->getMock();

$this->collection = new \OCA\DAV\Comments\EntityCollection(
$this->collection = new \OCA\Comments\Dav\EntityCollection(
'19',
'files',
$this->commentsManager,
Expand All @@ -78,7 +78,7 @@ public function testGetChild() {
));

$node = $this->collection->getChild('55');
$this->assertTrue($node instanceof \OCA\DAV\Comments\CommentNode);
$this->assertTrue($node instanceof \OCA\Comments\Dav\CommentNode);
}

/**
Expand Down Expand Up @@ -106,7 +106,7 @@ public function testGetChildren() {
$result = $this->collection->getChildren();

$this->assertSame(count($result), 1);
$this->assertTrue($result[0] instanceof \OCA\DAV\Comments\CommentNode);
$this->assertTrue($result[0] instanceof \OCA\Comments\Dav\CommentNode);
}

public function testFindChildren() {
Expand All @@ -123,7 +123,7 @@ public function testFindChildren() {
$result = $this->collection->findChildren(5, 15, $dt);

$this->assertSame(count($result), 1);
$this->assertTrue($result[0] instanceof \OCA\DAV\Comments\CommentNode);
$this->assertTrue($result[0] instanceof \OCA\Comments\Dav\CommentNode);
}

public function testChildExistsTrue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

namespace OCA\DAV\Tests\unit\Comments;

use OCA\DAV\Comments\EntityCollection as EntityCollectionImplemantation;
use OCA\Comments\Dav\EntityCollection as EntityCollectionImplemantation;

class EntityTypeCollectionTest extends \Test\TestCase {

Expand All @@ -34,7 +34,7 @@ class EntityTypeCollectionTest extends \Test\TestCase {
protected $userManager;
/** @var \OCP\ILogger|\PHPUnit_Framework_MockObject_MockObject */
protected $logger;
/** @var \OCA\DAV\Comments\EntityTypeCollection */
/** @var \OCA\Comments\Dav\EntityTypeCollection */
protected $collection;
/** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject */
protected $userSession;
Expand All @@ -59,7 +59,7 @@ public function setUp() {

$instance = $this;

$this->collection = new \OCA\DAV\Comments\EntityTypeCollection(
$this->collection = new \OCA\Comments\Dav\EntityTypeCollection(
'files',
$this->commentsManager,
$this->userManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

namespace OCA\DAV\Tests\unit\Comments;

use OCA\DAV\Comments\EntityTypeCollection as EntityTypeCollectionImplementation;
use OCA\Comments\Dav\EntityTypeCollection as EntityTypeCollectionImplementation;
use OCP\Comments\CommentsEntityEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;

Expand All @@ -36,7 +36,7 @@ class RootCollectionTest extends \Test\TestCase {
protected $userManager;
/** @var \OCP\ILogger|\PHPUnit_Framework_MockObject_MockObject */
protected $logger;
/** @var \OCA\DAV\Comments\RootCollection */
/** @var \OCA\Comments\Dav\RootCollection */
protected $collection;
/** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject */
protected $userSession;
Expand Down Expand Up @@ -66,7 +66,7 @@ public function setUp() {
->disableOriginalConstructor()
->getMock();

$this->collection = new \OCA\DAV\Comments\RootCollection(
$this->collection = new \OCA\Comments\Dav\RootCollection(
$this->commentsManager,
$this->userManager,
$this->userSession,
Expand Down
1 change: 1 addition & 0 deletions apps/dav/appinfo/v2/remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Vincent Petry <pvince81@owncloud.com>
*
* @license AGPL-3.0
*
Expand Down
Loading