From 7e05e4c0d941e882c9af2e17c67ca9b44e58afcf Mon Sep 17 00:00:00 2001 From: dakkar Date: Fri, 9 Feb 2024 11:34:44 +0000 Subject: [PATCH] allow disabling achievement notifications #319 This is currently the only configurable notification type that can only be set to "all" or "none", all the others allow filtering by sender user, so I had to tweak the drop-down This opens the way to also eaisly make `note`, `roleAssigned` and `followRequestAccepted` configurable. Tested using the API console and sending requests to `i/claim-achievement`. When the setting was "all", the achievement was notified and it appeared in `/my/achievements`; when the setting was "none", the achievement only appeared in `/my/achievements` but no notification was generated. --- .../notifications.notification-config.vue | 15 +++++++++------ .../frontend/src/pages/settings/notifications.vue | 5 +++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/frontend/src/pages/settings/notifications.notification-config.vue b/packages/frontend/src/pages/settings/notifications.notification-config.vue index 06686c320..d7c8ff753 100644 --- a/packages/frontend/src/pages/settings/notifications.notification-config.vue +++ b/packages/frontend/src/pages/settings/notifications.notification-config.vue @@ -7,10 +7,10 @@ SPDX-License-Identifier: AGPL-3.0-only
- - - - + + + + @@ -32,10 +32,13 @@ import MkSelect from '@/components/MkSelect.vue'; import MkButton from '@/components/MkButton.vue'; import { i18n } from '@/i18n.js'; -const props = defineProps<{ +const props = withDefaults(defineProps<{ value: any; userLists: Misskey.entities.UserList[]; -}>(); + hasSender: boolean; +}>(), { + hasSender: true, +}); const emit = defineEmits<{ (ev: 'update', result: any): void; diff --git a/packages/frontend/src/pages/settings/notifications.vue b/packages/frontend/src/pages/settings/notifications.vue index 8d71e2c28..ce7c48d9b 100644 --- a/packages/frontend/src/pages/settings/notifications.vue +++ b/packages/frontend/src/pages/settings/notifications.vue @@ -21,7 +21,7 @@ SPDX-License-Identifier: AGPL-3.0-only }} - +
@@ -71,7 +71,8 @@ import { notificationTypes } from '@/const.js'; const $i = signinRequired(); -const nonConfigurableNotificationTypes = ['note', 'roleAssigned', 'followRequestAccepted', 'achievementEarned']; +const nonConfigurableNotificationTypes = ['note', 'roleAssigned', 'followRequestAccepted']; +const notificationTypesWithoutSender = ['achievementEarned']; const allowButton = shallowRef>(); const pushRegistrationInServer = computed(() => allowButton.value?.pushRegistrationInServer);