diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-06 12:36:32 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-06 12:36:32 +0200 |
commit | 6651aa19ea8f0a617bcf22126e8cda70466400af (patch) | |
tree | eaf07e12c2b660b04e8b2de0a82a25c3fa4f424a /settings | |
parent | 319e61f0eabe02847c4dccdb9db86dc3181d7540 (diff) | |
parent | 999196b9fb2a16822ca0fb6effebbdf52adc374b (diff) | |
download | nextcloud-server-6651aa19ea8f0a617bcf22126e8cda70466400af.tar.gz nextcloud-server-6651aa19ea8f0a617bcf22126e8cda70466400af.zip |
Merge pull request #19526 from owncloud/issue-16251-reload-app-settings-when-app-needs-update
Reload the page when an app needs an update after being enabled
Diffstat (limited to 'settings')
-rw-r--r-- | settings/ajax/enableapp.php | 5 | ||||
-rw-r--r-- | settings/js/apps.js | 22 |
2 files changed, 25 insertions, 2 deletions
diff --git a/settings/ajax/enableapp.php b/settings/ajax/enableapp.php index 5e0aba1ce7e..04b92283f3e 100644 --- a/settings/ajax/enableapp.php +++ b/settings/ajax/enableapp.php @@ -29,8 +29,9 @@ OCP\JSON::callCheck(); $groups = isset($_POST['groups']) ? (array)$_POST['groups'] : null; try { - OC_App::enable(OC_App::cleanAppId((string)$_POST['appid']), $groups); - OC_JSON::success(); + $app = OC_App::cleanAppId((string)$_POST['appid']); + OC_App::enable($app, $groups); + OC_JSON::success(['data' => ['update_required' => \OC_App::shouldUpgrade($app)]]); } catch (Exception $e) { \OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR); OC_JSON::error(array("data" => array("message" => $e->getMessage()) )); diff --git a/settings/js/apps.js b/settings/js/apps.js index f775ecad620..d51c642c9c9 100644 --- a/settings/js/apps.js +++ b/settings/js/apps.js @@ -245,6 +245,14 @@ OC.Settings.Apps = OC.Settings.Apps || { element.val(t('settings','Enable')); appItem.addClass('appwarning'); } else { + if (result.data.update_required) { + OC.Settings.Apps.showReloadMessage(); + + setTimeout(function() { + location.reload(); + }, 5000); + } + OC.Settings.Apps.rebuildNavigation(); appItem.data('active',true); element.data('active',true); @@ -390,6 +398,20 @@ OC.Settings.Apps = OC.Settings.Apps || { .text(''); }, + showReloadMessage: function(appId) { + OC.dialogs.info( + t( + 'settings', + 'The app has been enabled but needs to be updated. You will be redirected to the update page in 5 seconds.' + ), + t('settings','App update'), + function (result) { + window.location.reload(); + }, + true + ); + }, + filter: function(query) { query = query.toLowerCase(); $('#apps-list').find('.section').addClass('hidden'); |