Skip to content
Merged
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: 8 additions & 2 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
use OCP\Collaboration\Resources\IProviderManager;
use OCP\Collaboration\Resources\LoadAdditionalScriptsEvent;
use OCP\Comments\CommentsEntityEvent;
use OCP\Comments\CommentsEvent;
use OCP\Comments\Events\BeforeCommentUpdatedEvent;
use OCP\Comments\Events\CommentAddedEvent;
use OCP\Comments\Events\CommentDeletedEvent;
use OCP\Comments\Events\CommentUpdatedEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Federation\ICloudFederationProvider;
use OCP\Federation\ICloudFederationProviderManager;
Expand Down Expand Up @@ -155,7 +158,10 @@ public function register(IRegistrationContext $context): void {
$context->registerEventListener(AclCreatedEvent::class, FullTextSearchEventListener::class);
$context->registerEventListener(AclUpdatedEvent::class, FullTextSearchEventListener::class);
$context->registerEventListener(AclDeletedEvent::class, FullTextSearchEventListener::class);
$context->registerEventListener(CommentsEvent::class, CommentEventListener::class);
$context->registerEventListener(CommentAddedEvent::class, CommentEventListener::class);
$context->registerEventListener(BeforeCommentUpdatedEvent::class, CommentEventListener::class);
$context->registerEventListener(CommentUpdatedEvent::class, CommentEventListener::class);
$context->registerEventListener(CommentDeletedEvent::class, CommentEventListener::class);

// Handling cache invalidation for collections
$context->registerEventListener(AclCreatedEvent::class, ResourceListener::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/features/decks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Feature: decks
And remember the last attachment as "my-attachment"
And post a comment with content "My first comment" on the card
When get the activities for the last card
Then the fetched activities should have 2 entries
Then the fetched activities should have 3 entries
And delete the card

When get the activities for the last card
Expand Down
9 changes: 5 additions & 4 deletions tests/unit/Listeners/CommentEventListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
use OCA\Deck\Db\CardMapper;
use OCA\Deck\Db\ChangeHelper;
use OCA\Deck\Notification\NotificationHelper;
use OCP\Comments\CommentsEvent;
use OCP\Comments\Events\CommentAddedEvent;
use OCP\Comments\Events\CommentUpdatedEvent;
use OCP\Comments\IComment;
use PHPUnit\Framework\TestCase;

Expand Down Expand Up @@ -68,7 +69,7 @@ public function testHandle() {
$this->cardMapper->expects($this->once())
->method('find')
->willReturn($card);
$commentsEvent = new CommentsEvent(CommentsEvent::EVENT_ADD, $comment);
$commentsEvent = new CommentAddedEvent($comment);
$this->activityManager->expects($this->once())
->method('triggerEvent')
->with(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_CARD_COMMENT_CREATE, ['comment' => $comment]);
Expand All @@ -82,7 +83,7 @@ public function testHandleUpdate() {
$comment = $this->createMock(IComment::class);
$comment->expects($this->any())->method('getId')->willReturn(1);
$comment->expects($this->any())->method('getObjectType')->willReturn('deckCard');
$commentsEvent = new CommentsEvent(CommentsEvent::EVENT_UPDATE, $comment);
$commentsEvent = new CommentUpdatedEvent($comment);
$this->activityManager->expects($this->never())
->method('triggerEvent');
$this->notificationHelper->expects($this->once())
Expand All @@ -95,7 +96,7 @@ public function testHandleInvalid() {
$comment = $this->createMock(IComment::class);
$comment->expects($this->any())->method('getId')->willReturn(1);
$comment->expects($this->any())->method('getObjectType')->willReturn('other');
$commentsEvent = new CommentsEvent(CommentsEvent::EVENT_ADD, $comment);
$commentsEvent = new CommentAddedEvent($comment);
$this->activityManager->expects($this->never())
->method('triggerEvent');
$this->commentEventHandler->handle($commentsEvent);
Expand Down
Loading