mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
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
This commit is contained in:
commit
6651aa19ea
2 changed files with 25 additions and 2 deletions
|
|
@ -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()) ));
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in a new issue