Skip to content

Commit 67d043c

Browse files
tahierhussainclaude
andcommitted
fix: default notification emails to current user and add validation
- Pre-populate notification_emails field with current user's email - Add email validation to reject invalid email formats - Update tooltip text 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4bdec24 commit 67d043c

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

frontend/src/ide/scheduler/JobDeploy.jsx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
import { checkPermission } from "../../common/helpers";
3838
import { useNotificationService } from "../../service/notification-service";
3939
import { useProjectStore } from "../../store/project-store";
40+
import { useSessionStore } from "../../store/session-store";
4041
import { useJobService } from "./service";
4142
import { CronFields } from "./CronFields";
4243
import { IntervalFields } from "./IntervalFields";
@@ -98,6 +99,8 @@ const JobDeploy = memo(function JobDeploy({
9899
const canWrite = checkPermission("JOB_DEPLOYMENT", "can_write");
99100
const { notify } = useNotificationService();
100101
const { projectId } = useProjectStore();
102+
const { sessionDetails } = useSessionStore();
103+
const userEmail = sessionDetails?.email || "";
101104
const {
102105
createTask,
103106
updateTask,
@@ -410,7 +413,7 @@ const JobDeploy = memo(function JobDeploy({
410413
max_retries: 0,
411414
notify_on_failure: false,
412415
notify_on_success: false,
413-
notification_emails: [],
416+
notification_emails: userEmail ? [userEmail] : [],
414417
trigger_on_complete: null,
415418
}}
416419
>
@@ -669,7 +672,27 @@ const JobDeploy = memo(function JobDeploy({
669672
<Form.Item
670673
label="Notification Emails"
671674
name="notification_emails"
672-
tooltip="Comma-separated email addresses"
675+
tooltip="Enter email addresses"
676+
rules={[
677+
{
678+
validator: (_, value) => {
679+
if (!value || value.length === 0)
680+
return Promise.resolve();
681+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
682+
const invalid = value.filter(
683+
(e) => !emailRegex.test(e)
684+
);
685+
if (invalid.length > 0) {
686+
return Promise.reject(
687+
new Error(
688+
`Invalid email(s): ${invalid.join(", ")}`
689+
)
690+
);
691+
}
692+
return Promise.resolve();
693+
},
694+
},
695+
]}
673696
>
674697
<Select
675698
mode="tags"

0 commit comments

Comments
 (0)