Skip to content

Commit 4c430b9

Browse files
authored
Merge pull request #1496 from algolia/feature/MAGE-863
MAGE-863 Add extension version notice
2 parents a876fc5 + 7b03b14 commit 4c430b9

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

Helper/Configuration/NoticeHelper.php

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class NoticeHelper extends \Magento\Framework\App\Helper\AbstractHelper
4444
'getClickAnalyticsNotice',
4545
'getPersonalizationNotice',
4646
'getRecommendNotice',
47-
'getCookieConfigurationNotice',
47+
'getCookieConfigurationNotice',
4848
];
4949

5050
/** @var array[] */
@@ -157,23 +157,33 @@ protected function getMsiNotice()
157157
];
158158
}
159159

160-
protected function getVersionNotice()
160+
protected function getVersionNotice(): void
161161
{
162+
$currentVersion = $this->configHelper->getExtensionVersion();
162163
$newVersion = $this->getNewVersionNotification();
163-
if ($newVersion === null) {
164+
if (!$currentVersion && !$newVersion) {
164165
return;
165166
}
166167

167-
$noticeTitle = 'Algolia Extension update';
168-
$noticeContent = 'You are using old version of Algolia extension. Latest version of the extension is v <b>' . $newVersion['version'] . '</b><br />
168+
$notice = [
169+
'selector' => '.entry-edit',
170+
'method' => 'before'
171+
];
172+
173+
if ($newVersion) {
174+
$noticeTitle = 'Algolia extension update';
175+
$noticeContent = 'You are using an old version of Algolia extension. Latest version of the extension is v <b>' . $newVersion['version'] . '</b><br />
169176
It is highly recommended to update your version to avoid any unexpected issues and to get new features.<br />
170177
See details on our <a target="_blank" href="' . $newVersion['url'] . '">Github repository</a>.';
178+
$notice['message'] = $this->formatNotice($noticeTitle, $noticeContent);
179+
}
180+
else {
181+
$noticeTitle = 'Algolia extension version';
182+
$noticeContent = "You are using version <strong>$currentVersion</strong> of the Algolia Magento integration.";
183+
$notice['message'] = $this->formatNotice($noticeTitle, $noticeContent, 'icon-bulb');
184+
}
171185

172-
$this->notices[] = [
173-
'selector' => '.entry-edit',
174-
'method' => 'before',
175-
'message' => $this->formatNotice($noticeTitle, $noticeContent),
176-
];
186+
$this->notices[] = $notice;
177187
}
178188

179189
protected function getClickAnalyticsNotice()
@@ -208,7 +218,7 @@ protected function getClickAnalyticsNotice()
208218
'message' => $noticeContent,
209219
];
210220
}
211-
221+
212222
protected function getCookieConfigurationNotice()
213223
{
214224
$noticeContent = '';

view/adminhtml/web/js/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ require(
3838
pageWarning += '</div>';
3939

4040
var pageWarningSynonyms = '<div class="algolia_dashboard_warning algolia_dashboard_warning_page">';
41-
pageWarningSynonyms += '<p>Configurations related to Synonyms have been deprecated from the Magento dashboard. We advise you to configure synonyms from the Algolia dashboard.</p>';
41+
pageWarningSynonyms += '<p>Configurations related to Synonyms have been removed from the Magento dashboard. We advise you to configure synonyms from the Algolia dashboard.</p>';
4242
pageWarningSynonyms += '</div>';
4343

4444
for (var i=0; i < pageIds.length; i++) {

0 commit comments

Comments
 (0)