Skip to content

Commit

Permalink
fix(FileListener): Try to remember source file for moves
Browse files Browse the repository at this point in the history
fixes #1138

Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed May 27, 2024
1 parent 215bb35 commit 7192f6a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Hooks/FileListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class FileListener implements IEventListener {
private IRootFolder $rootFolder;
/** @var list<string> */
private array $sourceUserIds;
private ?Node $source = null;

public function __construct(FaceDetectionMapper $faceDetectionMapper, LoggerInterface $logger, QueueService $queue, IgnoreService $ignoreService, StorageService $storageService, IManager $shareManager, IRootFolder $rootFolder) {
$this->faceDetectionMapper = $faceDetectionMapper;
Expand Down Expand Up @@ -140,6 +141,7 @@ public function handle(Event $event): void {
/** @var array{users:array<string,array{node_id:int, node_path: string}>, remote: array<string,array{node_id:int, node_path: string}>, mail: array<string,array{node_id:int, node_path: string}>} $sourceAccessList */
$sourceAccessList = $this->shareManager->getAccessList($event->getSource(), true, true);
$this->sourceUserIds = array_map(fn ($id) => strval($id), array_keys($sourceAccessList['users']));
$this->source = $event->getSource();
return;
}
if ($event instanceof NodeRenamedEvent) {
Expand Down Expand Up @@ -175,7 +177,7 @@ public function handle(Event $event): void {
$this->postDelete($event->getTarget());
return;
}
$this->postRename($event->getSource(), $event->getTarget());
$this->postRename($this->source ?? $event->getSource(), $event->getTarget());
return;
}
if ($event instanceof BeforeNodeDeletedEvent) {
Expand Down

0 comments on commit 7192f6a

Please sign in to comment.