Skip to content

Commit

Permalink
Merge pull request #753 from nextcloud/fix/rename_subpage_order
Browse files Browse the repository at this point in the history
fix(backend): don't update subpage order if page gets renamed (not moved)
  • Loading branch information
mejo- authored Jul 3, 2023
2 parents 51b7538 + 49deaa2 commit 93ee99a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/Service/PageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -724,11 +724,14 @@ public function rename(int $collectiveId, int $parentId, int $id, ?string $title
throw new NotFoundException($e->getMessage(), 0, $e);
}

// Delete pageId from subpage order of old parent page
$this->removeFromSubpageOrder($collectiveId, $oldParentId, $id, $userId);
$this->addToSubpageOrder($collectiveId, $parentId, $id, $index, $userId);
if ($oldParentId !== $parentId) {
// Page got moved: remove from subpage order of old parent page, add to new
$this->removeFromSubpageOrder($collectiveId, $oldParentId, $id, $userId);
$this->addToSubpageOrder($collectiveId, $parentId, $id, $index, $userId);

NodeHelper::revertSubFolders($collectiveFolder);
}

NodeHelper::revertSubFolders($collectiveFolder);
return $this->getPageByFile($file);
}

Expand Down

0 comments on commit 93ee99a

Please sign in to comment.