diff --git a/webapp/pages/settings/notifications.vue b/webapp/pages/settings/notifications.vue
index 08915ba81..5d56bbd74 100644
--- a/webapp/pages/settings/notifications.vue
+++ b/webapp/pages/settings/notifications.vue
@@ -8,13 +8,13 @@
-
+
{{ $t('settings.notifications.checkAll') }}
-
+
{{ $t('settings.notifications.uncheckAll') }}
-
+
{{ $t('actions.save') }}
@@ -34,12 +34,22 @@ export default {
...mapGetters({
currentUser: 'auth/user',
}),
- disabled() {
+ isSubmitDisabled() {
return Object.entries(this.emailNotificationSettings).every(
// TODO deep equals
(value, index) => value === this.currentUser.emailNotificationSettings[index],
)
},
+ isCheckAllDisabled() {
+ return Object.entries(this.emailNotificationSettings).every(
+ (topic) => topic[1].settings.every(setting => setting.value),
+ )
+ },
+ isUncheckAllDisabled() {
+ return Object.entries(this.emailNotificationSettings).every(
+ (topic) => topic[1].settings.every(setting => !setting.value),
+ )
+ },
},
created() {
this.emailNotificationSettings = [ ...this.currentUser.emailNotificationSettings.map(topic => ({
@@ -55,14 +65,16 @@ export default {
setCurrentUser: 'auth/SET_USER',
}),
setAll(value) {
- for (const key of Object.keys(this.emailNotificationSettings)) {
- this.emailNotificationSettings[key] = value
+ for (const topic of this.emailNotificationSettings) {
+ for (const setting of topic.settings) {
+ setting.value = value
+ }
}
},
- activateAll() {
+ checkAll() {
this.setAll(true)
},
- deactivateAll() {
+ uncheckAll() {
this.setAll(false)
},
transformToEmailSettingsInput(emailSettings) {