Skip to content
Snippets Groups Projects
Commit 5810e7ab authored by Lukas Reschke's avatar Lukas Reschke
Browse files

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

Request approved state for disabled apps with ocsid
parents aa595392 30145c0b
Branches
No related tags found
No related merge requests found
......@@ -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;
}
......
......@@ -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'];
......
......@@ -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'));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment