aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/src/views/Availability.vue
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-05-24 15:49:34 +0200
committerJoas Schilling <coding@schilljs.com>2022-07-01 12:33:07 +0200
commit4f7f4d74db0464b255eeedd4890b0604540e1e60 (patch)
treec1ea3cc60c8353c0aaed100733adf5b01611956b /apps/dav/src/views/Availability.vue
parent5dee54d70bcd207c9b96a4cf6bb58f82fe9fbba9 (diff)
downloadnextcloud-server-4f7f4d74db0464b255eeedd4890b0604540e1e60.tar.gz
nextcloud-server-4f7f4d74db0464b255eeedd4890b0604540e1e60.zip
Add UI to opt-in on the status automation
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/dav/src/views/Availability.vue')
-rw-r--r--apps/dav/src/views/Availability.vue17
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/dav/src/views/Availability.vue b/apps/dav/src/views/Availability.vue
index f3b3ec34bd2..0441f5e9dc7 100644
--- a/apps/dav/src/views/Availability.vue
+++ b/apps/dav/src/views/Availability.vue
@@ -24,6 +24,10 @@
:l10n-saturday="$t('dav', 'Saturday')"
:l10n-sunday="$t('dav', 'Sunday')" />
+ <CheckboxRadioSwitch :checked.sync="automated">
+ {{ $t('dav', 'Automatically set user status to "Do not distrub" outside of visibility to mute all notifications.') }}
+ </CheckboxRadioSwitch>
+
<Button :disabled="loading || saving"
type="primary"
@click="save">
@@ -34,6 +38,7 @@
<script>
import { CalendarAvailability } from '@nextcloud/calendar-availability-vue'
+import { loadState } from '@nextcloud/initial-state'
import {
showError,
showSuccess,
@@ -43,8 +48,13 @@ import {
getEmptySlots,
saveScheduleInboxAvailability,
} from '../service/CalendarService'
+import {
+ enableUserStatusAutomation,
+ disableUserStatusAutomation,
+} from '../service/PreferenceService'
import jstz from 'jstimezonedetect'
import Button from '@nextcloud/vue/dist/Components/Button'
+import CheckboxRadioSwitch from '@nextcloud/vue/dist/Components/CheckboxRadioSwitch'
import SettingsSection from '@nextcloud/vue/dist/Components/SettingsSection'
import TimezonePicker from '@nextcloud/vue/dist/Components/TimezonePicker'
@@ -52,6 +62,7 @@ export default {
name: 'Availability',
components: {
Button,
+ CheckboxRadioSwitch,
CalendarAvailability,
SettingsSection,
TimezonePicker,
@@ -66,6 +77,7 @@ export default {
saving: false,
timezone: defaultTimezoneId,
slots: getEmptySlots(),
+ automated: loadState('dav', 'user_status_automation') === 'yes',
}
},
async mounted() {
@@ -96,6 +108,11 @@ export default {
this.saving = true
await saveScheduleInboxAvailability(this.slots, this.timezone)
+ if (this.automated) {
+ await enableUserStatusAutomation()
+ } else {
+ await disableUserStatusAutomation()
+ }
showSuccess(t('dav', 'Saved availability'))
} catch (e) {