Skip to content

Commit 4ff9cee

Browse files
authored
Merge pull request #444 from magefan/6984-update-notification-issue
Fix update notification
2 parents cda6fd1 + 274a710 commit 4ff9cee

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

Block/Adminhtml/System/Config/Form/UpdateInfo.php

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
namespace Magefan\Blog\Block\Adminhtml\System\Config\Form;
1010

11-
use Magento\Framework\Module\ModuleListInterface;
1211
use Magefan\Blog\Model\AdminNotificationFeed;
12+
use Magefan\Community\Api\GetModuleVersionInterface;
1313

1414
/**
1515
* Class Update Info Block
@@ -24,11 +24,6 @@ class UpdateInfo extends \Magento\Backend\Block\Template
2424
*/
2525
protected $curlClient;
2626

27-
/**
28-
* @var ModuleListInterface
29-
*/
30-
protected $moduleList;
31-
3227
/**
3328
* @var mixed
3429
*/
@@ -49,28 +44,40 @@ class UpdateInfo extends \Magento\Backend\Block\Template
4944
*/
5045
protected $cacheManager;
5146

47+
/**
48+
* @var \Magento\Framework\Json\Helper\Data
49+
*/
50+
private $jsonHelper;
51+
52+
/**
53+
* @var GetModuleVersionInterface
54+
*/
55+
private $getModuleVersion;
56+
5257
/**
5358
* UpdateInfo constructor.
5459
* @param \Magento\Backend\Block\Template\Context $context
5560
* @param \Magento\Framework\HTTP\Client\Curl $curl
5661
* @param \Magento\Framework\Json\Helper\Data $jsonHelper
5762
* @param AdminNotificationFeed $adminNotificationFeed
58-
* @param ModuleListInterface $moduleList
5963
* @param array $data
64+
* @param GetModuleVersionInterface|null $getModuleVersion
6065
*/
6166
public function __construct(
6267
\Magento\Backend\Block\Template\Context $context,
6368
\Magento\Framework\HTTP\Client\Curl $curl,
6469
\Magento\Framework\Json\Helper\Data $jsonHelper,
6570
AdminNotificationFeed $adminNotificationFeed,
66-
ModuleListInterface $moduleList,
67-
array $data = []
71+
array $data = [],
72+
GetModuleVersionInterface $getModuleVersion = null
6873
) {
6974
$this->cacheManager = $context->getCache();
7075
$this->adminNotificationFeed = $adminNotificationFeed;
71-
$this->moduleList = $moduleList;
7276
$this->jsonHelper = $jsonHelper;
7377
$this->curlClient = $curl;
78+
$this->getModuleVersion = $getModuleVersion ?: \Magento\Framework\App\ObjectManager::getInstance()->get(
79+
\Magefan\Community\Api\GetModuleVersionInterface::class
80+
);
7481
parent::__construct($context, $data);
7582
}
7683

@@ -80,8 +87,7 @@ public function __construct(
8087
public function getCurrentVersion()
8188
{
8289
if (null === $this->currentVersion) {
83-
$this->currentVersion = $this->moduleList
84-
->getOne($this->getModuleName())['setup_version'];
90+
$this->currentVersion = $this->getModuleVersion->execute($this->getModuleName());
8591
}
8692

8793
return $this->currentVersion;

0 commit comments

Comments
 (0)