Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW UI] program update notifications #1179

Open
wants to merge 29 commits into
base: 7.1.x
Choose a base branch
from

Conversation

ga-devfront
Copy link
Contributor

Questions Answers
Description? Add program update notification to only check new version each 30 days and make
Type? new feature
BC breaks? no
Deprecations? no
Fixed ticket? N/A
Sponsor company @PrestaShopCorp
How to test? see internal ticket

@ga-devfront ga-devfront added enhancement Type: Improvement Blocked Status: The issue is blocked by another task labels Feb 20, 2025
@ga-devfront ga-devfront added this to the 7.1.0 milestone Feb 20, 2025
@ga-devfront ga-devfront changed the base branch from dev to 7.1.x February 20, 2025 10:54
@ga-devfront ga-devfront force-pushed the feat/programme-notifications branch from d4aefa9 to d5ff1a3 Compare February 21, 2025 10:44
Comment on lines +100 to +117
if (!Tab::getIdFromClassName('AdminAutoupgradeAjax')) {
$ajaxTab = new Tab();
$ajaxTab->class_name = 'AdminAutoupgradeAjax';
$ajaxTab->module = 'autoupgrade';
$ajaxTab->id_parent = -1;

foreach (Language::getLanguages(false) as $lang) {
$ajaxTab->name[(int) $lang['id_lang']] = 'Update assistant';
}
if (!$ajaxTab->save()) {
return $this->_abortInstall($this->trans('Unable to create the "AdminAutoupgradeAjax" tab'));
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part must be added in an upgrade file as well, for merchants upgrading from v7 and below.

autoupgrade.php Outdated
}
}

return parent::install() && $this->registerHook('actionAdminControllerSetMedia') && $this->registerHook('displayBackOfficeHeader');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hooks to be added in a migration file upgrade-7.1.0.php

autoupgrade.php Outdated
require_once $autoloadPath;
}

require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/classes/Hooks/DisplayBackOfficeHeader.php';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary, the autoloader has been called and should be able to get your class DisplayBackOfficeHeader.

}
}

private function isDefaultController(): bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private function isDefaultController(): bool
private function isEmployeeDefaultController(): bool

$this->updateNotificationConfiguration->setReleaseNote($releaseNote);
}

(new UpdateNotificationService())->saveUpdateNotificationConfiguration($this->updateNotificationConfiguration);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reuse the instance that would be loaded from the container?

Comment on lines 34 to 45
require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/classes/VersionUtils.php';

if (!\PrestaShop\Module\AutoUpgrade\VersionUtils::isActualPHPVersionCompatible()) {
$this->isActualPHPVersionCompatible = false;

return;
}

$autoloadPath = __DIR__ . '/../../vendor/autoload.php';
if (file_exists($autoloadPath)) {
require_once $autoloadPath;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen this code several times. Shall we merge all the occurrences in a common method?

Comment on lines 57 to 62
$updateNotificationService = new UpdateNotificationService();
$updateNotificationConfiguration = $updateNotificationService->getUpdateNotificationConfiguration();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be moved in the container?

@@ -41,6 +42,7 @@ const preview: Preview = {
backgrounds: {
disable: true,
},
internalWrapper: false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer something like?

Suggested change
internalWrapper: false,
storyContext: 'MODULE_UI' as 'MODULE_UI' | 'STANDALONE',

@Quetzacoalt91 Quetzacoalt91 removed the Blocked Status: The issue is blocked by another task label Feb 24, 2025
@ga-devfront ga-devfront force-pushed the feat/programme-notifications branch from b396980 to 3410d21 Compare February 26, 2025 06:39
Copy link

sonarqubecloud bot commented Mar 6, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@paulnoelcholot
Copy link

Hello @ga-devfront,

I tested your PR but I found some bugs :/

PR-2025-03-06_14.54.16.mp4

@ga-devfront ga-devfront added wip Blocked Status: The issue is blocked by another task and removed waiting for QA labels Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked Status: The issue is blocked by another task enhancement Type: Improvement waiting for author wip
Projects
Status: Ready for review
Development

Successfully merging this pull request may close these issues.

5 participants