From d5cef1e66f5e81e2605151da023d43087cbb90f7 Mon Sep 17 00:00:00 2001 From: Collin Beczak Date: Fri, 5 Jun 2026 13:43:29 -0300 Subject: [PATCH] Add task-lock-expiring-soon notification subscription Mirrors the new backend `taskUnlockWarning` subscription so users can opt in to email warnings before their locked tasks auto-unlock. Defaults to "No Email"; users flip it to "Immediate Email" in their profile settings. --- src/pages/Profile/Messages.js | 6 ++++++ .../Profile/UserSettings/NotificationSettingsSchema.jsx | 5 +++++ src/services/Notification/NotificationType/Messages.js | 4 ++++ .../Notification/NotificationType/NotificationType.js | 3 +++ 4 files changed, 18 insertions(+) diff --git a/src/pages/Profile/Messages.js b/src/pages/Profile/Messages.js index 0ee20b75b..886946964 100644 --- a/src/pages/Profile/Messages.js +++ b/src/pages/Profile/Messages.js @@ -272,6 +272,12 @@ export default defineMessages({ "Receive a notification when your review status is updated by another reviewer.", }, + taskUnlockWarningNotificationsDescription: { + id: "Profile.form.taskUnlockWarningNotifications.description", + defaultMessage: + "Receive an email shortly before one of your locked tasks is about to be auto-unlocked. Useful when working in an external editor like JOSM.", + }, + reviewCountNotificationsDescription: { id: "Profile.form.reviewCountNotifications.description", defaultMessage: diff --git a/src/pages/Profile/UserSettings/NotificationSettingsSchema.jsx b/src/pages/Profile/UserSettings/NotificationSettingsSchema.jsx index 9804ffe4d..9f1c855df 100644 --- a/src/pages/Profile/UserSettings/NotificationSettingsSchema.jsx +++ b/src/pages/Profile/UserSettings/NotificationSettingsSchema.jsx @@ -115,6 +115,7 @@ export const jsSchema = (intl) => { team: notificationObject.team, follow: notificationObject.follow, metaReview: notificationObject.metaReview, + taskUnlockWarning: notificationObject.taskUnlockWarning, reviewCount: notificationObject.reviewCount, revisionCount: notificationObject.revisionCount, }, @@ -185,6 +186,10 @@ export const uiSchema = (intl) => { "ui:help": intl.formatMessage(messages.metaReviewNotificationsDescription), "ui:FieldTemplate": CustomNotificationFieldTemplate, }, + taskUnlockWarning: { + "ui:help": intl.formatMessage(messages.taskUnlockWarningNotificationsDescription), + "ui:FieldTemplate": CustomNotificationFieldTemplate, + }, reviewCount: { "ui:help": intl.formatMessage(messages.reviewCountNotificationsDescription), "ui:FieldTemplate": CustomNotificationFieldTemplate, diff --git a/src/services/Notification/NotificationType/Messages.js b/src/services/Notification/NotificationType/Messages.js index d54ff0d37..2fa52e8e1 100644 --- a/src/services/Notification/NotificationType/Messages.js +++ b/src/services/Notification/NotificationType/Messages.js @@ -64,6 +64,10 @@ export default defineMessages({ id: "Notification.type.taskUnlockRequest", defaultMessage: "Task Unlock Request", }, + taskUnlockWarning: { + id: "Notification.type.taskUnlockWarning", + defaultMessage: "Task Lock Expiring Soon", + }, }); export const subscriptionCountMessages = defineMessages({ diff --git a/src/services/Notification/NotificationType/NotificationType.js b/src/services/Notification/NotificationType/NotificationType.js index e942a4db4..bc45dd5a3 100644 --- a/src/services/Notification/NotificationType/NotificationType.js +++ b/src/services/Notification/NotificationType/NotificationType.js @@ -20,6 +20,7 @@ export const NOTIFICATION_TYPE_REVIEW_COUNT = 12; export const NOTIFICATION_TYPE_REVISION_COUNT = 13; export const NOTIFICATION_TYPE_CHALLENGE_COMMENT = 14; export const NOTIFICATION_TYPE_TASK_UNLOCK_REQUEST = 15; +export const NOTIFICATION_TYPE_TASK_UNLOCK_WARNING = 16; export const NotificationType = Object.freeze({ system: NOTIFICATION_TYPE_SYSTEM, @@ -36,6 +37,7 @@ export const NotificationType = Object.freeze({ metaReviewAgain: NOTIFICATION_TYPE_META_REVIEW_AGAIN, challengeComment: NOTIFICATION_TYPE_CHALLENGE_COMMENT, taskUnlockRequest: NOTIFICATION_TYPE_TASK_UNLOCK_REQUEST, + taskUnlockWarning: NOTIFICATION_TYPE_TASK_UNLOCK_WARNING, }); export const NotificationSubscriptionType = Object.freeze({ @@ -48,6 +50,7 @@ export const NotificationSubscriptionType = Object.freeze({ team: NOTIFICATION_TYPE_TEAM, follow: NOTIFICATION_TYPE_FOLLOW, metaReview: NOTIFICATION_TYPE_META_REVIEW, + taskUnlockWarning: NOTIFICATION_TYPE_TASK_UNLOCK_WARNING, }); export const NotificationCountType = Object.freeze({