File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export function NotificationPicker({
35
35
const [ enableNotification , setEnableNotification ] = useState < boolean > (
36
36
model . notification ?. enableNotification ?? true
37
37
) ;
38
+ const sendToString = model . notification ?. sendTo ?. join ( ', ' ) || '' ;
38
39
39
40
const enableNotificationChange = ( e : React . ChangeEvent < HTMLInputElement > ) => {
40
41
const updatedEnableNotification = e . target . checked ;
@@ -68,8 +69,12 @@ export function NotificationPicker({
68
69
69
70
const sendToChange = useCallback (
70
71
( e : React . ChangeEvent < HTMLInputElement > ) => {
71
- const { name, value } = e . target ;
72
- const updatedNotification = { ...model . notification , [ name ] : value } ;
72
+ const { value } = e . target ;
73
+ const sendToArray = value . split ( ',' ) . map ( sendToStr => sendToStr . trim ( ) ) ;
74
+ const updatedNotification = {
75
+ ...model . notification ,
76
+ sendTo : sendToArray
77
+ } ;
73
78
modelChange ( { ...model , notification : updatedNotification } ) ;
74
79
} ,
75
80
[ model , modelChange ]
@@ -108,7 +113,7 @@ export function NotificationPicker({
108
113
109
114
< TextField
110
115
label = { trans . __ ( 'Send To' ) }
111
- value = { model . notification ?. sendTo || '' }
116
+ value = { sendToString }
112
117
name = "sendTo"
113
118
variant = "outlined"
114
119
onChange = { sendToChange }
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ export type ModelWithScheduleFields = {
75
75
} ;
76
76
77
77
export type Notification = {
78
- sendTo ?: string ;
78
+ sendTo ?: string [ ] ;
79
79
enableNotification ?: boolean ;
80
80
availableEvents ?: string [ ] ;
81
81
selectedEvents ?: string [ ] ;
You can’t perform that action at this time.
0 commit comments