@@ -520,19 +520,6 @@ public JsonResult Localisation(string p_path)
520
520
var model = apiHelper . PathLocalisation ( p_path ) ;
521
521
return Json ( model ) ;
522
522
}
523
- [ Authorize ( Roles = PuckRoles . Puck , AuthenticationSchemes = Mvc . AuthenticationScheme ) ]
524
- public JsonResult RootsLocalisations ( string ids )
525
- {
526
- var guids = ids . Split ( new char [ ] { ',' } , StringSplitOptions . RemoveEmptyEntries ) . Select ( x => Guid . Parse ( x ) ) ;
527
- var result = new List < dynamic > ( ) ;
528
- foreach ( var guid in guids )
529
- {
530
- var revision = repo . PublishedOrCurrentRevisions ( guid ) . FirstOrDefault ( ) ;
531
- var variant = apiHelper . PathLocalisation ( revision . Path ) ;
532
- result . Add ( new { path = revision . Path . ToLower ( ) , variant = variant } ) ;
533
- }
534
- return Json ( result ) ;
535
- }
536
523
[ Authorize ( Roles = PuckRoles . Localisation , AuthenticationSchemes = Mvc . AuthenticationScheme ) ]
537
524
[ HttpPost ]
538
525
public JsonResult Localisation ( string p_path , string variant )
@@ -541,7 +528,8 @@ public JsonResult Localisation(string p_path, string variant)
541
528
bool success = false ;
542
529
try
543
530
{
544
- apiHelper . SetLocalisation ( p_path , variant ) ;
531
+ if ( apiHelper . PathLocalisation ( p_path ) != variant )
532
+ apiHelper . SetLocalisation ( p_path , variant ) ;
545
533
success = true ;
546
534
}
547
535
catch ( Exception ex )
@@ -551,6 +539,19 @@ public JsonResult Localisation(string p_path, string variant)
551
539
}
552
540
return Json ( new { message = message , success = success } ) ;
553
541
}
542
+ [ Authorize ( Roles = PuckRoles . Puck , AuthenticationSchemes = Mvc . AuthenticationScheme ) ]
543
+ public JsonResult RootsLocalisations ( string ids )
544
+ {
545
+ var guids = ids . Split ( new char [ ] { ',' } , StringSplitOptions . RemoveEmptyEntries ) . Select ( x => Guid . Parse ( x ) ) ;
546
+ var result = new List < dynamic > ( ) ;
547
+ foreach ( var guid in guids )
548
+ {
549
+ var revision = repo . PublishedOrCurrentRevisions ( guid ) . FirstOrDefault ( ) ;
550
+ var variant = apiHelper . PathLocalisation ( revision . Path ) ;
551
+ result . Add ( new { path = revision . Path . ToLower ( ) , variant = variant } ) ;
552
+ }
553
+ return Json ( result ) ;
554
+ }
554
555
[ Authorize ( Roles = PuckRoles . ChangeType , AuthenticationSchemes = Mvc . AuthenticationScheme ) ]
555
556
public ActionResult ChangeTypeDialog ( Guid id )
556
557
{
0 commit comments