@ -129,18 +130,74 @@ class MoveCalendar extends Command {
throw new \InvalidArgumentException("User <$userOrigin> has no calendar named <$name>. You can run occ dav:list-calendars to list calendars URIs for this user.");
}
if (null !== $this->calDav->getCalendarByUri(self::URI_USERS . $userDestination, $name)) {
throw new \InvalidArgumentException("User <$userDestination> already has a calendar named <$name>.");
// Calendar already exists
if ($this->calendarExists($userDestination, $name)) {
* Warn that share links have changed if there are shares
*/
$this->io->note([
"Please note that moving calendar " . $calendar['uri'] . " from user <$userOrigin> to <$userDestination> has caused share links to change.",
"Sharees will need to change \"example.com/remote.php/dav/calendars/uid/" . $calendar['uri'] . "_shared_by_$userOrigin\" to \"example.com/remote.php/dav/calendars/uid/" . $newName ?: $calendar['uri'] . "_shared_by_$userDestination\""
@ -177,14 +236,7 @@ class MoveCalendar extends Command {
}
}
}
/**
* Warn that share links have changed if there are shares
*/
if (count($shares) > 0) {
$this->io->note([
"Please note that moving calendar " . $calendar['uri'] . " from user <$userOrigin> to <$userDestination> has caused share links to change.",
"Sharees will need to change \"example.com/remote.php/dav/calendars/uid/" . $calendar['uri'] . "_shared_by_$userOrigin\" to \"example.com/remote.php/dav/calendars/uid/" . $calendar['uri'] . "_shared_by_$userDestination\""