Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set lastUpdated on link/unlink file #2066

Merged
merged 2 commits into from Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/Controller/ApiController.php
Expand Up @@ -1320,6 +1320,8 @@ public function unlinkFile(string $hash): DataResponse {

$this->formMapper->update($form);

$this->formsService->setLastUpdatedTimestamp($form->getId());

return new DataResponse($hash);
}

Expand Down Expand Up @@ -1363,6 +1365,8 @@ public function linkFile(string $hash, string $path, string $fileFormat): DataRe

$filePath = $this->formsService->getFilePath($form);

$this->formsService->setLastUpdatedTimestamp($form->getId());

return new DataResponse([
'fileId' => $file->getId(),
'fileFormat' => $fileFormat,
Expand Down
28 changes: 13 additions & 15 deletions src/views/Results.vue
Expand Up @@ -305,8 +305,18 @@ export default {

mixins: [PermissionTypes, ViewsMixin],

setup() {
data() {
return {
activeResponseView: responseViews[0],

isDownloadActionOpened: false,
loadingResults: true,

picker: null,
showSummary: true,
showConfirmDeleteDialog: false,
showLinkedFileNotAvailableDialog: false,

isMobile: useIsSmallMobile(),

// non reactive props
Expand Down Expand Up @@ -343,20 +353,6 @@ export default {
}
},

data() {
return {
activeResponseView: responseViews[0],

isDownloadActionOpened: false,
loadingResults: true,

picker: null,
showSummary: true,
showConfirmDeleteDialog: false,
showLinkedFileNotAvailableDialog: false,
}
},

computed: {
isFormArchived() {
return this.form.state === FormState.FormArchived
Expand Down Expand Up @@ -410,6 +406,7 @@ export default {
this.form.fileFormat = null
this.form.fileId = null
this.form.filePath = null
emit('forms:last-updated:set', this.form.id)
},
async loadFormResults() {
this.loadingResults = true
Expand Down Expand Up @@ -457,6 +454,7 @@ export default {
this.form.filePath = responseData.filePath

showSuccess(t('forms', 'File {file} successfully linked', { file: responseData.fileName }))
emit('forms:last-updated:set', this.form.id)
} catch (error) {
logger.error('Error while exporting to Files and linking', { error })
showError(t('forms', 'There was an error while linking the file'))
Expand Down