adjust capture revision

This commit is contained in:
Pete Matsyburka
2026-05-15 17:50:18 +03:00
parent 41604008d1
commit 755decca27
4 changed files with 22 additions and 7 deletions
+13 -4
View File
@@ -3146,7 +3146,11 @@ export default {
const dynamicDocumentSaves = dynamicDocumentRefs.map((ref) => ref.saveBody())
Promise.all([this.save({ force: true, revision: this.withRevisions }), ...dynamicDocumentSaves]).then(() => {
Promise.all([this.save({ force: true }), ...dynamicDocumentSaves]).then(() => {
if (this.withRevisions) {
this.captureRevision()
}
window.Turbo.visit(`/templates/${this.template.id}`)
}).finally(() => {
this.isSaving = false
@@ -3377,7 +3381,7 @@ export default {
}
})
},
save ({ force = false, revision = false } = {}) {
save ({ force = false } = {}) {
this.pendingFieldAttachmentUuids = []
if (this.beforeRevisionSnapshot) {
@@ -3409,8 +3413,7 @@ export default {
submitters: this.template.submitters,
fields: this.template.fields,
variables_schema: this.template.variables_schema
},
...(revision ? { revision: true } : {})
}
}),
headers: { 'Content-Type': 'application/json' }
}).then(() => {
@@ -3419,6 +3422,12 @@ export default {
}
})
},
captureRevision () {
return this.baseFetch(`/templates/${this.template.id}/versions`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' }
})
},
onDynamicDocumentUpdate () {
this.rebuildVariablesSchema()