Merge pull request #17050 from owncloud/request-status-from-ocs

Request approved state for disabled apps with ocsid
This commit is contained in:
Lukas Reschke 2015-06-29 13:41:11 +02:00
commit 5810e7ab87
3 changed files with 21 additions and 0 deletions

View file

@ -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;
}

View file

@ -169,6 +169,15 @@ class AppSettingsController extends Controller {
}
return ($a < $b) ? -1 : 1;
});
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'];
}
}
}
break;
// not-installed apps
case 1:
@ -176,6 +185,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'];

View file

@ -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'));
}