@@ -214,6 +214,7 @@ export const gnSaveContent = (action$, store) =>
214214 ...( data && { 'data' : JSON . parse ( JSON . stringify ( data ) ) } ) ,
215215 ...( extent && { extent } )
216216 } ;
217+ const { compactPermissions } = getPermissionsPayload ( state ) ;
217218 return Observable . defer ( ( ) => SaveAPI [ contentType ] ( state , action . id , body , action . reload ) )
218219 . switchMap ( ( response ) => {
219220 const [ resource , ...actions ] = castArray ( response ) ;
@@ -226,22 +227,34 @@ export const gnSaveContent = (action$, store) =>
226227 window . location . reload ( ) ;
227228 return Observable . empty ( ) ;
228229 }
229- return Observable . of (
230- saveSuccess ( resource ) ,
231- setResource ( {
232- ...currentResource ,
233- ...body ,
234- ...resource
235- } ) ,
236- updateResource ( resource ) ,
237- ...( action . showNotifications
238- ? [
239- action . showNotifications === true
240- ? successNotification ( { title : "saveDialog.saveSuccessTitle" , message : "saveDialog.saveSuccessMessage" } )
241- : warningNotification ( action . showNotifications )
242- ]
243- : [ ] ) ,
244- ...actions // additional actions to be dispatched
230+ return Observable . merge (
231+ Observable . of (
232+ saveSuccess ( resource ) ,
233+ setResource ( {
234+ ...currentResource ,
235+ ...body ,
236+ ...resource
237+ } ) ,
238+ updateResource ( resource ) ,
239+ ...( action . showNotifications
240+ ? [
241+ action . showNotifications === true
242+ ? successNotification ( { title : "saveDialog.saveSuccessTitle" , message : "saveDialog.saveSuccessMessage" } )
243+ : warningNotification ( action . showNotifications )
244+ ]
245+ : [ ] ) ,
246+ ...actions // additional actions to be dispatched
247+ ) ,
248+ ...( compactPermissions ? [
249+ Observable . defer ( ( ) =>
250+ updateCompactPermissionsByPk ( action . id , cleanCompactPermissions ( compactPermissions ) )
251+ . then ( output => ( { resource : currentResource , output, processType : ProcessTypes . PERMISSIONS_RESOURCE } ) )
252+ . catch ( ( error ) => ( { resource : currentResource , error : error ?. data ?. detail || error ?. statusText || error ?. message || true , processType : ProcessTypes . PERMISSIONS_RESOURCE } ) )
253+ )
254+ . switchMap ( ( payload ) => {
255+ return Observable . of ( startAsyncProcess ( payload ) ) ;
256+ } )
257+ ] : [ ] )
245258 ) ;
246259 } )
247260 . catch ( ( error ) => {
@@ -297,8 +310,7 @@ export const gnSaveDirectContent = (action$, store) =>
297310 const state = store . getState ( ) ;
298311 const mapInfo = mapInfoSelector ( state ) ;
299312 const resourceId = mapInfo ?. id || getResourceId ( state ) ;
300- const { compactPermissions, geoLimits } = getPermissionsPayload ( state ) ;
301- const currentResource = getResourceData ( state ) ;
313+ const { geoLimits } = getPermissionsPayload ( state ) ;
302314
303315 return Observable . defer ( ( ) => axios . all ( [
304316 getResourceByPk ( resourceId ) ,
@@ -322,30 +334,18 @@ export const gnSaveDirectContent = (action$, store) =>
322334 extension : resource ?. extension ,
323335 href : resource ?. href
324336 } ;
325- return Observable . concat (
326- ...( compactPermissions ? [
327- Observable . defer ( ( ) =>
328- updateCompactPermissionsByPk ( resourceId , cleanCompactPermissions ( compactPermissions ) )
329- . then ( output => ( { resource : currentResource , output, processType : ProcessTypes . PERMISSIONS_RESOURCE } ) )
330- . catch ( ( error ) => ( { resource : currentResource , error : error ?. data ?. detail || error ?. statusText || error ?. message || true , processType : ProcessTypes . PERMISSIONS_RESOURCE } ) )
331- )
332- . switchMap ( ( payload ) => {
333- return Observable . of ( startAsyncProcess ( payload ) ) ;
334- } )
335- ] : [ ] ) ,
336- Observable . of (
337- saveContent (
338- resourceId ,
339- metadata ,
340- false ,
341- geoLimitsErrors . length > 0
342- ? {
343- title : 'gnviewer.warningGeoLimitsSaveTitle' ,
344- message : 'gnviewer.warningGeoLimitsSaveMessage'
345- }
346- : true /* showNotification */ ) ,
347- resetGeoLimits ( )
348- )
337+ return Observable . of (
338+ saveContent (
339+ resourceId ,
340+ metadata ,
341+ false ,
342+ geoLimitsErrors . length > 0
343+ ? {
344+ title : 'gnviewer.warningGeoLimitsSaveTitle' ,
345+ message : 'gnviewer.warningGeoLimitsSaveMessage'
346+ }
347+ : true /* showNotification */ ) ,
348+ resetGeoLimits ( )
349349 ) ;
350350 } )
351351 . catch ( ( error ) => {
0 commit comments