DEV: Allow callback to be registered to remove post menu button. (PR #15061)

This will allow buttons in the post menu to be remove based on a post’s attributes or site settings.

GitHub

This pull request introduces 1 alert when merging a9f0e804da9eaa5a58a374f0c7c268122d55bcec into 44be79f095268bfe11856ee4132197a6ab595fe0 - view on LGTM.com

new alerts:

  • 1 for Unvalidated dynamic method call

This would end up being a false positive previously if the test above wasn’t run first and leaked its state.

This pull request introduces 1 alert when merging 33eb35c34acbeda1efd6e3db2d09520f37d0fedb into 44be79f095268bfe11856ee4132197a6ab595fe0 - view on LGTM.com

new alerts:

  • 1 for Unvalidated dynamic method call

This pull request introduces 1 alert when merging 33eb35c into 44be79f - view on LGTM.com

new alerts:

  • 1 for Unvalidated dynamic method call

I looked into this and I have no idea what I need to do here. From the code perspective, I already have a conditional to make sure the name key is valid before calling the callback.

Do we need that loop to reset? Can we just set _extraButtons = {}; ?

I am curious if we can add afterEach to top level right after setupRenderingTest(hooks); like

hooks.afterEach

O nice this works :slight_smile:

You’re right here, we can just reset the object.

@lis2 I’ve updated the PR per your comment :slight_smile:

This pull request introduces 1 alert when merging 1336bb8c0003fed3fec647f0072f6866adfe974b into 44be79f095268bfe11856ee4132197a6ab595fe0 - view on LGTM.com

new alerts:

  • 1 for Unvalidated dynamic method call

Thank you for reviewing @lis2