Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/dashboard/lib/Controller/DashboardApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\AppFramework\Services\IAppConfig;
use OCP\Dashboard\IAPIWidget;
use OCP\Dashboard\IAPIWidgetV2;
use OCP\Dashboard\IButtonWidget;
Expand All @@ -43,6 +44,7 @@ public function __construct(
string $appName,
IRequest $request,
private IManager $dashboardManager,
private IAppConfig $appConfig,
private IConfig $config,
private ?string $userId,
private DashboardService $service,
Expand All @@ -56,7 +58,7 @@ public function __construct(
*/
private function getShownWidgets(array $widgetIds): array {
if (empty($widgetIds)) {
$systemDefault = $this->config->getAppValue('dashboard', 'layout', 'recommendations,spreed,mail,calendar');
$systemDefault = $this->appConfig->getAppValueString('layout', 'recommendations,spreed,mail,calendar');
$widgetIds = explode(',', $this->config->getUserValue($this->userId, 'dashboard', 'layout', $systemDefault));
}

Expand Down
4 changes: 3 additions & 1 deletion apps/dashboard/lib/Service/DashboardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
use JsonException;
use OCP\Accounts\IAccountManager;
use OCP\Accounts\PropertyDoesNotExistException;
use OCP\AppFramework\Services\IAppConfig;
use OCP\IConfig;
use OCP\IUserManager;

class DashboardService {
public function __construct(
private IConfig $config,
private IAppConfig $appConfig,
private ?string $userId,
private IUserManager $userManager,
private IAccountManager $accountManager,
Expand All @@ -28,7 +30,7 @@ public function __construct(
* @return list<string>
*/
public function getLayout(): array {
$systemDefault = $this->config->getAppValue('dashboard', 'layout', 'recommendations,spreed,mail,calendar');
$systemDefault = $this->appConfig->getAppValueString('layout', 'recommendations,spreed,mail,calendar');
return array_values(array_filter(explode(',', $this->config->getUserValue($this->userId, 'dashboard', 'layout', $systemDefault)), fn (string $value) => $value !== ''));
}

Expand Down
5 changes: 5 additions & 0 deletions apps/dashboard/tests/DashboardServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use OC\Accounts\Account;
use OCA\Dashboard\Service\DashboardService;
use OCP\Accounts\IAccountManager;
use OCP\AppFramework\Services\IAppConfig;
use OCP\IConfig;
use OCP\IUser;
use OCP\IUserManager;
Expand All @@ -21,6 +22,7 @@
class DashboardServiceTest extends TestCase {

private IConfig&MockObject $config;
private IAppConfig&MockObject $appConfig;
private IUserManager&MockObject $userManager;
private IAccountManager&MockObject $accountManager;
private DashboardService $service;
Expand All @@ -29,11 +31,13 @@ protected function setUp(): void {
parent::setUp();

$this->config = $this->createMock(IConfig::class);
$this->appConfig = $this->createMock(IAppConfig::class);
$this->userManager = $this->createMock(IUserManager::class);
$this->accountManager = $this->createMock(IAccountManager::class);

$this->service = new DashboardService(
$this->config,
$this->appConfig,
'alice',
$this->userManager,
$this->accountManager,
Expand Down Expand Up @@ -87,6 +91,7 @@ public function testGetBirthdateUserNotFound(): void {
public function testGetBirthdateNoUserId(): void {
$service = new DashboardService(
$this->config,
$this->appConfig,
null,
$this->userManager,
$this->accountManager,
Expand Down
10 changes: 0 additions & 10 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,6 @@
<code><![CDATA[$this->path]]></code>
</DeprecatedProperty>
</file>
<file src="apps/dashboard/lib/Controller/DashboardApiController.php">
<DeprecatedMethod>
<code><![CDATA[getAppValue]]></code>
</DeprecatedMethod>
</file>
<file src="apps/dashboard/lib/Service/DashboardService.php">
<DeprecatedMethod>
<code><![CDATA[getAppValue]]></code>
</DeprecatedMethod>
</file>
<file src="apps/dav/appinfo/v1/caldav.php">
<DeprecatedMethod>
<code><![CDATA[exec]]></code>
Expand Down
Loading