add apps sorter is user side (fix #160)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace OCA\SideMenu\Service;
|
||||
|
||||
use OC\User\User;
|
||||
use OCP\L10N\IFactory;
|
||||
|
||||
/**
|
||||
@@ -110,11 +111,19 @@ class AppRepository
|
||||
);
|
||||
}
|
||||
|
||||
public function getOrderedApps()
|
||||
public function getOrderedApps(?User $user = null)
|
||||
{
|
||||
$apps = $this->getVisibleApps();
|
||||
$orders = $this->config->getAppValueArray('apps-order', '[]');
|
||||
|
||||
if (null !== $user && !$this->config->getAppValueBool('force', '0')) {
|
||||
$userOrders = $this->config->getUserValueArray($user, 'apps-order', '[]');
|
||||
|
||||
if (!empty($userOrders)) {
|
||||
$orders = $userOrders;
|
||||
}
|
||||
}
|
||||
|
||||
usort($apps, function ($a, $b) use ($orders) {
|
||||
$ak = array_keys($orders, $a['id'])[0] ?? null;
|
||||
$bk = array_keys($orders, $b['id'])[0] ?? null;
|
||||
|
||||
Reference in New Issue
Block a user