Skip to content

Commit f84b816

Browse files
Merge pull request #55993 from nextcloud/fix/direct-editing-interface
fix(DirectEditing): expose already used methods on the public interface
2 parents d77a0ed + cd4c60f commit f84b816

5 files changed

Lines changed: 17 additions & 20 deletions

File tree

build/psalm-baseline.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,12 +1449,8 @@
14491449
</DeprecatedMethod>
14501450
</file>
14511451
<file src="apps/files/lib/Controller/DirectEditingController.php">
1452-
<InvalidArgument>
1453-
<code><![CDATA[$templateId]]></code>
1454-
</InvalidArgument>
14551452
<UndefinedInterfaceMethod>
14561453
<code><![CDATA[getTemplates]]></code>
1457-
<code><![CDATA[open]]></code>
14581454
</UndefinedInterfaceMethod>
14591455
</file>
14601456
<file src="apps/files/lib/Controller/ViewController.php">

lib/private/DirectEditing/Manager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public function create(string $path, string $editorId, string $creatorId, $templ
125125
throw new \RuntimeException('No creator found');
126126
}
127127

128+
#[\Override]
128129
public function open(string $filePath, ?string $editorId = null, ?int $fileId = null): string {
129130
$userFolder = $this->rootFolder->getUserFolder($this->userId);
130131
$file = $userFolder->get($filePath);

lib/private/DirectEditing/Token.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function getFile(): File {
3535
return $this->manager->getFileForToken($this->data['user_id'], $this->data['file_id'], $this->data['file_path']);
3636
}
3737

38+
#[\Override]
3839
public function getToken(): string {
3940
return $this->data['token'];
4041
}

lib/public/DirectEditing/IManager.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,39 +23,38 @@ interface IManager {
2323
* Register a new editor
2424
*
2525
* @since 18.0.0
26-
* @param IEditor $directEditor
2726
*/
2827
public function registerDirectEditor(IEditor $directEditor): void;
2928

3029
/**
3130
* Open the editing page for a provided token
3231
*
3332
* @since 18.0.0
34-
* @param string $token
35-
* @return Response
3633
*/
3734
public function edit(string $token): Response;
3835

3936
/**
40-
* Create a new token based on the file path and editor details
37+
* Create a file and generate a token based on the file path and editor details
4138
*
4239
* @since 18.0.0
43-
* @param string $path
44-
* @param string $editorId
45-
* @param string $creatorId
46-
* @param null $templateId
47-
* @return string
4840
* @throws NotPermittedException
4941
* @throws RuntimeException
5042
*/
5143
public function create(string $path, string $editorId, string $creatorId, $templateId = null): string;
5244

45+
/**
46+
* Create a token based on an existing file path and editor details
47+
*
48+
* @since 35.0.0
49+
* @throws NotPermittedException
50+
* @throws RuntimeException
51+
*/
52+
public function open(string $filePath, ?string $editorId = null, ?int $fileId = null): string;
53+
5354
/**
5455
* Get the token details for a given token
5556
*
5657
* @since 18.0.0
57-
* @param string $token
58-
* @return IToken
5958
*/
6059
public function getToken(string $token): IToken;
6160

@@ -71,7 +70,6 @@ public function cleanup(): int;
7170
* Check if direct editing is enabled
7271
*
7372
* @since 20.0.0
74-
* @return bool
7573
*/
7674
public function isEnabled(): bool;
7775

lib/public/DirectEditing/IToken.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public function invalidate(): void;
3232
* Check if the token has already been used
3333
*
3434
* @since 18.0.0
35-
* @return bool
3635
*/
3736
public function hasBeenAccessed(): bool;
3837

@@ -47,20 +46,22 @@ public function useTokenScope(): void;
4746
* Get the file that is related to the token
4847
*
4948
* @since 18.0.0
50-
* @return File
5149
* @throws NotFoundException
5250
*/
5351
public function getFile(): File;
5452

5553
/**
5654
* @since 18.0.0
57-
* @return string
5855
*/
5956
public function getEditor(): string;
6057

6158
/**
6259
* @since 18.0.0
63-
* @return string
6460
*/
6561
public function getUser(): string;
62+
63+
/**
64+
* @since 35.0.0
65+
*/
66+
public function getToken(): string;
6667
}

0 commit comments

Comments
 (0)