Setting for default calendar when creating new events#4310
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]>
| $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.
| $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.
Instead of using the calendar id, use the calendar uri, then default to CalDavBackend::PERSONAL_CALENDAR_URI.
There was a problem hiding this comment.
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.
| 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.
| /** | |
| * 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.
| $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.
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