Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/WorkspaceController.php9
-rw-r--r--lib/DirectEditing/TextDirectEditor.php7
-rw-r--r--lib/Migration/Version030001Date20200402075029.php35
-rw-r--r--lib/Service/WorkspaceService.php2
4 files changed, 41 insertions, 12 deletions
diff --git a/lib/Controller/WorkspaceController.php b/lib/Controller/WorkspaceController.php
index a1d68f542..8e9f43685 100644
--- a/lib/Controller/WorkspaceController.php
+++ b/lib/Controller/WorkspaceController.php
@@ -85,11 +85,6 @@ class WorkspaceController extends OCSController {
/** @var IURLGenerator */
private $urlGenerator;
- private const SUPPORTED_FILENAMES = [
- 'README.md',
- 'Readme.md',
- 'readme.md'
- ];
/** @var IEventDispatcher */
private $eventDispatcher;
@@ -184,7 +179,7 @@ class WorkspaceController extends OCSController {
if ($folder instanceof Folder) {
$file = $this->getFile($folder);
if ($file === null) {
- $token = $this->directEditingManager->create($path . '/'. self::SUPPORTED_FILENAMES[0], Application::APP_NAME, 'textdocument');
+ $token = $this->directEditingManager->create($path . '/'. $this->workspaceService->getSupportedFilenames()[0], Application::APP_NAME, 'textdocument');
} else {
$token = $this->directEditingManager->open($path . '/'. $file->getName(), Application::APP_NAME);
}
@@ -201,7 +196,7 @@ class WorkspaceController extends OCSController {
private function getFile(Folder $folder) {
$file = null;
- foreach (self::SUPPORTED_FILENAMES as $filename) {
+ foreach ($this->workspaceService->getSupportedFilenames() as $filename) {
if ($folder->nodeExists($filename)) {
$file = $folder->get($filename);
continue;
diff --git a/lib/DirectEditing/TextDirectEditor.php b/lib/DirectEditing/TextDirectEditor.php
index e4b0d532e..1cb6f7c4b 100644
--- a/lib/DirectEditing/TextDirectEditor.php
+++ b/lib/DirectEditing/TextDirectEditor.php
@@ -82,7 +82,8 @@ class TextDirectEditor implements IEditor {
*/
public function getMimetypes(): array {
return [
- 'text/markdown'
+ 'text/markdown',
+ 'text/plain'
];
}
@@ -92,9 +93,7 @@ class TextDirectEditor implements IEditor {
* @return array
*/
public function getMimetypesOptional(): array {
- return [
- 'text/plain'
- ];
+ return [];
}
/**
diff --git a/lib/Migration/Version030001Date20200402075029.php b/lib/Migration/Version030001Date20200402075029.php
new file mode 100644
index 000000000..23b8b5936
--- /dev/null
+++ b/lib/Migration/Version030001Date20200402075029.php
@@ -0,0 +1,35 @@
+<?php
+
+declare(strict_types=1);
+
+namespace OCA\Text\Migration;
+
+use Closure;
+use OCP\DB\ISchemaWrapper;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+/**
+ * Auto-generated migration step: Please modify to your needs!
+ */
+class Version030001Date20200402075029 extends SimpleMigrationStep {
+
+ /**
+ * @param IOutput $output
+ * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
+ * @param array $options
+ * @return null|ISchemaWrapper
+ */
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+
+ $table = $schema->getTable('text_sessions');
+ $table->addIndex([
+ 'document_id',
+ 'last_contact',
+ ], 'ts_docid_lastcontact');
+
+ return $schema;
+ }
+}
diff --git a/lib/Service/WorkspaceService.php b/lib/Service/WorkspaceService.php
index 14b4bef90..143d02631 100644
--- a/lib/Service/WorkspaceService.php
+++ b/lib/Service/WorkspaceService.php
@@ -37,7 +37,7 @@ class WorkspaceService {
return $file;
}
- private function getSupportedFilenames() {
+ public function getSupportedFilenames() {
return array_merge([
$this->l10n->t('Readme') . '.md'
], self::SUPPORTED_STATIC_FILENAMES);