{"action":"created","comment":{"url":"https://api.github.com/repos/magento-engcom/msi/pulls/comments/158369343","pull_request_review_id":85171752,"id":158369343,"diff_hunk":"@@ -0,0 +1,129 @@\n+<?php\n+\n+namespace Magento\\ProductAlert\\Block\\Adminhtml\\Catalog\\Product\\Edit\\Tab\\Alerts\\Renderer;\n+\n+use Magento\\Backend\\Block\\Widget\\Grid\\Column\\Renderer\\AbstractRenderer;\n+use Magento\\Framework\\DataObject;\n+use Magento\\Framework\\Message\\ManagerInterface;\n+use Magento\\Store\\Model\\StoreManagerInterface;\n+use Magento\\Backend\\Block\\Context;\n+use Magento\\InventorySales\\Model\\StockResolver;\n+use Magento\\InventorySalesApi\\Api\\Data\\SalesChannelInterface;\n+\n+class Stock extends AbstractRenderer\n+{\n+    /**\n+     * @var StoreManagerInterface\n+     */\n+    protected $_storeManager;\n+\n+    /**\n+     * @var StockResolver\n+     */\n+    protected $_stockResolver;\n+\n+    /**\n+     * @var ManagerInterface\n+     */\n+    protected $_messageManager;\n+\n+    /**\n+     * Stock constructor.\n+     * @param Context $context\n+     * @param StoreManagerInterface $storeManager\n+     * @param StockResolver $stockResolver\n+     * @param ManagerInterface $messageManager\n+     * @param array $data\n+     */\n+    public function __construct(\n+        Context $context,\n+        StoreManagerInterface $storeManager,\n+        StockResolver $stockResolver,\n+        ManagerInterface $messageManager,\n+        array $data = []\n+    )\n+    {\n+        parent::__construct($context, $data);\n+        $this->_storeManager = $storeManager;\n+        $this->_stockResolver = $stockResolver;\n+        $this->_messageManager = $messageManager;\n+    }\n+\n+    /**\n+     * Handles Stock column\n+     *\n+     * @param DataObject $row\n+     * @return string\n+     */\n+    public function render(DataObject $row)\n+    {\n+        try {\n+            $value = $this->getColumnData($row);\n+            return $value;\n+        } catch (\\Exception $exception) {\n+            $this->_messageManager->addErrorMessage($exception);\n+        }\n+        return parent::render($row);\n+    }\n+\n+    /**\n+     * @param $row\n+     * @return string\n+     * @throws \\Magento\\Framework\\Exception\\LocalizedException\n+     */\n+    public function getColumnData($row)\n+    {\n+        /** @var \\Magento\\Store\\Api\\Data\\WebsiteInterface $website */\n+        $website = $this->_storeManager->getWebsite($row->getWebsiteId());\n+\n+        if (!$website) {\n+            return '';\n+        }\n+        $websiteStr = $this->getWebsiteStr($website);\n+        $stockName = $this->getStockStr($website);\n+        $resultStr = $websiteStr . '<br/>' . $stockName;","path":"app/code/Magento/ProductAlert/Block/Adminhtml/Catalog/Product/Edit/Tab/Alerts/Renderer/Stock.php","position":84,"original_position":84,"commit_id":"d6238094b28a34e05a0006a18d4790e30a97bbf6","original_commit_id":"d6238094b28a34e05a0006a18d4790e30a97bbf6","user":{"login":"AleksLi","id":10618641,"avatar_url":"https://avatars2.githubusercontent.com/u/10618641?v=4","gravatar_id":"","url":"https://api.github.com/users/AleksLi","html_url":"https://github.com/AleksLi","followers_url":"https://api.github.com/users/AleksLi/followers","following_url":"https://api.github.com/users/AleksLi/following{/other_user}","gists_url":"https://api.github.com/users/AleksLi/gists{/gist_id}","starred_url":"https://api.github.com/users/AleksLi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AleksLi/subscriptions","organizations_url":"https://api.github.com/users/AleksLi/orgs","repos_url":"https://api.github.com/users/AleksLi/repos","events_url":"https://api.github.com/users/AleksLi/events{/privacy}","received_events_url":"https://api.github.com/users/AleksLi/received_events","type":"User","site_admin":false},"body":"I can only move that to render function because we don't have any templates for grid column. Render function should return html code. ","created_at":"2017-12-21T20:18:26Z","updated_at":"2017-12-21T20:18:26Z","html_url":"https://github.com/magento-engcom/msi/pull/328#discussion_r158369343","pull_request_url":"https://api.github.com/repos/magento-engcom/msi/pulls/328","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/magento-engcom/msi/pulls/comments/158369343"},"html":{"href":"https://github.com/magento-engcom/msi/pull/328#discussion_r158369343"},"pull_request":{"href":"https://api.github.com/repos/magento-engcom/msi/pulls/328"}},"in_reply_to_id":158144003},"pull_request":{"url":"https://api.github.com/repos/magento-engcom/msi/pulls/328","id":159267098,"html_url":"https://github.com/magento-engcom/msi/pull/328","diff_url":"https://github.com/magento-engcom/msi/pull/328.diff","patch_url":"https://github.com/magento-engcom/msi/pull/328.patch","issue_url":"https://api.github.com/repos/magento-engcom/msi/issues/328","number":328,"state":"open","locked":false,"title":" #261 - Added column to product stock alert grid with website + stock…","user":{"login":"AleksLi","id":10618641,"avatar_url":"https://avatars2.githubusercontent.com/u/10618641?v=4","gravatar_id":"","url":"https://api.github.com/users/AleksLi","html_url":"https://github.com/AleksLi","followers_url":"https://api.github.com/users/AleksLi/followers","following_url":"https://api.github.com/users/AleksLi/following{/other_user}","gists_url":"https://api.github.com/users/AleksLi/gists{/gist_id}","starred_url":"https://api.github.com/users/AleksLi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AleksLi/subscriptions","organizations_url":"https://api.github.com/users/AleksLi/orgs","repos_url":"https://api.github.com/users/AleksLi/repos","events_url":"https://api.github.com/users/AleksLi/events{/privacy}","received_events_url":"https://api.github.com/users/AleksLi/received_events","type":"User","site_admin":false},"body":"… data\r\n\r\n<!--- Provide a general summary of the Pull Request in the Title above -->\r\n\r\n### Description\r\n<!--- Provide a description of the changes proposed in the pull request -->\r\n\r\n### Fixed Issues (if relevant)\r\n<!--- Provide a list of fixed issues in the format magento/magento2#<issue_number>, if relevant  -->\r\n1. magento/magento2#261: Need to support Product Alerts functionality with MSI\r\n2. Added column to product stock alert grid with website + stock data\r\n\r\n### Manual testing scenarios\r\n<!--- Provide a set of unambiguous steps to test the proposed code change -->\r\n1. Open Admin area and go to a product\r\n2. Set qty to 0 and go to frontend to set 'Notify me if it back in Stock' on the product page.\r\n3. Login as some customer and click on 'Notify me if it back in Stock' link.\r\n4. Go again to admin area on the page of this product and you will the data about the customer (where you add this product - Site name and Stock name for this website).\r\n\r\n### Contribution checklist\r\n - [ ] Pull request has a meaningful description of its purpose\r\n - [ ] All commits are accompanied by meaningful commit messages\r\n - [ ] All new or changed code is covered with unit/integration tests (if applicable)\r\n - [ ] All automated tests passed successfully (all builds on Travis CI are green)\r\n","created_at":"2017-12-19T20:43:32Z","updated_at":"2017-12-21T20:18:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"49936a11f8fdd46002416bbcd3a3748c43c102c3","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/magento-engcom/msi/pulls/328/commits","review_comments_url":"https://api.github.com/repos/magento-engcom/msi/pulls/328/comments","review_comment_url":"https://api.github.com/repos/magento-engcom/msi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/magento-engcom/msi/issues/328/comments","statuses_url":"https://api.github.com/repos/magento-engcom/msi/statuses/d6238094b28a34e05a0006a18d4790e30a97bbf6","head":{"label":"AleksLi:261_alert_functionality","ref":"261_alert_functionality","sha":"d6238094b28a34e05a0006a18d4790e30a97bbf6","user":{"login":"AleksLi","id":10618641,"avatar_url":"https://avatars2.githubusercontent.com/u/10618641?v=4","gravatar_id":"","url":"https://api.github.com/users/AleksLi","html_url":"https://github.com/AleksLi","followers_url":"https://api.github.com/users/AleksLi/followers","following_url":"https://api.github.com/users/AleksLi/following{/other_user}","gists_url":"https://api.github.com/users/AleksLi/gists{/gist_id}","starred_url":"https://api.github.com/users/AleksLi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AleksLi/subscriptions","organizations_url":"https://api.github.com/users/AleksLi/orgs","repos_url":"https://api.github.com/users/AleksLi/repos","events_url":"https://api.github.com/users/AleksLi/events{/privacy}","received_events_url":"https://api.github.com/users/AleksLi/received_events","type":"User","site_admin":false},"repo":{"id":114807379,"name":"msi","full_name":"AleksLi/msi","owner":{"login":"AleksLi","id":10618641,"avatar_url":"https://avatars2.githubusercontent.com/u/10618641?v=4","gravatar_id":"","url":"https://api.github.com/users/AleksLi","html_url":"https://github.com/AleksLi","followers_url":"https://api.github.com/users/AleksLi/followers","following_url":"https://api.github.com/users/AleksLi/following{/other_user}","gists_url":"https://api.github.com/users/AleksLi/gists{/gist_id}","starred_url":"https://api.github.com/users/AleksLi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AleksLi/subscriptions","organizations_url":"https://api.github.com/users/AleksLi/orgs","repos_url":"https://api.github.com/users/AleksLi/repos","events_url":"https://api.github.com/users/AleksLi/events{/privacy}","received_events_url":"https://api.github.com/users/AleksLi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AleksLi/msi","description":"All Submissions you make to Magento Inc. (“Magento\") through GitHub are subject to the following terms and conditions: (1) You grant Magento a perpetual, worldwide, non-exclusive, no charge, royalty free, irrevocable license under your applicable copyrights and patents to reproduce, prepare derivative works of, display, publically perform, sublicense and distribute any feedback, ideas, code, or other information (“Submission\") you submit through GitHub. (2) Your Submission is an original work of authorship and you are the owner or are legally entitled to grant the license stated above. (3) You agree to the Contributor License Agreement found here:  https://github.com/magento/magento2/blob/master/CONTRIBUTOR_LICENSE_AGREEMENT.html","fork":true,"url":"https://api.github.com/repos/AleksLi/msi","forks_url":"https://api.github.com/repos/AleksLi/msi/forks","keys_url":"https://api.github.com/repos/AleksLi/msi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AleksLi/msi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AleksLi/msi/teams","hooks_url":"https://api.github.com/repos/AleksLi/msi/hooks","issue_events_url":"https://api.github.com/repos/AleksLi/msi/issues/events{/number}","events_url":"https://api.github.com/repos/AleksLi/msi/events","assignees_url":"https://api.github.com/repos/AleksLi/msi/assignees{/user}","branches_url":"https://api.github.com/repos/AleksLi/msi/branches{/branch}","tags_url":"https://api.github.com/repos/AleksLi/msi/tags","blobs_url":"https://api.github.com/repos/AleksLi/msi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AleksLi/msi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AleksLi/msi/git/refs{/sha}","trees_url":"https://api.github.com/repos/AleksLi/msi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AleksLi/msi/statuses/{sha}","languages_url":"https://api.github.com/repos/AleksLi/msi/languages","stargazers_url":"https://api.github.com/repos/AleksLi/msi/stargazers","contributors_url":"https://api.github.com/repos/AleksLi/msi/contributors","subscribers_url":"https://api.github.com/repos/AleksLi/msi/subscribers","subscription_url":"https://api.github.com/repos/AleksLi/msi/subscription","commits_url":"https://api.github.com/repos/AleksLi/msi/commits{/sha}","git_commits_url":"https://api.github.com/repos/AleksLi/msi/git/commits{/sha}","comments_url":"https://api.github.com/repos/AleksLi/msi/comments{/number}","issue_comment_url":"https://api.github.com/repos/AleksLi/msi/issues/comments{/number}","contents_url":"https://api.github.com/repos/AleksLi/msi/contents/{+path}","compare_url":"https://api.github.com/repos/AleksLi/msi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AleksLi/msi/merges","archive_url":"https://api.github.com/repos/AleksLi/msi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AleksLi/msi/downloads","issues_url":"https://api.github.com/repos/AleksLi/msi/issues{/number}","pulls_url":"https://api.github.com/repos/AleksLi/msi/pulls{/number}","milestones_url":"https://api.github.com/repos/AleksLi/msi/milestones{/number}","notifications_url":"https://api.github.com/repos/AleksLi/msi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AleksLi/msi/labels{/name}","releases_url":"https://api.github.com/repos/AleksLi/msi/releases{/id}","deployments_url":"https://api.github.com/repos/AleksLi/msi/deployments","created_at":"2017-12-19T20:18:51Z","updated_at":"2017-12-19T20:19:52Z","pushed_at":"2017-12-19T20:30:26Z","git_url":"git://github.com/AleksLi/msi.git","ssh_url":"git@github.com:AleksLi/msi.git","clone_url":"https://github.com/AleksLi/msi.git","svn_url":"https://github.com/AleksLi/msi","homepage":"http://www.magento.com","size":394981,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"magento-engcom:develop","ref":"develop","sha":"e6e26a9ecc3e9e69141f0c7242973a166036acd7","user":{"login":"magento-engcom","id":25439648,"avatar_url":"https://avatars0.githubusercontent.com/u/25439648?v=4","gravatar_id":"","url":"https://api.github.com/users/magento-engcom","html_url":"https://github.com/magento-engcom","followers_url":"https://api.github.com/users/magento-engcom/followers","following_url":"https://api.github.com/users/magento-engcom/following{/other_user}","gists_url":"https://api.github.com/users/magento-engcom/gists{/gist_id}","starred_url":"https://api.github.com/users/magento-engcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magento-engcom/subscriptions","organizations_url":"https://api.github.com/users/magento-engcom/orgs","repos_url":"https://api.github.com/users/magento-engcom/repos","events_url":"https://api.github.com/users/magento-engcom/events{/privacy}","received_events_url":"https://api.github.com/users/magento-engcom/received_events","type":"Organization","site_admin":false},"repo":{"id":91593797,"name":"msi","full_name":"magento-engcom/msi","owner":{"login":"magento-engcom","id":25439648,"avatar_url":"https://avatars0.githubusercontent.com/u/25439648?v=4","gravatar_id":"","url":"https://api.github.com/users/magento-engcom","html_url":"https://github.com/magento-engcom","followers_url":"https://api.github.com/users/magento-engcom/followers","following_url":"https://api.github.com/users/magento-engcom/following{/other_user}","gists_url":"https://api.github.com/users/magento-engcom/gists{/gist_id}","starred_url":"https://api.github.com/users/magento-engcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magento-engcom/subscriptions","organizations_url":"https://api.github.com/users/magento-engcom/orgs","repos_url":"https://api.github.com/users/magento-engcom/repos","events_url":"https://api.github.com/users/magento-engcom/events{/privacy}","received_events_url":"https://api.github.com/users/magento-engcom/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/magento-engcom/msi","description":"All Submissions you make to Magento Inc. (“Magento\") through GitHub are subject to the following terms and conditions: (1) You grant Magento a perpetual, worldwide, non-exclusive, no charge, royalty free, irrevocable license under your applicable copyrights and patents to reproduce, prepare derivative works of, display, publically perform, sublicense and distribute any feedback, ideas, code, or other information (“Submission\") you submit through GitHub. (2) Your Submission is an original work of authorship and you are the owner or are legally entitled to grant the license stated above. (3) You agree to the Contributor License Agreement found here:  https://github.com/magento/magento2/blob/master/CONTRIBUTOR_LICENSE_AGREEMENT.html","fork":true,"url":"https://api.github.com/repos/magento-engcom/msi","forks_url":"https://api.github.com/repos/magento-engcom/msi/forks","keys_url":"https://api.github.com/repos/magento-engcom/msi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/magento-engcom/msi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/magento-engcom/msi/teams","hooks_url":"https://api.github.com/repos/magento-engcom/msi/hooks","issue_events_url":"https://api.github.com/repos/magento-engcom/msi/issues/events{/number}","events_url":"https://api.github.com/repos/magento-engcom/msi/events","assignees_url":"https://api.github.com/repos/magento-engcom/msi/assignees{/user}","branches_url":"https://api.github.com/repos/magento-engcom/msi/branches{/branch}","tags_url":"https://api.github.com/repos/magento-engcom/msi/tags","blobs_url":"https://api.github.com/repos/magento-engcom/msi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/magento-engcom/msi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/magento-engcom/msi/git/refs{/sha}","trees_url":"https://api.github.com/repos/magento-engcom/msi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/magento-engcom/msi/statuses/{sha}","languages_url":"https://api.github.com/repos/magento-engcom/msi/languages","stargazers_url":"https://api.github.com/repos/magento-engcom/msi/stargazers","contributors_url":"https://api.github.com/repos/magento-engcom/msi/contributors","subscribers_url":"https://api.github.com/repos/magento-engcom/msi/subscribers","subscription_url":"https://api.github.com/repos/magento-engcom/msi/subscription","commits_url":"https://api.github.com/repos/magento-engcom/msi/commits{/sha}","git_commits_url":"https://api.github.com/repos/magento-engcom/msi/git/commits{/sha}","comments_url":"https://api.github.com/repos/magento-engcom/msi/comments{/number}","issue_comment_url":"https://api.github.com/repos/magento-engcom/msi/issues/comments{/number}","contents_url":"https://api.github.com/repos/magento-engcom/msi/contents/{+path}","compare_url":"https://api.github.com/repos/magento-engcom/msi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/magento-engcom/msi/merges","archive_url":"https://api.github.com/repos/magento-engcom/msi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/magento-engcom/msi/downloads","issues_url":"https://api.github.com/repos/magento-engcom/msi/issues{/number}","pulls_url":"https://api.github.com/repos/magento-engcom/msi/pulls{/number}","milestones_url":"https://api.github.com/repos/magento-engcom/msi/milestones{/number}","notifications_url":"https://api.github.com/repos/magento-engcom/msi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/magento-engcom/msi/labels{/name}","releases_url":"https://api.github.com/repos/magento-engcom/msi/releases{/id}","deployments_url":"https://api.github.com/repos/magento-engcom/msi/deployments","created_at":"2017-05-17T15:47:14Z","updated_at":"2017-12-16T10:20:42Z","pushed_at":"2017-12-21T19:21:47Z","git_url":"git://github.com/magento-engcom/msi.git","ssh_url":"git@github.com:magento-engcom/msi.git","clone_url":"https://github.com/magento-engcom/msi.git","svn_url":"https://github.com/magento-engcom/msi","homepage":"http://www.magento.com","size":394766,"stargazers_count":62,"watchers_count":62,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"archived":false,"open_issues_count":47,"license":null,"forks":21,"open_issues":47,"watchers":62,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/magento-engcom/msi/pulls/328"},"html":{"href":"https://github.com/magento-engcom/msi/pull/328"},"issue":{"href":"https://api.github.com/repos/magento-engcom/msi/issues/328"},"comments":{"href":"https://api.github.com/repos/magento-engcom/msi/issues/328/comments"},"review_comments":{"href":"https://api.github.com/repos/magento-engcom/msi/pulls/328/comments"},"review_comment":{"href":"https://api.github.com/repos/magento-engcom/msi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/magento-engcom/msi/pulls/328/commits"},"statuses":{"href":"https://api.github.com/repos/magento-engcom/msi/statuses/d6238094b28a34e05a0006a18d4790e30a97bbf6"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"AleksLi"}}