From ca2a83dabb2c9857a53be6e8617335713810de6e Mon Sep 17 00:00:00 2001 From: Florian Steffens Date: Fri, 8 Sep 2023 11:17:04 +0200 Subject: [PATCH 1/3] fix(tutorial): use the new column type text-rich instead of text-long Signed-off-by: Florian Steffens --- lib/Service/TableTemplateService.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/Service/TableTemplateService.php b/lib/Service/TableTemplateService.php index 2e54abee0..30109c416 100644 --- a/lib/Service/TableTemplateService.php +++ b/lib/Service/TableTemplateService.php @@ -148,7 +148,7 @@ private function makeWeight(Table $table):void { $params = [ 'title' => $this->l->t('Comments'), 'type' => 'text', - 'subtype' => 'long', + 'subtype' => 'rich', ]; $columns['comment'] = $this->createColumn($table->id, $params); @@ -234,7 +234,7 @@ private function makeCustomers(Table $table):void { $params = [ 'title' => $this->l->t('Description'), 'type' => 'text', - 'subtype' => 'long', + 'subtype' => 'rich', ]; $columns['description'] = $this->createColumn($table->id, $params); @@ -242,7 +242,7 @@ private function makeCustomers(Table $table):void { $params = [ 'title' => $this->l->t('Contact information'), 'type' => 'text', - 'subtype' => 'long', + 'subtype' => 'rich', ]; $columns['contactInformation'] = $this->createColumn($table->id, $params); @@ -259,7 +259,7 @@ private function makeCustomers(Table $table):void { $params = [ 'title' => $this->l->t('Comment'), 'type' => 'text', - 'subtype' => 'long', + 'subtype' => 'rich', ]; $columns['comment'] = $this->createColumn($table->id, $params); @@ -408,7 +408,7 @@ private function makeVacationRequests(Table $table):void { $params = [ 'title' => $this->l->t('Comments'), 'type' => 'text', - 'subtype' => 'long', + 'subtype' => 'rich', ]; $columns['comment'] = $this->createColumn($table->id, $params); @@ -537,7 +537,7 @@ private function makeMembers(Table $table):void { $params = [ 'title' => $this->l->t('Skills'), 'type' => 'text', - 'subtype' => 'long', + 'subtype' => 'rich', ]; $columns['skills'] = $this->createColumn($table->id, $params); @@ -553,7 +553,7 @@ private function makeMembers(Table $table):void { $params = [ 'title' => $this->l->t('Comments'), 'type' => 'text', - 'subtype' => 'long', + 'subtype' => 'rich', ]; $columns['comment'] = $this->createColumn($table->id, $params); @@ -595,7 +595,7 @@ private function makeTodo(Table $table): void { $params = [ 'title' => $this->l->t('Description'), 'type' => 'text', - 'subtype' => 'long', + 'subtype' => 'rich', 'description' => $this->l->t('Title or short description'), 'textMultiline' => true, @@ -605,7 +605,7 @@ private function makeTodo(Table $table): void { $params = [ 'title' => $this->l->t('Target'), 'type' => 'text', - 'subtype' => 'long', + 'subtype' => 'rich', 'description' => $this->l->t('Date, time or whatever'), ]; @@ -623,7 +623,7 @@ private function makeTodo(Table $table): void { $params = [ 'title' => $this->l->t('Comments'), 'type' => 'text', - 'subtype' => 'long', + 'subtype' => 'rich', ]; $columns['comments'] = $this->createColumn($table->id, $params); @@ -707,7 +707,7 @@ private function makeStartupTable(Table $table):void { $params = [ 'title' => $this->l->t('How to do'), 'type' => 'text', - 'subtype' => 'long', + 'subtype' => 'rich', ]; $columns['how'] = $this->createColumn($table->id, $params); From 257bdd3395ffcb8b35ae77ce8065e46937d3c1da Mon Sep 17 00:00:00 2001 From: Florian Steffens Date: Fri, 8 Sep 2023 11:42:34 +0200 Subject: [PATCH 2/3] fix(templates): select correct rich editor depending on the nc version Signed-off-by: Florian Steffens --- lib/Service/TableTemplateService.php | 36 ++++++++++++++++++---------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/lib/Service/TableTemplateService.php b/lib/Service/TableTemplateService.php index 30109c416..6138e9ceb 100644 --- a/lib/Service/TableTemplateService.php +++ b/lib/Service/TableTemplateService.php @@ -9,6 +9,7 @@ use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\MultipleObjectsReturnedException; use OCP\DB\Exception; +use OCP\IConfig; use OCP\IL10N; use Psr\Log\LoggerInterface; @@ -25,13 +26,24 @@ class TableTemplateService { private ?string $userId; - public function __construct(LoggerInterface $logger, IL10N $l, ColumnService $columnService, ?string $userId, RowService $rowService, ViewService $viewService) { + private IConfig $config; + + private string $textRichColumnTypeName = 'rich'; + + public function __construct(LoggerInterface $logger, IL10N $l, ColumnService $columnService, ?string $userId, RowService $rowService, ViewService $viewService, IConfig $config) { $this->logger = $logger; $this->l = $l; $this->columnService = $columnService; $this->rowService = $rowService; $this->viewService = $viewService; $this->userId = $userId; + $this->config = $config; + + // if we are on NC25, wie have to use the old text-long column type + // this is because NC25 does not serve the text editor globally + if (version_compare($this->config->getSystemValueString('version', '0.0.0'), '26.0.0', '<')) { + $this->textRichColumnTypeName = 'long'; + } } /** @@ -148,7 +160,7 @@ private function makeWeight(Table $table):void { $params = [ 'title' => $this->l->t('Comments'), 'type' => 'text', - 'subtype' => 'rich', + 'subtype' => $this->textRichColumnTypeName, ]; $columns['comment'] = $this->createColumn($table->id, $params); @@ -234,7 +246,7 @@ private function makeCustomers(Table $table):void { $params = [ 'title' => $this->l->t('Description'), 'type' => 'text', - 'subtype' => 'rich', + 'subtype' => $this->textRichColumnTypeName, ]; $columns['description'] = $this->createColumn($table->id, $params); @@ -242,7 +254,7 @@ private function makeCustomers(Table $table):void { $params = [ 'title' => $this->l->t('Contact information'), 'type' => 'text', - 'subtype' => 'rich', + 'subtype' => $this->textRichColumnTypeName, ]; $columns['contactInformation'] = $this->createColumn($table->id, $params); @@ -259,7 +271,7 @@ private function makeCustomers(Table $table):void { $params = [ 'title' => $this->l->t('Comment'), 'type' => 'text', - 'subtype' => 'rich', + 'subtype' => $this->textRichColumnTypeName, ]; $columns['comment'] = $this->createColumn($table->id, $params); @@ -408,7 +420,7 @@ private function makeVacationRequests(Table $table):void { $params = [ 'title' => $this->l->t('Comments'), 'type' => 'text', - 'subtype' => 'rich', + 'subtype' => $this->textRichColumnTypeName, ]; $columns['comment'] = $this->createColumn($table->id, $params); @@ -537,7 +549,7 @@ private function makeMembers(Table $table):void { $params = [ 'title' => $this->l->t('Skills'), 'type' => 'text', - 'subtype' => 'rich', + 'subtype' => $this->textRichColumnTypeName, ]; $columns['skills'] = $this->createColumn($table->id, $params); @@ -553,7 +565,7 @@ private function makeMembers(Table $table):void { $params = [ 'title' => $this->l->t('Comments'), 'type' => 'text', - 'subtype' => 'rich', + 'subtype' => $this->textRichColumnTypeName, ]; $columns['comment'] = $this->createColumn($table->id, $params); @@ -595,7 +607,7 @@ private function makeTodo(Table $table): void { $params = [ 'title' => $this->l->t('Description'), 'type' => 'text', - 'subtype' => 'rich', + 'subtype' => $this->textRichColumnTypeName, 'description' => $this->l->t('Title or short description'), 'textMultiline' => true, @@ -605,7 +617,7 @@ private function makeTodo(Table $table): void { $params = [ 'title' => $this->l->t('Target'), 'type' => 'text', - 'subtype' => 'rich', + 'subtype' => $this->textRichColumnTypeName, 'description' => $this->l->t('Date, time or whatever'), ]; @@ -623,7 +635,7 @@ private function makeTodo(Table $table): void { $params = [ 'title' => $this->l->t('Comments'), 'type' => 'text', - 'subtype' => 'rich', + 'subtype' => $this->textRichColumnTypeName, ]; $columns['comments'] = $this->createColumn($table->id, $params); @@ -707,7 +719,7 @@ private function makeStartupTable(Table $table):void { $params = [ 'title' => $this->l->t('How to do'), 'type' => 'text', - 'subtype' => 'rich', + 'subtype' => $this->textRichColumnTypeName, ]; $columns['how'] = $this->createColumn($table->id, $params); From 8150318b195a8657b93ac54293a682bba6924a87 Mon Sep 17 00:00:00 2001 From: Florian Steffens Date: Fri, 8 Sep 2023 13:08:13 +0200 Subject: [PATCH 3/3] adjust cypress test setup Signed-off-by: Florian Steffens --- .github/workflows/cypress.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 242a3dc7c..82b0193a2 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -63,6 +63,18 @@ jobs: ref: ${{ matrix.server-versions }} path: apps/viewer + - name: Register text Git reference + run: | + text_app_ref="$(if [ "${{ matrix.server-versions }}" = "master" ]; then echo -n "main"; else echo -n "${{ matrix.server-versions }}"; fi)" + echo "text_app_ref=$text_app_ref" >> $GITHUB_ENV + + - name: Checkout text app + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + with: + repository: nextcloud/text + path: apps/text + ref: ${{ env.text_app_ref }} + - name: Checkout app uses: actions/checkout@v3 with: @@ -107,6 +119,7 @@ jobs: ./occ config:system:set memcache.distributed --value="\\OC\\Memcache\\APCu" cat config/config.php ./occ user:list + ./occ app:enable --force text ./occ app:enable --force ${{ env.APP_NAME }} ./occ config:system:set query_log_file --value '/home/runner/work/${{ env.APP_NAME }}/${{ env.APP_NAME }}/query.log' php -S 127.0.0.1:8081 > /tmp/requestlog 2>&1 &