[Pkg-owncloud-commits] [owncloud] 52/205: Request approved state for disabled apps with ocsid

David Prévot taffit at moszumanska.debian.org
Thu Jul 2 17:36:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 00a65e30ce703e93e8e4c7a3658fe28271d2d623
Author: Lukas Reschke <lukas at owncloud.com>
Date:   Fri Jun 19 19:01:58 2015 +0200

    Request approved state for disabled apps with ocsid
    
    In case an application gets disabled the level is set to "experimental" if it does not contain a `shipped` tag. This can for example be reproduced by installing the documents app from the appstore and then disabling it. Or cloning an app from git.
    
    With this change the controller will now load the level of the application from the appstore if a valid OCSID has been provided.
    
    Fixes https://github.com/owncloud/core/issues/17003
---
 lib/private/ocsclient.php                     | 1 +
 settings/controller/appsettingscontroller.php | 9 +++++++++
 tests/lib/ocsclienttest.php                   | 2 ++
 3 files changed, 12 insertions(+)

diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php
index f10a974..388f8f0 100644
--- a/lib/private/ocsclient.php
+++ b/lib/private/ocsclient.php
@@ -284,6 +284,7 @@ class OCSClient {
 		$app['description'] = (string)$tmp->description;
 		$app['detailpage'] = (string)$tmp->detailpage;
 		$app['score'] = (int)$tmp->score;
+		$app['level'] = (int)$tmp->approved;
 
 		return $app;
 	}
diff --git a/settings/controller/appsettingscontroller.php b/settings/controller/appsettingscontroller.php
index d64c945..ef483cc 100644
--- a/settings/controller/appsettingscontroller.php
+++ b/settings/controller/appsettingscontroller.php
@@ -176,6 +176,15 @@ class AppSettingsController extends Controller {
 					$apps = array_filter($apps, function ($app) {
 						return !$app['active'];
 					});
+					foreach($apps as $key => $app) {
+						if(!array_key_exists('level', $app) && array_key_exists('ocsid', $app)) {
+							$remoteAppEntry = $this->ocsClient->getApplication($app['ocsid']);
+
+							if(array_key_exists('level', $remoteAppEntry)) {
+								$apps[$key]['level'] = $remoteAppEntry['level'];
+							}
+						}
+					}
 					usort($apps, function ($a, $b) {
 						$a = (string)$a['name'];
 						$b = (string)$b['name'];
diff --git a/tests/lib/ocsclienttest.php b/tests/lib/ocsclienttest.php
index ca8a2a2..1e9e551 100644
--- a/tests/lib/ocsclienttest.php
+++ b/tests/lib/ocsclienttest.php
@@ -732,6 +732,7 @@ class OCSClientTest extends \Test\TestCase {
 			   <downloadpackagename1></downloadpackagename1>
 			   <downloadrepository1></downloadrepository1>
 			   <downloadsize1>1</downloadsize1>
+			   <approved>200</approved>
 			  </content>
 			 </data>
 			</ocs>
@@ -770,6 +771,7 @@ class OCSClientTest extends \Test\TestCase {
 			'changed' => 1404743680,
 			'description' => 'Placeholder for future updates',
 			'score' => 50,
+			'level' => 200,
 		];
 		$this->assertSame($expected, $this->ocsClient->getApplication('MyId'));
 	}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list