Skip to content

Commit da2f589

Browse files
committed
fixup! feat: downloading forms
rename download to export
1 parent 8b016bc commit da2f589

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

lib/Controller/ApiController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ private function setDefaults(array $formData) {
369369
* Read all information to edit a Form (form, questions, options, except submissions/answers)
370370
*
371371
* @param int $formId Id of the form
372-
* @param ?bool $download if the form should be downloaded
372+
* @param ?bool $export if the form should be downloaded
373373
* @return DataResponse<Http::STATUS_OK, FormsForm, array{}>|DataDownloadResponse<Http::STATUS_OK, 'application/json', array{}>
374374
* @throws OCSBadRequestException Could not find form
375375
* @throws OCSForbiddenException User has no permissions to get this form
@@ -380,10 +380,10 @@ private function setDefaults(array $formData) {
380380
#[NoAdminRequired()]
381381
#[BruteForceProtection(action: 'form')]
382382
#[ApiRoute(verb: 'GET', url: '/api/v3/forms/{formId}')]
383-
public function getForm(int $formId, ?bool $download): DataResponse|DataDownloadResponse {
383+
public function getForm(int $formId, ?bool $export): DataResponse|DataDownloadResponse {
384384
$form = $this->formsService->getFormIfAllowed($formId, Constants::PERMISSION_SUBMIT);
385385

386-
if ($download) {
386+
if ($export) {
387387
$formData = $this->formsService->getPublicForm($form);
388388
unset($formData['hash']);
389389
unset($formData['created']);
@@ -407,11 +407,11 @@ public function getForm(int $formId, ?bool $download): DataResponse|DataDownload
407407
}
408408
}
409409

410-
$downloadFile = ['form' => $formData,'appVersion' => $this->appManager->getAppVersion('forms')];
410+
$exportFile = ['form' => $formData,'appVersion' => $this->appManager->getAppVersion('forms')];
411411
$fileName = $this->filePathHelper->normalizeFileName($form->getTitle() . '.json');
412412

413413
return new DataDownloadResponse(
414-
json_encode($downloadFile), $fileName, 'application/json');
414+
json_encode($exportFile), $fileName, 'application/json');
415415
}
416416

417417
return new DataResponse($this->formsService->getForm($form));

openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@
10491049
}
10501050
},
10511051
{
1052-
"name": "download",
1052+
"name": "export",
10531053
"in": "query",
10541054
"description": "if the form should be downloaded",
10551055
"schema": {

src/Forms.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,8 @@ export default {
603603
showVersionMismatch.value = false
604604
formForImport = undefined
605605
}
606-
const onDownloadForm = async (id) => {
607-
const url = generateOcsUrl('apps/forms/api/v3/forms/{id}?download=1', {
606+
const onExportForm = async (id) => {
607+
const url = generateOcsUrl('apps/forms/api/v3/forms/{id}?export=1', {
608608
id,
609609
})
610610
window.open(url, '_blank')
@@ -696,7 +696,7 @@ export default {
696696
fetchPartialForm,
697697
onNewForm,
698698
onCloneForm,
699-
onDownloadForm,
699+
onExportForm,
700700
onUploadForm,
701701
onDeleteForm,
702702
onImportForm,

src/components/AppNavigationForm.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</template>
6565
{{ t('forms', 'Copy form') }}
6666
</NcActionButton>
67-
<NcActionButton v-if="canEdit" closeAfterClick @click="onDownloadForm">
67+
<NcActionButton v-if="canEdit" closeAfterClick @click="onExportForm">
6868
<template #icon>
6969
<NcIconSvgWrapper :svg="IconDownload" />
7070
</template>
@@ -302,7 +302,7 @@ export default {
302302
this.$emit('clone', this.form.id)
303303
},
304304
305-
onDownloadForm() {
305+
onExportForm() {
306306
const downloadUrl =
307307
generateOcsUrl('apps/forms/api/v3/forms/{id}', {
308308
id: this.form.id,

0 commit comments

Comments
 (0)