@@ -170,6 +170,9 @@ function constructTree(
170170 const local_id = compositeIdToString ( s [ 0 ] ) ;
171171
172172 if ( local_id === proxy_id ) {
173+ if ( s . length === 1 ) {
174+ s [ s . length ] = [ ] ;
175+ }
173176 stub = s [ 1 ] ;
174177 break ;
175178
@@ -180,7 +183,7 @@ function constructTree(
180183 }
181184
182185 // Getting stub of tree only if common_point exists
183- // otherwise the function gets full tree so this makes no sense
186+ // otherwise the function returns full tree so this makes no sense
184187 if ( common_point ) {
185188 g ( stub ) ;
186189 }
@@ -484,6 +487,7 @@ const DictionariesAll = ({ forCorpora = false, forParallelCorpora = false }) =>
484487
485488 const sortModeList = forCorpora || forParallelCorpora ? [ "language" ] : [ "language" , "grant" , "organization" ] ;
486489 const proxy = ( config . buildType !== "server" ) ;
490+ const allowed_sync = ( user . user . id === 1 || user . user . allowed_sync ) ;
487491
488492 for ( const aSortMode of sortModeList ) {
489493 const variablesId = { ...variables } ;
@@ -516,15 +520,15 @@ const DictionariesAll = ({ forCorpora = false, forParallelCorpora = false }) =>
516520 } ) ;
517521
518522 queryDictIdProxy [ aSortMode ] = useQuery ( getLanguageTree , {
519- variables : { ...variablesId , proxy } ,
523+ variables : { ...variablesId , proxy : allowed_sync } ,
520524 fetchPolicy : "cache-and-network" ,
521- skip : skip_general || ! proxy || ! entityIdValue || aSortMode != sortMode
525+ skip : skip_general || ! allowed_sync || ! entityIdValue || aSortMode != sortMode
522526 } ) ;
523527
524528 queryDictAllProxy [ aSortMode ] = useQuery ( getLanguageTree , {
525- variables : { ...variablesAll , proxy } ,
529+ variables : { ...variablesAll , proxy : allowed_sync } ,
526530 fetchPolicy : "cache-and-network" ,
527- skip : skip_general || ! proxy || activeTab !== "1" || aSortMode != sortMode
531+ skip : skip_general || ! allowed_sync || activeTab !== "1" || aSortMode != sortMode
528532 } ) ;
529533 }
530534
@@ -574,7 +578,7 @@ const DictionariesAll = ({ forCorpora = false, forParallelCorpora = false }) =>
574578 ( sortMode === "grant" && ! grantMap ) ||
575579 ( sortMode === "organization" && ! organizationMap ) ||
576580 ( proxy && ! proxyPermission ) ||
577- ( proxy && ! dataTreeIdProxy )
581+ ( allowed_sync && ! dataTreeIdProxy )
578582 ) {
579583 return ;
580584 }
@@ -622,7 +626,7 @@ const DictionariesAll = ({ forCorpora = false, forParallelCorpora = false }) =>
622626 ( sortMode === "grant" && ! grantMap ) ||
623627 ( sortMode === "organization" && ! organizationMap ) ||
624628 ( proxy && ! proxyPermission ) ||
625- ( proxy && ! dataTreeAllProxy )
629+ ( allowed_sync && ! dataTreeAllProxy )
626630 ) {
627631 return ;
628632 }
0 commit comments