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
No related branches found
No related tags found
No related merge requests found
...@@ -284,6 +284,7 @@ class OCSClient { ...@@ -284,6 +284,7 @@ class OCSClient {
$app['description'] = (string)$tmp->description; $app['description'] = (string)$tmp->description;
$app['detailpage'] = (string)$tmp->detailpage; $app['detailpage'] = (string)$tmp->detailpage;
$app['score'] = (int)$tmp->score; $app['score'] = (int)$tmp->score;
$app['level'] = (int)$tmp->approved;
return $app; return $app;
} }
......
...@@ -169,6 +169,15 @@ class AppSettingsController extends Controller { ...@@ -169,6 +169,15 @@ class AppSettingsController extends Controller {
} }
return ($a < $b) ? -1 : 1; 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; break;
// not-installed apps // not-installed apps
case 1: case 1:
...@@ -176,6 +185,15 @@ class AppSettingsController extends Controller { ...@@ -176,6 +185,15 @@ class AppSettingsController extends Controller {
$apps = array_filter($apps, function ($app) { $apps = array_filter($apps, function ($app) {
return !$app['active']; 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) { usort($apps, function ($a, $b) {
$a = (string)$a['name']; $a = (string)$a['name'];
$b = (string)$b['name']; $b = (string)$b['name'];
......
...@@ -732,6 +732,7 @@ class OCSClientTest extends \Test\TestCase { ...@@ -732,6 +732,7 @@ class OCSClientTest extends \Test\TestCase {
<downloadpackagename1></downloadpackagename1> <downloadpackagename1></downloadpackagename1>
<downloadrepository1></downloadrepository1> <downloadrepository1></downloadrepository1>
<downloadsize1>1</downloadsize1> <downloadsize1>1</downloadsize1>
<approved>200</approved>
</content> </content>
</data> </data>
</ocs> </ocs>
...@@ -770,6 +771,7 @@ class OCSClientTest extends \Test\TestCase { ...@@ -770,6 +771,7 @@ class OCSClientTest extends \Test\TestCase {
'changed' => 1404743680, 'changed' => 1404743680,
'description' => 'Placeholder for future updates', 'description' => 'Placeholder for future updates',
'score' => 50, 'score' => 50,
'level' => 200,
]; ];
$this->assertSame($expected, $this->ocsClient->getApplication('MyId')); $this->assertSame($expected, $this->ocsClient->getApplication('MyId'));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment