-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dav): Add user setting to hide birthdays from deceased contacts
Closes #24742 Signed-off-by: Thomas Citharel <[email protected]>
- Loading branch information
Showing
18 changed files
with
194 additions
and
751 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* @copyright 2023 Thomas Citharel <[email protected]> | ||
* | ||
* @author 2023 Thomas Citharel <[email protected]> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace OCA\DAV\Settings; | ||
|
||
use OCA\DAV\AppInfo\Application; | ||
use OCP\AppFramework\Http\TemplateResponse; | ||
use OCP\AppFramework\Services\IInitialState; | ||
use OCP\IConfig; | ||
use OCP\Settings\ISettings; | ||
use OCP\Util; | ||
|
||
class PersonalCalendarSettings implements ISettings { | ||
protected IConfig $config; | ||
protected IInitialState $initialState; | ||
protected ?string $userId; | ||
|
||
public function __construct(IConfig $config, | ||
IInitialState $initialState, | ||
?string $userId) { | ||
$this->config = $config; | ||
$this->initialState = $initialState; | ||
$this->userId = $userId; | ||
} | ||
|
||
public function getForm(): TemplateResponse { | ||
$this->initialState->provideInitialState( | ||
'show_birthdays_from_deceased_contacts', | ||
$this->config->getUserValue( | ||
$this->userId, | ||
'dav', | ||
'show_birthdays_from_deceased_contacts', | ||
'yes' | ||
) | ||
); | ||
|
||
Util::addScript(Application::APP_ID, 'settings-personal-calendars'); | ||
return new TemplateResponse(Application::APP_ID, 'settings-personal-calendars'); | ||
} | ||
|
||
public function getSection(): string { | ||
return 'calendar'; | ||
} | ||
|
||
public function getPriority(): int { | ||
return 10; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Vue from 'vue' | ||
import { translate } from '@nextcloud/l10n' | ||
import Calendars from './views/Calendars.vue' | ||
|
||
Vue.prototype.$t = translate | ||
|
||
const View = Vue.extend(Calendars); | ||
|
||
(new View({})).$mount('#settings-personal-calendars') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<template> | ||
<NcSettingsSection :title="$t('dav', 'Birthday calendar')"> | ||
<NcCheckboxRadioSwitch :checked.sync="showBirthdaysFromDeceasedContacts"> | ||
{{ $t('dav', 'Show birthdays from deceased contacts') }} | ||
</NcCheckboxRadioSwitch> | ||
<p class="show_birthdays_from_deceased_contacts-hint"> | ||
{{ $t('dav', "You can also exclude specific contacts from the birthday calendar in the Contacts app.") }} | ||
</p> | ||
</NcSettingsSection> | ||
</template> | ||
|
||
<script> | ||
import { loadState } from '@nextcloud/initial-state' | ||
import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch' | ||
import NcSettingsSection from '@nextcloud/vue/dist/Components/NcSettingsSection' | ||
export default { | ||
name: 'Calendars', | ||
components: { | ||
NcCheckboxRadioSwitch, | ||
NcSettingsSection, | ||
}, | ||
data() { | ||
return { | ||
showBirthdaysFromDeceasedContacts: loadState('dav', 'show_birthdays_from_deceased_contacts') === 'yes', | ||
} | ||
}, | ||
watch: { | ||
showBirthdaysFromDeceasedContacts(value) { | ||
OCP.AppConfig.setValue( | ||
'dav', | ||
'show_birthdays_from_deceased_contacts', | ||
value ? 'yes' : 'no' | ||
) | ||
}, | ||
}, | ||
} | ||
</script> | ||
<style lang="scss"> | ||
.show_birthdays_from_deceased_contacts-hint { | ||
opacity: 0.7; | ||
padding-left: 1.5rem; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/** | ||
* @copyright 2023 Thomas Citharel <[email protected]> | ||
* | ||
* @author Thomas Citharel <[email protected]> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
?> | ||
|
||
<div id="settings-personal-calendars"></div> |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.