-
Notifications
You must be signed in to change notification settings - Fork 81
Recover deleted draft submissions by soft-deleting them when updating the form draft #1299
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
Changes from all commits
965d489
a168bf4
1af9ba4
5a44719
6b9089f
2f79fe5
d05b2f3
9dd22ac
fa37ed3
2e76ed0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,7 +137,7 @@ module.exports = (service, endpoint) => { | |
: getPartial(Forms, request, project, Keys))) | ||
.then((partial) => Promise.all([ | ||
Forms.createVersion(partial, form, false), | ||
Submissions.clearDraftSubmissions(form.id) | ||
Submissions.deleteDraftSubmissions(form.id) | ||
])) | ||
.then(() => Forms.clearUnneededDrafts(form))) // remove drafts made obsolete by new draft | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that this endpoint will no longer result in a new form draft that's ready to be purged, I think we can remove this line. It'd be a nice way to simplify the endpoint. I also think it'd make things clearer if there was only one thing that called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One possible reason to leave it here is when there are no submissions, the draft def can be cleaned up right away. There are some tests in "purging form fields of unneeded drafts" (in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see, interesting. No strong feelings, either way! |
||
.then(success))); | ||
|
@@ -162,7 +162,7 @@ module.exports = (service, endpoint) => { | |
.then(() => Forms.getByProjectAndXmlFormId(params.projectId, params.id, false, Form.DraftVersion)) | ||
.then(getOrNotFound) | ||
: resolve(form))) | ||
ktuite marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.then(((form) => Promise.all([ Forms.publish(form), Submissions.clearDraftSubmissions(form.id) ]))) | ||
.then(((form) => Promise.all([ Forms.publish(form), Submissions.deleteDraftSubmissions(form.id) ]))) | ||
.then(success))); | ||
|
||
// Entity/Dataset-specific endpoint that is used to show how publishing | ||
|
@@ -244,7 +244,7 @@ module.exports = (service, endpoint) => { | |
.then(rejectIf(((form) => form.draftDefId == null), noargs(Problem.user.notFound))) | ||
.then((form) => Promise.all([ | ||
Forms.clearDraft(form).then(() => Forms.clearUnneededDrafts(form)), | ||
Submissions.clearDraftSubmissions(form.id), | ||
Submissions.deleteDraftSubmissions(form.id), | ||
Audits.log(auth.actor, 'form.update.draft.delete', form, { oldDraftDefId: form.draftDefId }) | ||
])) | ||
.then(success))); | ||
|
Uh oh!
There was an error while loading. Please reload this page.