From 8701d0289753415aa37651c776afbe0cf008e22b Mon Sep 17 00:00:00 2001 From: tuyennn Date: Sat, 4 May 2019 11:28:15 +0700 Subject: [PATCH 1/2] [BUG] Fix rank token spelling due refactoring --- Model/Instagram.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Model/Instagram.php b/Model/Instagram.php index 291983c..1ce7b1a 100644 --- a/Model/Instagram.php +++ b/Model/Instagram.php @@ -1026,7 +1026,7 @@ public function getv2Inbox() */ public function getUserTags($usernameId) { - $tags = $this->request("usertags/$usernameId/feed/?rank_token=$this->rank_token&ranked_content=true&")[1]; + $tags = $this->request("usertags/$usernameId/feed/?rank_token=$this->rankToken&ranked_content=true&")[1]; if ($tags['status'] !== 'ok') { throw new \Exception($tags['message'] . "\n"); @@ -1059,7 +1059,7 @@ public function getSelfUserTags() public function tagFeed($tag) { - $userFeed = $this->request("feed/tag/$tag/?rank_token=$this->rank_token&ranked_content=true&")[1]; + $userFeed = $this->request("feed/tag/$tag/?rank_token=$this->rankToken&ranked_content=true&")[1]; if ($userFeed['status'] !== 'ok') { throw new \Exception($userFeed['message'] . "\n"); @@ -1136,7 +1136,7 @@ public function getSelfGeoMedia() public function fbUserSearch($query) { $query = rawurlencode($query); - $query = $this->request("fbsearch/topsearch/?context=blended&query=$query&rank_token=$this->rank_token")[1]; + $query = $this->request("fbsearch/topsearch/?context=blended&query=$query&rank_token=$this->rankToken")[1]; if ($query['status'] !== 'ok') { throw new \Exception($query['message'] . "\n"); @@ -1158,7 +1158,7 @@ public function fbUserSearch($query) */ public function searchUsers($query) { - $query = $this->request('users/search/?ig_sig_key_version=' . self::SIG_KEY_VERSION . "&is_typeahead=true&query=$query&rank_token=$this->rank_token")[1]; + $query = $this->request('users/search/?ig_sig_key_version=' . self::SIG_KEY_VERSION . "&is_typeahead=true&query=$query&rank_token=$this->rankToken")[1]; if ($query['status'] !== 'ok') { throw new \Exception($query['message'] . "\n"); @@ -1218,7 +1218,7 @@ public function syncFromAdressBook($contacts) */ public function searchTags($query) { - $query = $this->request("tags/search/?is_typeahead=true&q=$query&rank_token=$this->rank_token")[1]; + $query = $this->request("tags/search/?is_typeahead=true&q=$query&rank_token=$this->rankToken")[1]; if ($query['status'] !== 'ok') { throw new \Exception($query['message'] . "\n"); @@ -1239,7 +1239,7 @@ public function searchTags($query) public function getTimeline($maxid = null) { $timeline = $this->request( - "feed/timeline/?rank_token=$this->rank_token&ranked_content=true" + "feed/timeline/?rank_token=$this->rankToken&ranked_content=true" . (!is_null($maxid) ? "&max_id=" . $maxid : '') )[1]; @@ -1267,7 +1267,7 @@ public function getTimeline($maxid = null) public function getUserFeed($usernameId, $maxid = null, $minTimestamp = null) { $userFeed = $this->request( - "feed/user/$usernameId/?rank_token=$this->rank_token" + "feed/user/$usernameId/?rank_token=$this->rankToken" . (!is_null($maxid) ? "&max_id=" . $maxid : '') . (!is_null($minTimestamp) ? "&min_timestamp=" . $minTimestamp : '') . "&ranked_content=true" @@ -1295,9 +1295,9 @@ public function getUserFeed($usernameId, $maxid = null, $minTimestamp = null) public function getHashtagFeed($hashtagString, $maxid = null) { if (is_null($maxid)) { - $endpoint = "feed/tag/$hashtagString/?rank_token=$this->rank_token&ranked_content=true&"; + $endpoint = "feed/tag/$hashtagString/?rank_token=$this->rankToken&ranked_content=true&"; } else { - $endpoint = "feed/tag/$hashtagString/?max_id=" . $maxid . "&rank_token=$this->rank_token&ranked_content=true&"; + $endpoint = "feed/tag/$hashtagString/?max_id=" . $maxid . "&rank_token=$this->rankToken&ranked_content=true&"; } $hashtagFeed = $this->request($endpoint)[1]; @@ -1324,7 +1324,7 @@ public function getHashtagFeed($hashtagString, $maxid = null) public function searchLocation($query) { $query = rawurlencode($query); - $endpoint = "fbsearch/places/?rank_token=$this->rank_token&query=" . $query; + $endpoint = "fbsearch/places/?rank_token=$this->rankToken&query=" . $query; $locationFeed = $this->request($endpoint)[1]; @@ -1350,9 +1350,9 @@ public function searchLocation($query) public function getLocationFeed($locationId, $maxid = null) { if (is_null($maxid)) { - $endpoint = "feed/location/$locationId/?rank_token=$this->rank_token&ranked_content=true&"; + $endpoint = "feed/location/$locationId/?rank_token=$this->rankToken&ranked_content=true&"; } else { - $endpoint = "feed/location/$locationId/?max_id=" . $maxid . "&rank_token=$this->rank_token&ranked_content=true&"; + $endpoint = "feed/location/$locationId/?max_id=" . $maxid . "&rank_token=$this->rankToken&ranked_content=true&"; } $locationFeed = $this->request($endpoint)[1]; @@ -1386,7 +1386,7 @@ public function getSelfUserFeed() */ public function getPopularFeed() { - $popularFeed = $this->request("feed/popular/?people_teaser_supported=1&rank_token=$this->rank_token&ranked_content=true&")[1]; + $popularFeed = $this->request("feed/popular/?people_teaser_supported=1&rank_token=$this->rankToken&ranked_content=true&")[1]; if ($popularFeed['status'] !== 'ok') { throw new \Exception($popularFeed['message'] . "\n"); @@ -1408,7 +1408,7 @@ public function getPopularFeed() */ public function getUserFollowings($usernameId, $maxid = null) { - return $this->request("friendships/$usernameId/following/?max_id=$maxid&ig_sig_key_version=" . self::SIG_KEY_VERSION . "&rank_token=$this->rank_token")[1]; + return $this->request("friendships/$usernameId/following/?max_id=$maxid&ig_sig_key_version=" . self::SIG_KEY_VERSION . "&rank_token=$this->rankToken")[1]; } /** @@ -1422,7 +1422,7 @@ public function getUserFollowings($usernameId, $maxid = null) */ public function getUserFollowers($usernameId, $maxid = null) { - return $this->request("friendships/$usernameId/followers/?max_id=$maxid&ig_sig_key_version=" . self::SIG_KEY_VERSION . "&rank_token=$this->rank_token")[1]; + return $this->request("friendships/$usernameId/followers/?max_id=$maxid&ig_sig_key_version=" . self::SIG_KEY_VERSION . "&rank_token=$this->rankToken")[1]; } /** @@ -1444,7 +1444,7 @@ public function getSelfUserFollowers() */ public function getSelfUsersFollowing() { - return $this->request('friendships/following/?ig_sig_key_version=' . self::SIG_KEY_VERSION . "&rank_token=$this->rank_token")[1]; + return $this->request('friendships/following/?ig_sig_key_version=' . self::SIG_KEY_VERSION . "&rank_token=$this->rankToken")[1]; } /** From c23dc3fa85c370d6ecb1ed397bedc30983ba0c08 Mon Sep 17 00:00:00 2001 From: tuyennn Date: Sun, 26 May 2019 18:36:05 +0700 Subject: [PATCH 2/2] [BUG] Fix wrong configuration on last change --- .../Product/DataProviderPlugin.php | 63 +++++++++++++++++++ README.md | 2 +- composer.json | 2 +- etc/adminhtml/di.xml | 3 + etc/adminhtml/system.xml | 40 ++++++------ etc/module.xml | 2 +- 6 files changed, 89 insertions(+), 23 deletions(-) create mode 100644 Plugin/Ui/DataProvider/Product/DataProviderPlugin.php diff --git a/Plugin/Ui/DataProvider/Product/DataProviderPlugin.php b/Plugin/Ui/DataProvider/Product/DataProviderPlugin.php new file mode 100644 index 0000000..6501422 --- /dev/null +++ b/Plugin/Ui/DataProvider/Product/DataProviderPlugin.php @@ -0,0 +1,63 @@ +getField() == 'posted_to_instagram') { + $collection = $subject->getCollection(); + $select = $collection->getSelect(); + $partsFrom = $select->getPart(Select::FROM); + + if (isset($partsFrom['at_posted_to_instagram'])) { + if ($whereParts = $select->getPart(Select::WHERE)) { + foreach ($whereParts as $key => $wherePartItem) { + $whereParts[$key] = $this->_replaceFilterCondition($wherePartItem); + } + $select->setPart(Select::WHERE, $whereParts); + } + } + } + } + + /** + * Replace table alias in condition string + * + * @param string|null $conditionString + * @return string|null + */ + protected function _replaceFilterCondition($conditionString) + { + if ($conditionString === null) { + return null; + } + + if ($conditionString == "(at_posted_to_instagram.value = '0')") { + $conditionString = "(at_posted_to_instagram.value = '0' OR at_posted_to_instagram.value IS NULL)"; + } + + return $conditionString; + } +} \ No newline at end of file diff --git a/README.md b/README.md index f4e0849..8574458 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This Magento 2 extension Auto Instagram Post allows you add your products immedi [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/bf0757d0063e489eb3bff2479964fce2)](https://www.codacy.com/app/GhoSterInc/AutoInstagramPost?utm_source=github.com&utm_medium=referral&utm_content=tuyennn/AutoInstagramPost&utm_campaign=Badge_Grade) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/thinghost) -![Version 1.1.5](https://img.shields.io/badge/Version-1.1.5-green.svg) +![Version 1.1.5](https://img.shields.io/badge/Version-1.1.6-green.svg) --- ## [![Alt GhoSter](http://thinghost.info/wp-content/uploads/2015/12/ghoster.png "thinghost.info")](http://thinghost.info) Overview diff --git a/composer.json b/composer.json index 59619e4..02298aa 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ }, "type": "magento2-module", - "version": "1.1.5", + "version": "1.1.6", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/etc/adminhtml/di.xml b/etc/adminhtml/di.xml index fdf19a9..d89d51b 100644 --- a/etc/adminhtml/di.xml +++ b/etc/adminhtml/di.xml @@ -31,4 +31,7 @@ + + + \ No newline at end of file diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 5775373..8f6fedd 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -10,7 +10,7 @@ GhoSter_AutoInstagramPost::config - + Magento\Config\Model\Config\Source\Yesno @@ -18,7 +18,7 @@ required-entry - 1 + 1 required-entry @@ -26,7 +26,7 @@ Magento\Config\Model\Config\Backend\Encrypted - 1 + 1 required-entry @@ -35,7 +35,7 @@ - + Magento\Config\Model\Config\Source\Yesno - 1 + 1 @@ -70,8 +70,8 @@ Magento\Config\Model\Config\Source\Yesno - 1 - 1 + 1 + 1 @@ -79,16 +79,16 @@ Magento\Config\Model\Config\Source\Yesno - 1 - 1 + 1 + 1 Magento\Config\Model\Config\Source\Yesno - 1 - 1 + 1 + 1 @@ -97,8 +97,8 @@ GhoSter\AutoInstagramPost\Model\Config\Backend\Hashtag - 1 - 1 + 1 + 1 1 @@ -106,8 +106,8 @@ Instagram caption character limit: 2,200 characters
Instagram hashtag limit: 30 hashtags
Instagram bio character limit: 150 characters]]>
- 1 - 1 + 1 + 1
@@ -117,7 +117,7 @@ Magento\Config\Model\Config\Source\Yesno - 1 + 1 @@ -137,7 +137,7 @@ - 1 + 1 validate-zero-or-greater diff --git a/etc/module.xml b/etc/module.xml index aaf3b87..cffdd8b 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file