Skip to content

Commit

Permalink
Core Data: Mark 'canUser' related actions resolvers as resolved (Word…
Browse files Browse the repository at this point in the history
…Press#63435)


Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: youknowriad <[email protected]>
  • Loading branch information
3 people authored and carstingaxion committed Jul 18, 2024
1 parent 361aab6 commit b7045c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/core-data/src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,15 @@ export const canUser =
.join( '/' );

dispatch.receiveUserPermission( key, permissions[ action ] );

// Mark related action resolutions as finished.
if ( action !== requestedAction ) {
dispatch.finishResolution( 'canUser', [
action,
resource,
id,
] );
}
}
} );
};
Expand Down
1 change: 1 addition & 0 deletions packages/core-data/src/test/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ describe( 'canUser', () => {
};
dispatch = Object.assign( jest.fn(), {
receiveUserPermission: jest.fn(),
finishResolution: jest.fn(),
} );
dispatch.mockReturnValue( ENTITIES );
triggerFetch.mockReset();
Expand Down

0 comments on commit b7045c3

Please sign in to comment.