Skip to content

Commit

Permalink
fix(FileListener): Listen for ShareAcceptedEvent instead of ShareCrea…
Browse files Browse the repository at this point in the history
…tedEvent

Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed May 27, 2024
1 parent 8a634d3 commit aa82f6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use OCP\Files\Events\Node\NodeDeletedEvent;
use OCP\Files\Events\Node\NodeRenamedEvent;
use OCP\Files\Events\NodeRemovedFromCache;
use OCP\Share\Events\ShareCreatedEvent;
use OCP\Share\Events\ShareAcceptedEvent;
use OCP\Share\Events\ShareDeletedEvent;

class Application extends App implements IBootstrap {
Expand All @@ -38,7 +38,7 @@ public function __construct() {
$dispatcher->addServiceListener(NodeCreatedEvent::class, FileListener::class);
$dispatcher->addServiceListener(NodeRenamedEvent::class, FileListener::class);
$dispatcher->addServiceListener(BeforeNodeRenamedEvent::class, FileListener::class);
$dispatcher->addServiceListener(ShareCreatedEvent::class, FileListener::class);
$dispatcher->addServiceListener(ShareAcceptedEvent::class, FileListener::class);
$dispatcher->addServiceListener(ShareDeletedEvent::class, FileListener::class);
$dispatcher->addServiceListener(CacheEntryInsertedEvent::class, FileListener::class);
$dispatcher->addServiceListener(NodeRemovedFromCache::class, FileListener::class);
Expand Down
4 changes: 2 additions & 2 deletions lib/Hooks/FileListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\Share\Events\ShareCreatedEvent;
use OCP\Share\Events\ShareAcceptedEvent;
use OCP\Share\Events\ShareDeletedEvent;
use Psr\Log\LoggerInterface;

Expand Down Expand Up @@ -62,7 +62,7 @@ public function __construct(

public function handle(Event $event): void {
try {
if ($event instanceof ShareCreatedEvent) {
if ($event instanceof ShareAcceptedEvent) {
$share = $event->getShare();
$ownerId = $share->getShareOwner();
$node = $share->getNode();
Expand Down

0 comments on commit aa82f6c

Please sign in to comment.