Skip to content

Commit

Permalink
Merge pull request #1106 from nextcloud/bugfix/1089
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr authored Sep 9, 2023
2 parents 6cfcaa7 + 442680f commit 1f81ccb
Showing 1 changed file with 3 additions and 6 deletions.
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

0 comments on commit 1f81ccb

Please sign in to comment.