Skip to content

Commit

Permalink
Merge pull request #1497 from algolia/feature/MAGE-863
Browse files Browse the repository at this point in the history
MAGE-863 Add extension version notice
  • Loading branch information
cammonro authored Apr 23, 2024
2 parents f78bfb3 + 7b03b14 commit 93f2ef9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
32 changes: 21 additions & 11 deletions Helper/Configuration/NoticeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class NoticeHelper extends \Magento\Framework\App\Helper\AbstractHelper
'getClickAnalyticsNotice',
'getPersonalizationNotice',
'getRecommendNotice',
'getCookieConfigurationNotice',
'getCookieConfigurationNotice',
];

/** @var array[] */
Expand Down Expand Up @@ -157,23 +157,33 @@ protected function getMsiNotice()
];
}

protected function getVersionNotice()
protected function getVersionNotice(): void
{
$currentVersion = $this->configHelper->getExtensionVersion();
$newVersion = $this->getNewVersionNotification();
if ($newVersion === null) {
if (!$currentVersion && !$newVersion) {
return;
}

$noticeTitle = 'Algolia Extension update';
$noticeContent = 'You are using old version of Algolia extension. Latest version of the extension is v <b>' . $newVersion['version'] . '</b><br />
$notice = [
'selector' => '.entry-edit',
'method' => 'before'
];

if ($newVersion) {
$noticeTitle = 'Algolia extension update';
$noticeContent = 'You are using an old version of Algolia extension. Latest version of the extension is v <b>' . $newVersion['version'] . '</b><br />
It is highly recommended to update your version to avoid any unexpected issues and to get new features.<br />
See details on our <a target="_blank" href="' . $newVersion['url'] . '">Github repository</a>.';
$notice['message'] = $this->formatNotice($noticeTitle, $noticeContent);
}
else {
$noticeTitle = 'Algolia extension version';
$noticeContent = "You are using version <strong>$currentVersion</strong> of the Algolia Magento integration.";
$notice['message'] = $this->formatNotice($noticeTitle, $noticeContent, 'icon-bulb');
}

$this->notices[] = [
'selector' => '.entry-edit',
'method' => 'before',
'message' => $this->formatNotice($noticeTitle, $noticeContent),
];
$this->notices[] = $notice;
}

protected function getClickAnalyticsNotice()
Expand Down Expand Up @@ -208,7 +218,7 @@ protected function getClickAnalyticsNotice()
'message' => $noticeContent,
];
}

protected function getCookieConfigurationNotice()
{
$noticeContent = '';
Expand Down
2 changes: 1 addition & 1 deletion view/adminhtml/web/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ require(
pageWarning += '</div>';

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

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

0 comments on commit 93f2ef9

Please sign in to comment.