wp-webhook-netlify-deploy icon indicating copy to clipboard operation
wp-webhook-netlify-deploy copied to clipboard

ES6 - remove jQuery

Open lukethacoder opened this issue 5 years ago • 4 comments

refactor JavaScript code to allow to remove dependency on jQuery

lukethacoder avatar Jun 04 '19 13:06 lukethacoder

Refactor the whole JavaScript side of the plugin to allow for dynamically pulling what is needed based on:

User Permissions/Roles

  • netlify_status_capability // can see status of deploy
  • netlify_deploy_capability // can send a deploy
  • netlify_adjust_settings_capability // can adjust developer settings

and

User position

  • Developer Settings Page
  • General Deployment / Preview Page
  • Non-Plugin based page (still need some js for admin bar functionality)

lukethacoder avatar Sep 03 '19 11:09 lukethacoder

I can understand the need to refactor the JS outside of the PHP, but what is the reason for needing to only load specific sections? The code is so small that loading it all shouldn't make much difference?

robmarshall avatar Sep 22 '19 11:09 robmarshall

Was considering more of the security aspect to it. Loading only what the currently logged in user should physically be able to do was the initial idea.

Suppose the worst they could do is fire off a few builds or edit some auth keys they arnt supposed to. Bit of over engineering for such a small plugin.

lukethacoder avatar Sep 22 '19 21:09 lukethacoder

The security side could be managed via WordPress localisation. Keep JS the same, but only pass the access keys across if user has a specific role. That way if they do try and force it, they don't have any details to trigger. Would worse case scenario cause an error.

robmarshall avatar Sep 22 '19 21:09 robmarshall