-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting for default calendar when creating new events #4310
Conversation
Signed-off-by: Lukas Boersma <[email protected]>
Signed-off-by: Lukas Boersma <[email protected]>
Signed-off-by: szaimen <[email protected]>
I'm still for moving the picker to the server groupware settings, with the adaptation in calendar such as described in #2331 (comment) In any case you need to use the setting present in dav nextcloud/server#19852, not create another one. |
Signed-off-by: szaimen <[email protected]>
yes, please be patient :) |
Signed-off-by: szaimen <[email protected]>
@@ -93,6 +94,7 @@ public function index():TemplateResponse { | |||
$timezone = $this->config->getUserValue($this->userId, $this->appName, 'timezone', $defaultTimezone); | |||
$slotDuration = $this->config->getUserValue($this->userId, $this->appName, 'slotDuration', $defaultSlotDuration); | |||
$defaultReminder = $this->config->getUserValue($this->userId, $this->appName, 'defaultReminder', $defaultDefaultReminder); | |||
$defaultCalendarIdUser = $this->config->getUserValue($this->userId, $this->appName, 'defaultCalendarId', $defaultCalendarId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$defaultCalendarIdUser = $this->config->getUserValue($this->userId, $this->appName, 'defaultCalendarId', $defaultCalendarId); | |
$defaultCalendarIdUser = $this->config->getUserValue($this->userId, 'dav', 'defaultCalendar', $defaultCalendarId); |
This also needs a reasonable default ($defaultCalendarId) is undefined?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using the calendar id, use the calendar uri, then default to CalDavBackend::PERSONAL_CALENDAR_URI
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The personal calendar always gets recreated at some point if there's nothing else
case 'defaultCalendarId': | ||
return $this->setDefaultCalendarId($value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case 'defaultCalendarId': | |
return $this->setDefaultCalendarId($value); |
Should be moved to the DAV app.
|
||
/** | ||
* sets defaultCalendarId for user | ||
* | ||
* @param string $value User-selected option for default calendar when creating new events | ||
* @return JSONResponse | ||
*/ | ||
private function setDefaultCalendarId(string $value):JSONResponse { | ||
try { | ||
$this->config->setUserValue( | ||
$this->userId, | ||
$this->appName, | ||
'defaultCalendarId', | ||
$value | ||
); | ||
} catch (\Exception $e) { | ||
return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR); | ||
} | ||
|
||
return new JSONResponse(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | |
* sets defaultCalendarId for user | |
* | |
* @param string $value User-selected option for default calendar when creating new events | |
* @return JSONResponse | |
*/ | |
private function setDefaultCalendarId(string $value):JSONResponse { | |
try { | |
$this->config->setUserValue( | |
$this->userId, | |
$this->appName, | |
'defaultCalendarId', | |
$value | |
); | |
} catch (\Exception $e) { | |
return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR); | |
} | |
return new JSONResponse(); | |
} |
Should be moved to the DAV app.
@@ -143,6 +144,7 @@ private function publicIndex(string $token, | |||
$this->initialStateService->provideInitialState($this->appName, 'timezone', $defaultTimezone); | |||
$this->initialStateService->provideInitialState($this->appName, 'slot_duration', $defaultSlotDuration); | |||
$this->initialStateService->provideInitialState($this->appName, 'default_reminder', $defaultDefaultReminder); | |||
$this->initialStateService->provideInitialState($this->appName, 'default_calendar_id', $defaultCalendarId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to provide this on a public view?
Sorry, I’m only seeing this PR now – as said in the issue at #1835 (comment) – this should not be a setting, but rather we should just remember the last calendar you added an event to. This will cover the majority of cases. And otherwise, the calendar on top of the list on the left should be taken as default, that’s an inherent setting. But no specific setting here please. :) |
The default calendar isn't just for creating new events in the calendar, it's also for the place where invitations will end up, and you don't want to have those in the last used calendar. |
Closes #1835
Based on #2331
Supersedes #2331
Closes #2331