We want to add the functionality for the news authors and admins to delete news. To achieve this we can use the permissions and only allow authorized users to delete posts.
Add this trash can icon svg to the assets.
The permissions for each post is stored in the
authMemberProps field, but it's not fetched by default. We have to
add it to the fields when we get the feed.
Now we can use the helper function
hasScopesPermission to check if the user has permission to delete the post.
And if the user doesn't have the permission we don't show the delete icon otherwise clicking on the icon will immediately delete the post.
You can see the final result here.