Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix note controller user id param #1106

Merged
merged 1 commit into from
Sep 9, 2023
Merged
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
9 changes: 3 additions & 6 deletions lib/Controller/NotesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class NotesController extends Controller {
private IConfig $settings;
private IL10N $l10n;
private IMimeTypeDetector $mimeTypeDetector;
private string $userId;

public function __construct(
string $AppName,
Expand All @@ -39,8 +38,7 @@ public function __construct(
Helper $helper,
IConfig $settings,
IL10N $l10n,
IMimeTypeDetector $mimeTypeDetector,
string $userId
IMimeTypeDetector $mimeTypeDetector
) {
parent::__construct($AppName, $request);
$this->notesService = $notesService;
Expand All @@ -50,7 +48,6 @@ public function __construct(
$this->settings = $settings;
$this->l10n = $l10n;
$this->mimeTypeDetector = $mimeTypeDetector;
$this->userId = $userId;
}

/**
Expand Down Expand Up @@ -350,11 +347,11 @@ public function uploadFile(int $noteid): JSONResponse {
}

private function inLockScope(Note $note, callable $callback) {
$isRichText = $this->settingsService->get($this->userId, 'noteMode') === 'rich';
$isRichText = $this->settingsService->get($this->helper->getUID(), 'noteMode') === 'rich';
$lockContext = new LockContext(
$note->getFile(),
$isRichText ? ILock::TYPE_APP : ILock::TYPE_USER,
$isRichText ? 'text' : $this->userId
$isRichText ? 'text' : $this->helper->getUID()
);
$this->lockManager->runInScope($lockContext, function () use ($callback) {
$callback();
Expand Down