@@ -22,7 +22,6 @@ import {
22
22
LINK_DESTINATION_MEDIA ,
23
23
LINK_DESTINATION_NONE ,
24
24
} from './constants' ;
25
- import { isGalleryV2Enabled } from './shared' ;
26
25
27
26
const DEPRECATED_LINK_DESTINATION_MEDIA = 'file' ;
28
27
const DEPRECATED_LINK_DESTINATION_ATTACHMENT = 'post' ;
@@ -408,11 +407,7 @@ const v6 = {
408
407
) ;
409
408
} ,
410
409
migrate ( attributes ) {
411
- if ( isGalleryV2Enabled ( ) ) {
412
- return runV2Migration ( attributes ) ;
413
- }
414
-
415
- return attributes ;
410
+ return runV2Migration ( attributes ) ;
416
411
} ,
417
412
} ;
418
413
const v5 = {
@@ -498,23 +493,7 @@ const v5 = {
498
493
return ! linkTo || linkTo === 'attachment' || linkTo === 'media' ;
499
494
} ,
500
495
migrate ( attributes ) {
501
- if ( isGalleryV2Enabled ( ) ) {
502
- return runV2Migration ( attributes ) ;
503
- }
504
-
505
- let linkTo = attributes . linkTo ;
506
-
507
- if ( ! attributes . linkTo ) {
508
- linkTo = 'none' ;
509
- } else if ( attributes . linkTo === 'attachment' ) {
510
- linkTo = 'post' ;
511
- } else if ( attributes . linkTo === 'media' ) {
512
- linkTo = 'file' ;
513
- }
514
- return {
515
- ...attributes ,
516
- linkTo,
517
- } ;
496
+ return runV2Migration ( attributes ) ;
518
497
} ,
519
498
save ( { attributes } ) {
520
499
const {
@@ -661,17 +640,7 @@ const v4 = {
661
640
return ids && ids . some ( ( id ) => typeof id === 'string' ) ;
662
641
} ,
663
642
migrate ( attributes ) {
664
- if ( isGalleryV2Enabled ( ) ) {
665
- return runV2Migration ( attributes ) ;
666
- }
667
-
668
- return {
669
- ...attributes ,
670
- ids : ( attributes . ids ?? [ ] ) . map ( ( id ) => {
671
- const parsedId = parseInt ( id , 10 ) ;
672
- return Number . isInteger ( parsedId ) ? parsedId : null ;
673
- } ) ,
674
- } ;
643
+ return runV2Migration ( attributes ) ;
675
644
} ,
676
645
save ( { attributes } ) {
677
646
const {
@@ -867,10 +836,7 @@ const v3 = {
867
836
) ;
868
837
} ,
869
838
migrate ( attributes ) {
870
- if ( isGalleryV2Enabled ( ) ) {
871
- return runV2Migration ( attributes ) ;
872
- }
873
- return attributes ;
839
+ return runV2Migration ( attributes ) ;
874
840
} ,
875
841
} ;
876
842
const v2 = {
@@ -936,18 +902,7 @@ const v2 = {
936
902
) ;
937
903
} ,
938
904
migrate ( attributes ) {
939
- if ( isGalleryV2Enabled ( ) ) {
940
- return runV2Migration ( attributes ) ;
941
- }
942
- return {
943
- ...attributes ,
944
- ids : ( attributes . images ?? [ ] ) . map ( ( { id } ) => {
945
- if ( ! id ) {
946
- return null ;
947
- }
948
- return parseInt ( id , 10 ) ;
949
- } ) ,
950
- } ;
905
+ return runV2Migration ( attributes ) ;
951
906
} ,
952
907
supports : {
953
908
align : true ,
@@ -1100,11 +1055,7 @@ const v1 = {
1100
1055
) ;
1101
1056
} ,
1102
1057
migrate ( attributes ) {
1103
- if ( isGalleryV2Enabled ( ) ) {
1104
- return runV2Migration ( attributes ) ;
1105
- }
1106
-
1107
- return attributes ;
1058
+ return runV2Migration ( attributes ) ;
1108
1059
} ,
1109
1060
} ;
1110
1061
0 commit comments