From 5af64a2c75cde0ef0317a6dbb479b1999edd1d6e Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Wed, 12 Aug 2020 16:26:55 +0530 Subject: [PATCH 1/3] Add permission callback to REST API --- class-otter-blocks.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/class-otter-blocks.php b/class-otter-blocks.php index ee9781771..1fbf5b31d 100644 --- a/class-otter-blocks.php +++ b/class-otter-blocks.php @@ -294,6 +294,9 @@ public function register_routes() { array( 'methods' => \WP_REST_Server::DELETABLE, 'callback' => array( $this, 'regenerate_styles' ), + 'permission_callback' => function () { + return current_user_can( 'manage_options' ); + }, ), ) ); From b42597cab671803c0da52f40d6d1df7b7d1b52e5 Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Wed, 12 Aug 2020 16:29:35 +0530 Subject: [PATCH 2/3] Update packages --- composer.lock | 20 ++++++------- package-lock.json | 76 ++++++++++++++--------------------------------- package.json | 6 ++-- 3 files changed, 36 insertions(+), 66 deletions(-) diff --git a/composer.lock b/composer.lock index 73b4ae473..b54aad051 100644 --- a/composer.lock +++ b/composer.lock @@ -50,16 +50,16 @@ }, { "name": "codeinwp/gutenberg-blocks", - "version": "1.5.4", + "version": "1.5.6", "source": { "type": "git", "url": "https://github.com/Codeinwp/gutenberg-blocks.git", - "reference": "6ae404626b17e9677f5340da22d31f8f9a5279fd" + "reference": "ec7de44221a23f77c2e2b7448153976a73192955" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeinwp/gutenberg-blocks/zipball/6ae404626b17e9677f5340da22d31f8f9a5279fd", - "reference": "6ae404626b17e9677f5340da22d31f8f9a5279fd", + "url": "https://api.github.com/repos/Codeinwp/gutenberg-blocks/zipball/ec7de44221a23f77c2e2b7448153976a73192955", + "reference": "ec7de44221a23f77c2e2b7448153976a73192955", "shasum": "" }, "require": { @@ -90,7 +90,7 @@ ], "description": "A set of awesome Gutenberg Blocks!", "homepage": "https://github.com/Codeinwp/gutenberg-blocks", - "time": "2020-08-03T06:25:38+00:00" + "time": "2020-08-12T10:55:29+00:00" }, { "name": "codeinwp/gutenberg-css", @@ -511,16 +511,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.5", + "version": "3.5.6", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6" + "reference": "e97627871a7eab2f70e59166072a6b767d5834e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/73e2e7f57d958e7228fce50dc0c61f58f017f9f6", - "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e97627871a7eab2f70e59166072a6b767d5834e0", + "reference": "e97627871a7eab2f70e59166072a6b767d5834e0", "shasum": "" }, "require": { @@ -558,7 +558,7 @@ "phpcs", "standards" ], - "time": "2020-04-17T01:09:41+00:00" + "time": "2020-08-10T04:50:15+00:00" }, { "name": "wp-coding-standards/wpcs", diff --git a/package-lock.json b/package-lock.json index 643700265..e30103476 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,16 +25,16 @@ } }, "@babel/core": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.11.0.tgz", - "integrity": "sha512-mkLq8nwaXmDtFmRkQ8ED/eA2CnVw4zr7dCztKalZXBvdK5EeNUAesrrwUqjQEzFgomJssayzB0aqlOsP1vGLqg==", + "version": "7.11.1", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.11.1.tgz", + "integrity": "sha512-XqF7F6FWQdKGGWAzGELL+aCO1p+lRY5Tj5/tbT3St1G8NaH70jhhDIKknIZaDans0OQBG5wRAldROLHSt44BgQ==", "dev": true, "requires": { "@babel/code-frame": "^7.10.4", "@babel/generator": "^7.11.0", "@babel/helper-module-transforms": "^7.11.0", "@babel/helpers": "^7.10.4", - "@babel/parser": "^7.11.0", + "@babel/parser": "^7.11.1", "@babel/template": "^7.10.4", "@babel/traverse": "^7.11.0", "@babel/types": "^7.11.0", @@ -57,12 +57,6 @@ "@babel/highlight": "^7.10.4" } }, - "@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", - "dev": true - }, "@babel/highlight": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", @@ -74,16 +68,11 @@ "js-tokens": "^4.0.0" } }, - "@babel/types": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", - "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.10.4", - "lodash": "^4.17.19", - "to-fast-properties": "^2.0.0" - } + "@babel/parser": { + "version": "7.11.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.11.3.tgz", + "integrity": "sha512-REo8xv7+sDxkKvoxEywIdsNFiZLybwdI7hcT5uEPyQrSMB4YQ973BfC9OOrD/81MaIjh6UxdulIQXkjmiH3PcA==", + "dev": true }, "lodash": { "version": "4.17.19", @@ -718,31 +707,6 @@ "@babel/template": "^7.10.4", "@babel/traverse": "^7.10.4", "@babel/types": "^7.10.4" - }, - "dependencies": { - "@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", - "dev": true - }, - "@babel/types": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz", - "integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.10.4", - "lodash": "^4.17.19", - "to-fast-properties": "^2.0.0" - } - }, - "lodash": { - "version": "4.17.19", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", - "dev": true - } } }, "@babel/highlight": { @@ -5065,9 +5029,9 @@ } }, "css-loader": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-4.2.0.tgz", - "integrity": "sha512-ko7a9b0iFpWtk9eSI/C8IICvZeGtYnjxYjw45rJprokXj/+kBd/siX4vAIBq9Uij8Jubc4jL1EvSnTjCEwaHSw==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-4.2.1.tgz", + "integrity": "sha512-MoqmF1if7Z0pZIEXA4ZF9PgtCXxWbfzfJM+3p+OYfhcrwcqhaCRb74DSnfzRl7e024xEiCRn5hCvfUbTf2sgFA==", "dev": true, "requires": { "camelcase": "^6.0.0", @@ -14084,14 +14048,14 @@ } }, "sass-loader": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-9.0.2.tgz", - "integrity": "sha512-nphcum3jNI442njnrZ5wJgSNX5lfEOHOKHCLf+PrTIaleploKqAMUuT9CVKjf+lyi6c2MCGPHh1vb9nGsjnZJA==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-9.0.3.tgz", + "integrity": "sha512-fOwsP98ac1VMme+V3+o0HaaMHp8Q/C9P+MUazLFVi3Jl7ORGHQXL1XeRZt3zLSGZQQPC8xE42Y2WptItvGjDQg==", "dev": true, "requires": { - "klona": "^1.1.1", + "klona": "^1.1.2", "loader-utils": "^2.0.0", - "neo-async": "^2.6.1", + "neo-async": "^2.6.2", "schema-utils": "^2.7.0", "semver": "^7.3.2" }, @@ -14131,6 +14095,12 @@ "json5": "^2.1.2" } }, + "neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true + }, "schema-utils": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz", diff --git a/package.json b/package.json index 13e905d49..c00d66c7f 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "react-notifications-component": "^2.4.0" }, "devDependencies": { - "@babel/core": "^7.11.0", + "@babel/core": "^7.11.1", "@babel/plugin-proposal-object-rest-spread": "^7.11.0", "@babel/plugin-transform-async-to-generator": "^7.10.4", "@babel/plugin-transform-react-jsx": "^7.10.4", @@ -46,7 +46,7 @@ "babel-loader": "^8.1.0", "conventional-changelog-simple-preset": "^1.0.14", "cross-env": "7.0.2", - "css-loader": "^4.2.0", + "css-loader": "^4.2.1", "eslint": "^7.6.0", "eslint-config-wordpress": "^2.0.0", "eslint-loader": "^4.0.2", @@ -59,7 +59,7 @@ "node-sass": "^4.14.1", "postcss-loader": "^3.0.0", "replace-in-file": "^6.1.0", - "sass-loader": "^9.0.2", + "sass-loader": "^9.0.3", "semantic-release": "^17.1.1", "url-loader": "^4.1.0", "webpack": "^4.44.1", From aa0808c41607238b5e1f6b93c029a57751de21fe Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Wed, 12 Aug 2020 16:35:07 +0530 Subject: [PATCH 3/3] Fix phpcs error --- class-otter-blocks.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/class-otter-blocks.php b/class-otter-blocks.php index 1fbf5b31d..7ff1703ae 100644 --- a/class-otter-blocks.php +++ b/class-otter-blocks.php @@ -292,8 +292,8 @@ public function register_routes() { '/regenerate_styles', array( array( - 'methods' => \WP_REST_Server::DELETABLE, - 'callback' => array( $this, 'regenerate_styles' ), + 'methods' => \WP_REST_Server::DELETABLE, + 'callback' => array( $this, 'regenerate_styles' ), 'permission_callback' => function () { return current_user_can( 'manage_options' ); },