File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -284,8 +284,9 @@ public function feedzy_register_rest_route() {
284284 array (
285285 'methods ' => 'POST ' ,
286286 'callback ' => array ( $ this , 'feedzy_rest_route ' ),
287- 'permission_callback ' => function () {
288- return current_user_can ( 'manage_options ' );
287+ 'permission_callback ' => function ( WP_REST_Request $ request ) {
288+ $ post_id = $ request ->get_param ( 'postId ' );
289+ return current_user_can ( 'edit_post ' , $ post_id );
289290 },
290291 'args ' => array (
291292 'url ' => array (
Original file line number Diff line number Diff line change @@ -194,11 +194,12 @@ class Editor extends Component {
194194 . filter ( ( item ) => item !== '' ) ;
195195 url = queryString . stringify ( { url } , { arrayFormat : 'bracket' } ) ;
196196 }
197+ const postId = wp . data . select ( 'core/editor' ) . getCurrentPostId ( ) ;
197198
198199 apiFetch ( {
199200 path : `/feedzy/v1/feed?${ url } ` ,
200201 method : 'POST' ,
201- data : this . props . attributes ,
202+ data : { ... this . props . attributes , postId : postId } ,
202203 } )
203204 . then ( ( data ) => {
204205 if ( this . unmounting ) {
You can’t perform that action at this time.
0 commit comments