fix: empty signature added after every certificate saving (#30912)

A new behaviour:

- Empty signature is still added when initially create a certificate;
- Empty signature isn't added when certificate has at least one signature.
This commit is contained in:
Eugene Dyudyunov
2022-09-12 16:18:05 +03:00
committed by GitHub
parent 8c13fae0ff
commit 74daecb155

View File

@@ -43,7 +43,7 @@ define([
initialize: function(attributes, options) {
// Set up the initial state of the attributes set for this model instance
this.canBeEmpty = options && options.canBeEmpty;
if (options.add) {
if (options.add && !attributes.signatories) {
// Ensure at least one child Signatory model is defined for any new Certificate model
attributes.signatories = new SignatoryModel({certificate: this});
}