Use the version number when checking the appstore for compatible updates

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2018-11-08 14:50:12 +01:00
parent 90a35aab29
commit b04a44babd
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
6 changed files with 13 additions and 12 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -67,7 +67,7 @@ class Check extends Command {
// Server
$r = $this->updateChecker->getUpdateState();
if (isset($r['updateAvailable']) && $r['updateAvailable']) {
$output->writeln($r['updateVersion'] . ' is available. Get more information on how to update at '. $r['updateLink'] . '.');
$output->writeln($r['updateVersionString'] . ' is available. Get more information on how to update at '. $r['updateLink'] . '.');
$updatesAvailableCount += 1;
}

View File

@ -97,7 +97,8 @@ class Admin implements ISettings {
'lastChecked' => $lastUpdateCheck,
'currentChannel' => $currentChannel,
'channels' => $channels,
'newVersionString' => empty($updateState['updateVersion']) ? '' : $updateState['updateVersion'],
'newVersion' => empty($updateState['updateVersion']) ? '' : $updateState['updateVersion'],
'newVersionString' => empty($updateState['updateVersionString']) ? '' : $updateState['updateVersionString'],
'downloadLink' => empty($updateState['downloadLink']) ? '' : $updateState['downloadLink'],
'changes' => $this->filterChanges($updateState['changes'] ?? []),
'updaterEnabled' => empty($updateState['updaterEnabled']) ? false : $updateState['updaterEnabled'],

View File

@ -51,7 +51,8 @@ class UpdateChecker {
if (isset($data['version']) && $data['version'] !== '' && $data['version'] !== []) {
$result['updateAvailable'] = true;
$result['updateVersion'] = $data['versionstring'];
$result['updateVersion'] = $data['version'];
$result['updateVersionString'] = $data['versionstring'];
$result['updaterEnabled'] = $data['autoupdater'] === '1';
$result['versionIsEol'] = $data['eol'] === '1';
if (strpos($data['web'], 'https://') === 0) {
@ -80,7 +81,7 @@ class UpdateChecker {
public function populateJavaScriptVariables(array $data) {
$data['array']['oc_updateState'] = json_encode([
'updateAvailable' => true,
'updateVersion' => $this->getUpdateState()['updateVersion'],
'updateVersion' => $this->getUpdateState()['updateVersionString'],
'updateLink' => $this->getUpdateState()['updateLink'] ?? '',
]);
}

View File

@ -156,7 +156,7 @@
}
$.ajax({
url: OC.linkToOCS('apps/updatenotification/api/v1/applist', 2) + this.newVersionString,
url: OC.linkToOCS('apps/updatenotification/api/v1/applist', 2) + this.newVersion,
type: 'GET',
beforeSend: function (request) {
request.setRequestHeader('Accept', 'application/json');
@ -196,20 +196,18 @@
return t('updatenotification', 'Checking apps for compatible updates');
}
if (this.appstoreDisabled) {
if (this.appStoreDisabled) {
return t('updatenotification', 'Please make sure your config.php does not set <samp>appstoreenabled</samp> to false.');
}
if (this.appstoreFailed) {
if (this.appStoreFailed) {
return t('updatenotification', 'Could not connect to the appstore or the appstore returned no updates at all. Search manually for updates or make sure your server has access to the internet and can connect to the appstore.');
}
return this.missingAppUpdates.length === 0 ? t('updatenotification', '<strong>All</strong> apps have an update for this version available', this) : n('updatenotification',
'<strong>%n</strong> app has no update for this version available',
'<strong>%n</strong> apps have no update for this version available',
this.missingAppUpdates.length, {
version: this.newVersionString
});
this.missingAppUpdates.length);
},
productionInfoString: function() {
@ -313,6 +311,7 @@
// Parse server data
var data = JSON.parse($('#updatenotification').attr('data-json'));
this.newVersion = data.newVersion;
this.newVersionString = data.newVersionString;
this.lastCheckedDate = data.lastChecked;
this.isUpdateChecked = data.isUpdateChecked;