From 9cb08e732b404701236f1f8f1cb8bf5359b290a1 Mon Sep 17 00:00:00 2001 From: Konstantin Myakshin Date: Mon, 23 Oct 2023 19:20:06 +0300 Subject: [PATCH] Fix some of code review comments Signed-off-by: Konstantin Myakshin --- lib/Controller/ApiController.php | 7 ++++--- .../Version030200Date20231001200100.php | 2 +- lib/Service/SubmissionService.php | 4 ++++ src/views/Results.vue | 18 +++++++++--------- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index 37e7450b78..1cb0e5e5b1 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -50,6 +50,7 @@ use OCP\AppFramework\OCS\OCSBadRequestException; use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCS\OCSForbiddenException; +use OCP\AppFramework\OCS\OCSNotFoundException; use OCP\AppFramework\OCSController; use OCP\Files\NotPermittedException; use OCP\IL10N; @@ -1091,7 +1092,7 @@ public function exportSubmissions(string $hash, string $fileFormat): DataDownloa $form = $this->formMapper->findByHash($hash); } catch (IMapperException $e) { $this->logger->debug('Could not find form'); - throw new OCSBadRequestException(); + throw new OCSNotFoundException(); } if (!$this->formsService->canSeeResults($form)) { @@ -1135,7 +1136,7 @@ public function exportSubmissionsToCloud(string $hash, string $path, string $fil $form = $this->formMapper->findByHash($hash); } catch (IMapperException $e) { $this->logger->debug('Could not find form'); - throw new OCSBadRequestException(); + throw new OCSNotFoundException(); } if (!$this->formsService->canSeeResults($form)) { @@ -1213,7 +1214,7 @@ public function linkFile(string $hash, string $path, string $fileFormat): DataRe $form = $this->formMapper->findByHash($hash); } catch (IMapperException $e) { $this->logger->debug('Could not find form'); - throw new OCSBadRequestException(); + throw new OCSNotFoundException(); } if ($form->getOwnerId() !== $this->currentUser->getUID()) { $this->logger->debug('This form is not owned by the current user'); diff --git a/lib/Migration/Version030200Date20231001200100.php b/lib/Migration/Version030200Date20231001200100.php index 8ec5e5904e..f0d22d4e77 100644 --- a/lib/Migration/Version030200Date20231001200100.php +++ b/lib/Migration/Version030200Date20231001200100.php @@ -5,7 +5,7 @@ /** * @copyright Copyright (c) 2023 Ferdinand Thiessen * - * @author Ferdinand Thiessen + * @author Kostiantyn Miakshyn * * @license GNU AGPL version 3 or any later version * diff --git a/lib/Service/SubmissionService.php b/lib/Service/SubmissionService.php index 539460f246..191c549508 100644 --- a/lib/Service/SubmissionService.php +++ b/lib/Service/SubmissionService.php @@ -294,6 +294,10 @@ public function getFileName(Form $form, string $fileFormat): string return str_replace(mb_str_split(\OCP\Constants::FILENAME_INVALID_CHARS), '-', $fileName); } + /** + * @param array $header + * @param array $data + */ private function exportData(array $header, array $data, string $fileFormat, ?File $file = null): string { if (!in_array($fileFormat, self::SUPPORTED_EXPORT_FORMATS)) { diff --git a/src/views/Results.vue b/src/views/Results.vue index 0b19499448..7c41bd85a4 100644 --- a/src/views/Results.vue +++ b/src/views/Results.vue @@ -87,21 +87,21 @@ - {{ t('forms', 'CSV') }} + CSV - {{ t('forms', 'ODS') }} + ODS - {{ t('forms', 'XSLX') }} + XSLX @@ -131,21 +131,21 @@ - {{ t('forms', 'CSV') }} + CSV - {{ t('forms', 'ODS') }} + ODS - {{ t('forms', 'XSLX') }} + XSLX @@ -156,21 +156,21 @@ - {{ t('forms', 'CSV') }} + CSV - {{ t('forms', 'ODS') }} + ODS - {{ t('forms', 'XSLX') }} + XSLX