Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix undefined variable
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Dec 2, 2019
commit 1e5f5e3ff0e8c1670819fe70a2e1b84a9ceb4d4a
8 changes: 7 additions & 1 deletion lib/Controller/WorkspaceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
use OCP\AppFramework\OCSController;
use OCP\DirectEditing\IManager as IDirectEditingManager;
use OCP\DirectEditing\RegisterDirectEditorEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
Expand Down Expand Up @@ -89,15 +90,18 @@ class WorkspaceController extends OCSController {
'Readme.md',
'readme.md'
];
/** @var IEventDispatcher */
private $eventDispatcher;

public function __construct($appName, IRequest $request, IRootFolder $rootFolder, IManager $shareManager, IDirectEditingManager $directEditingManager, IURLGenerator $urlGenerator, WorkspaceService $workspaceService, $userId) {
public function __construct($appName, IRequest $request, IRootFolder $rootFolder, IManager $shareManager, IDirectEditingManager $directEditingManager, IURLGenerator $urlGenerator, WorkspaceService $workspaceService, IEventDispatcher $eventDispatcher, $userId) {
parent::__construct($appName, $request);
$this->rootFolder = $rootFolder;
$this->shareManager = $shareManager;
$this->workspaceService = $workspaceService;
$this->userId = $userId;
$this->directEditingManager = $directEditingManager;
$this->urlGenerator = $urlGenerator;
$this->eventDispatcher = $eventDispatcher;
}

/**
Expand Down Expand Up @@ -165,6 +169,8 @@ public function publicFolder(string $shareToken, string $path = '/'): DataRespon
* @NoAdminRequired
*/
public function direct(string $path): DataResponse {
$this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));

try {
$folder = $this->rootFolder->getUserFolder($this->userId)->get($path);
if ($folder instanceof Folder) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/ApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function sync($documentId, $sessionId, $sessionToken, $version = 0, $auto
$file = $this->documentService->getFileForSession($session, $token);

try {
$result['document'] = $this->documentService->autosave($file, $documentId, $version, $autosaveContent, $force, $manualSave, $token, $this->request->getParam('filePath'), $userId);
$result['document'] = $this->documentService->autosave($file, $documentId, $version, $autosaveContent, $force, $manualSave, $token, $this->request->getParam('filePath'));
} catch (DocumentSaveConflictException $e) {
try {
$result['outsideChange'] = $file->getContent();
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/DocumentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function getSteps($documentId, $lastVersion) {
* @throws NotPermittedException
* @throws ShareNotFound
*/
public function autosave($file, $documentId, $version, $autoaveDocument, $force = false, $manualSave = false, $shareToken = null, $filePath = null, $userId = null): Document {
public function autosave($file, $documentId, $version, $autoaveDocument, $force = false, $manualSave = false, $shareToken = null, $filePath = null): Document {
/** @var Document $document */
$document = $this->documentMapper->find($documentId);

Expand Down