From 7365bd798a30b8ac584080532bf97970a34bb6c3 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Mon, 11 Apr 2016 16:48:07 +0200 Subject: Show tooltip if the app is downloaded from a remote server fixes #14405 --- settings/Controller/AppSettingsController.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'settings/Controller/AppSettingsController.php') diff --git a/settings/Controller/AppSettingsController.php b/settings/Controller/AppSettingsController.php index cc69d3130d9..6c86cbf2cd3 100644 --- a/settings/Controller/AppSettingsController.php +++ b/settings/Controller/AppSettingsController.php @@ -259,6 +259,12 @@ class AppSettingsController extends Controller { $apps = array_filter($apps, function ($app) use ($installedApps) { return !in_array($app['id'], $installedApps); }); + + // show tooltip if app is downloaded from remote server + $inactiveApps = $this->getInactiveApps(); + foreach ($apps as &$app) { + $app['needsDownload'] = !in_array($app['id'], $inactiveApps); + } } // sort by score @@ -319,4 +325,23 @@ class AppSettingsController extends Controller { }); return $apps; } + + /** + * @return array + */ + private function getInactiveApps() { + $inactiveApps = \OC_App::listAllApps(true, false, $this->ocsClient); + $inactiveApps = array_filter($inactiveApps, + function ($app) { + return !$app['active']; + }); + $inactiveApps = array_map(function($app) { + if (isset($app['ocsid'])) { + return $app['ocsid']; + } + return $app['id']; + }, $inactiveApps); + return $inactiveApps; + } + } -- cgit v1.2.3