Skip to content
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

Closed
wants to merge 5 commits into from

Conversation

szaimen
Copy link
Contributor

@szaimen szaimen commented Jun 21, 2022

Closes #1835

Based on #2331
Supersedes #2331
Closes #2331

Signed-off-by: Lukas Boersma <mail@lukas-boersma.com>
Signed-off-by: Lukas Boersma <mail@lukas-boersma.com>
@szaimen szaimen added 2. developing Work in progress enhancement New feature request labels Jun 21, 2022
Signed-off-by: szaimen <szaimen@e.mail.de>
@tcitworld
Copy link
Member

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 <szaimen@e.mail.de>
@szaimen
Copy link
Contributor Author

szaimen commented Jun 21, 2022

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.

yes, please be patient :)

Signed-off-by: szaimen <szaimen@e.mail.de>
@@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$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?!

Copy link
Member

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.

Copy link
Member

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

lib/Controller/SettingsController.php Show resolved Hide resolved
Comment on lines +92 to +93
case 'defaultCalendarId':
return $this->setDefaultCalendarId($value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case 'defaultCalendarId':
return $this->setDefaultCalendarId($value);

Should be moved to the DAV app.

Comment on lines +344 to +364

/**
* 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();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/**
* 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);
Copy link
Member

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?

@jancborchardt
Copy link
Member

jancborchardt commented Oct 20, 2022

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. :)

@tcitworld
Copy link
Member

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.

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.

@st3iny st3iny closed this in #5790 Feb 29, 2024
@st3iny st3iny deleted the enh/4309/default-calendar branch February 29, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress enhancement New feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Defining a default calendar
5 participants