Skip to content
Closed
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
11 changes: 4 additions & 7 deletions lib/AppInfo/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,21 @@

namespace OCA\Notes\AppInfo;

use OCA\Notes\Service\NoteUtil;
use OCP\App\IAppManager;
use OCP\Capabilities\ICapability;

class Capabilities implements ICapability {
public function __construct(
private IAppManager $appManager,
private NoteUtil $noteUtil,
private ?string $userId,
) {
private IAppManager $appManager;

public function __construct(IAppManager $appManager) {
$this->appManager = $appManager;
}

public function getCapabilities(): array {
return [
Application::APP_ID => [
'api_version' => Application::$API_VERSIONS,
'version' => $this->appManager->getAppVersion(Application::APP_ID),
'notes_path' => $this->userId !== null && $this->userId !== ' ' ? $this->noteUtil->getNotesFolderUserPath($this->userId) : null,
],
];
}
Expand Down
7 changes: 0 additions & 7 deletions lib/Service/NoteUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,6 @@ public function getOrCreateFolder(string $path, bool $create = true) : Folder {
return $folder;
}

public function getNotesFolderUserPath(string $userId): ?string {
/** @psalm-suppress MissingDependency */
$userFolder = $this->getRoot()->getUserFolder($userId);
$nodesFolder = $this->getOrCreateNotesFolder($userId, false);
return $userFolder->getRelativePath($nodesFolder->getPath());
}

public function getOrCreateNotesFolder(string $userId, bool $create = true) : Folder {
$userFolder = $this->getRoot()->getUserFolder($userId);
$notesPath = $this->settingsService->get($userId, 'notesPath');
Expand Down