summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--settings/ajax/enableapp.php5
-rw-r--r--settings/js/apps.js22
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');