add apps sorter is user side (fix #160)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
c8ac0b5922
commit
52d88771d9
6 changed files with 63 additions and 10 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue