-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix legacy update notifications #23175
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: mrtnmtth <mrtn.mtth@gmx.de>
nickvergessen
approved these changes
Oct 5, 2020
To test on master (where no update can be available), apply the following patch: diff --git a/apps/updatenotification/lib/AppInfo/Application.php b/apps/updatenotification/lib/AppInfo/Application.php
index 54d6444236..4775c6ece1 100644
--- a/apps/updatenotification/lib/AppInfo/Application.php
+++ b/apps/updatenotification/lib/AppInfo/Application.php
@@ -62,6 +62,9 @@ class Application extends App implements IBootstrap {
IGroupManager $groupManager,
IAppContainer $appContainer,
ILogger $logger) {
+ Util::addScript('updatenotification', 'legacy-notification');
+ $updateChecker = $appContainer->get(UpdateChecker::class);
+ \OC_Hook::connect('\OCP\Config', 'js', $updateChecker, 'populateJavaScriptVariables');
if ($config->getSystemValue('updatechecker', true) !== true) {
// Updater check is disabled
return;
diff --git a/apps/updatenotification/lib/UpdateChecker.php b/apps/updatenotification/lib/UpdateChecker.php
index b83eff8818..7bcc29a4fd 100644
--- a/apps/updatenotification/lib/UpdateChecker.php
+++ b/apps/updatenotification/lib/UpdateChecker.php
@@ -75,7 +75,15 @@ class UpdateChecker {
return $result;
}
- return [];
+ return [
+ 'updateAvailable' => true,
+ 'updateVersion' => '20.0.0',
+ 'updateVersionString' => '20.0.0',
+ 'updaterEnabled' => true,
+ 'versionIsEol' => false,
+ 'updateLink' => 'https://nextcloud.com',
+ 'downloadLink' => 'https://nextcloud.com',
+ ];
}
/**
@@ -84,8 +92,8 @@ class UpdateChecker {
public function populateJavaScriptVariables(array $data) {
$data['array']['oc_updateState'] = json_encode([
'updateAvailable' => true,
- 'updateVersion' => $this->getUpdateState()['updateVersionString'],
- 'updateLink' => $this->getUpdateState()['updateLink'] ?? '',
+ 'updateVersion' => '20.0.0',// $this->getUpdateState()['updateVersionString'],
+ 'updateLink' => 'https://nextcloud.com',// $this->getUpdateState()['updateLink'] ?? '',
]);
}
} |
juliusknorr
approved these changes
Oct 5, 2020
Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 |
/backport to stable20 |
/backport to stable19 |
This was referenced Oct 5, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes issue #21266
Since this is legacy code, I only changed as much as needed to fix the issue