@@ -311,50 +311,52 @@ export const AddEditModal: FC<{
311311 maximumCharacters : values [ v ] . maximumCharacters ,
312312 } ) ) ;
313313
314- for ( const key of allKeys ) {
315- if ( key . checkValidity ) {
316- const check = await key . checkValidity (
317- key ?. value . map ( ( p : any ) => p . image || [ ] ) ,
318- key . settings
319- ) ;
320- if ( typeof check === 'string' ) {
321- toaster . show ( check , 'warning' ) ;
322- return ;
314+ if ( type !== 'draft' ) {
315+ for ( const key of allKeys ) {
316+ if ( key . checkValidity ) {
317+ const check = await key . checkValidity (
318+ key ?. value . map ( ( p : any ) => p . image || [ ] ) ,
319+ key . settings
320+ ) ;
321+ if ( typeof check === 'string' ) {
322+ toaster . show ( check , 'warning' ) ;
323+ return ;
324+ }
323325 }
324- }
325326
326- if (
327- key . value . some ( ( p ) => {
328- return (
329- countCharacters ( p . content , key ?. integration ?. identifier || '' ) >
330- ( key . maximumCharacters || 1000000 )
331- ) ;
332- } )
333- ) {
334327 if (
335- ! ( await deleteDialog (
336- `${ key ?. integration ?. name } post is too long, it will be cropped, do you want to continue?` ,
337- 'Yes, continue'
338- ) )
328+ key . value . some ( ( p ) => {
329+ return (
330+ countCharacters ( p . content , key ?. integration ?. identifier || '' ) >
331+ ( key . maximumCharacters || 1000000 )
332+ ) ;
333+ } )
339334 ) {
340- await key . trigger ( ) ;
341- moveToIntegration ( {
342- identifier : key ?. integration ?. id ! ,
343- toPreview : true ,
344- } ) ;
345- return ;
335+ if (
336+ ! ( await deleteDialog (
337+ `${ key ?. integration ?. name } post is too long, it will be cropped, do you want to continue?` ,
338+ 'Yes, continue'
339+ ) )
340+ ) {
341+ await key . trigger ( ) ;
342+ moveToIntegration ( {
343+ identifier : key ?. integration ?. id ! ,
344+ toPreview : true ,
345+ } ) ;
346+ return ;
347+ }
346348 }
347- }
348349
349- if ( key . value . some ( ( p ) => ! p . content || p . content . length < 6 ) ) {
350- setShowError ( true ) ;
351- return ;
352- }
350+ if ( key . value . some ( ( p ) => ! p . content || p . content . length < 6 ) ) {
351+ setShowError ( true ) ;
352+ return ;
353+ }
353354
354- if ( ! key . valid ) {
355- await key . trigger ( ) ;
356- moveToIntegration ( { identifier : key ?. integration ?. id ! } ) ;
357- return ;
355+ if ( ! key . valid ) {
356+ await key . trigger ( ) ;
357+ moveToIntegration ( { identifier : key ?. integration ?. id ! } ) ;
358+ return ;
359+ }
358360 }
359361 }
360362
@@ -753,6 +755,9 @@ export const AddEditModal: FC<{
753755 ? 'Submit for order'
754756 : ! existingData . integration
755757 ? 'Add to calendar'
758+ : // @ts -ignore
759+ existingData ?. posts ?. [ 0 ] ?. state === 'DRAFT'
760+ ? 'Schedule'
756761 : 'Update' }
757762 </ div >
758763 { ! postFor && (
0 commit comments