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 & diff --git a/lib/Service/TableTemplateService.php b/lib/Service/TableTemplateService.php index 2e54abee0..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' => 'long', + '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' => 'long', + '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' => 'long', + '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' => 'long', + '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' => 'long', + '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' => 'long', + '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' => 'long', + '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' => 'long', + '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' => 'long', + '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' => 'long', + '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' => 'long', + 'subtype' => $this->textRichColumnTypeName, ]; $columns['how'] = $this->createColumn($table->id, $params);