diff --git a/core/Application.php b/core/Application.php index 2ad8b9f2a3014..700fb3297afce 100644 --- a/core/Application.php +++ b/core/Application.php @@ -48,10 +48,8 @@ use OCP\AppFramework\App; use OCP\AppFramework\Http\Events\BeforeLoginTemplateRenderedEvent; use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; -use OCP\DB\Events\AddMissingColumnsEvent; use OCP\DB\Events\AddMissingIndicesEvent; use OCP\DB\Events\AddMissingPrimaryKeyEvent; -use OCP\DB\Types; use OCP\EventDispatcher\IEventDispatcher; use OCP\User\Events\BeforeUserDeletedEvent; use OCP\User\Events\UserDeletedEvent; @@ -300,18 +298,6 @@ public function __construct() { ); }); - $eventDispatcher->addListener(AddMissingColumnsEvent::class, function (AddMissingColumnsEvent $event) { - $event->addMissingColumn( - 'comments', - 'reference_id', - Types::STRING, - [ - 'notnull' => false, - 'length' => 64, - ] - ); - }); - $eventDispatcher->addServiceListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class); $eventDispatcher->addServiceListener(BeforeLoginTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class); $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeActivityListener::class); diff --git a/tests/lib/Comments/CommentTest.php b/tests/lib/Comments/CommentTest.php index 328e6fd5447de..fb1fded33b2c0 100644 --- a/tests/lib/Comments/CommentTest.php +++ b/tests/lib/Comments/CommentTest.php @@ -23,6 +23,8 @@ public function testSettersValidInput() { $creationDT = new \DateTime(); $latestChildDT = new \DateTime('yesterday'); $object = ['type' => 'files', 'id' => 'file64']; + $referenceId = sha1('referenceId'); + $metaData = json_encode(['last_edit_actor_id' => 'admin']); $comment ->setId($id) @@ -34,7 +36,9 @@ public function testSettersValidInput() { ->setActor($actor['type'], $actor['id']) ->setCreationDateTime($creationDT) ->setLatestChildDateTime($latestChildDT) - ->setObject($object['type'], $object['id']); + ->setObject($object['type'], $object['id']) + ->setReferenceId($referenceId) + ->setMetaData($metaData); $this->assertSame($id, $comment->getId()); $this->assertSame($parentId, $comment->getParentId()); @@ -48,6 +52,8 @@ public function testSettersValidInput() { $this->assertSame($latestChildDT, $comment->getLatestChildDateTime()); $this->assertSame($object['type'], $comment->getObjectType()); $this->assertSame($object['id'], $comment->getObjectId()); + $this->assertSame($referenceId, $comment->getReferenceId()); + $this->assertSame($metaData, $comment->getMetaData()); } diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php index 5fa1beee3742e..97ca814c4b285 100644 --- a/tests/lib/Comments/ManagerTest.php +++ b/tests/lib/Comments/ManagerTest.php @@ -65,6 +65,8 @@ protected function addDatabaseEntry($parentId, $topmostParentId, $creationDT = n 'object_type' => $qb->createNamedParameter('files'), 'object_id' => $qb->createNamedParameter($objectId), 'expire_date' => $qb->createNamedParameter($expireDate, 'datetime'), + 'reference_id' => $qb->createNamedParameter('referenceId'), + 'meta_data' => $qb->createNamedParameter(json_encode(['last_edit_actor_id' => 'admin'])), ]) ->execute(); @@ -119,6 +121,8 @@ public function testGetComment() { 'latest_child_timestamp' => $qb->createNamedParameter($latestChildDT, 'datetime'), 'object_type' => $qb->createNamedParameter('files'), 'object_id' => $qb->createNamedParameter('file64'), + 'reference_id' => $qb->createNamedParameter('referenceId'), + 'meta_data' => $qb->createNamedParameter(json_encode(['last_edit_actor_id' => 'admin'])), ]) ->execute(); @@ -137,7 +141,8 @@ public function testGetComment() { $this->assertSame($comment->getObjectType(), 'files'); $this->assertSame($comment->getObjectId(), 'file64'); $this->assertEquals($comment->getCreationDateTime()->getTimestamp(), $creationDT->getTimestamp()); - $this->assertEquals($comment->getLatestChildDateTime(), $latestChildDT); + $this->assertEquals($comment->getReferenceId(), 'referenceId'); + $this->assertEquals($comment->getMetaData(), json_encode(['last_edit_actor_id' => 'admin'])); }