Tailor signature certificate email copy for approvals
Store the per-signature email subject as text on the electronic_signatures row at creation time, mirroring the consent_text pattern. The document approval service sets "Your approved <Title> - Certificate of Completion"; other callers default to "Your signed <Name> - Certificate of Completion". The certificate worker uses signature.email_subject as the email subject, falling back to the default format when the column is empty. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -39,6 +39,7 @@ type ElectronicSignature struct {
|
||||
FileID gid.GID `db:"file_id"`
|
||||
SignerEmail string `db:"signer_email"`
|
||||
ConsentText string `db:"consent_text"`
|
||||
EmailSubject string `db:"email_subject"`
|
||||
SignerFullName *string `db:"signer_full_name"`
|
||||
SignerIPAddress *string `db:"signer_ip_address"`
|
||||
SignerUserAgent *string `db:"signer_user_agent"`
|
||||
@@ -85,11 +86,11 @@ func (es *ElectronicSignature) Insert(
|
||||
q := `
|
||||
INSERT INTO electronic_signatures (
|
||||
id, tenant_id, organization_id, status, document_type, document_name, file_id,
|
||||
signer_email, consent_text, seal_version, attempt_count, max_attempts,
|
||||
signer_email, consent_text, email_subject, seal_version, attempt_count, max_attempts,
|
||||
created_at, updated_at
|
||||
) VALUES (
|
||||
@id, @tenant_id, @organization_id, @status, @document_type, @document_name, @file_id,
|
||||
@signer_email, @consent_text, @seal_version, @attempt_count, @max_attempts,
|
||||
@signer_email, @consent_text, @email_subject, @seal_version, @attempt_count, @max_attempts,
|
||||
@created_at, @updated_at
|
||||
)
|
||||
`
|
||||
@@ -103,6 +104,7 @@ INSERT INTO electronic_signatures (
|
||||
"file_id": es.FileID,
|
||||
"signer_email": es.SignerEmail,
|
||||
"consent_text": es.ConsentText,
|
||||
"email_subject": es.EmailSubject,
|
||||
"seal_version": es.SealVersion,
|
||||
"attempt_count": es.AttemptCount,
|
||||
"max_attempts": es.MaxAttempts,
|
||||
@@ -187,7 +189,7 @@ func (es *ElectronicSignature) LoadByID(
|
||||
q := `
|
||||
SELECT
|
||||
id, tenant_id, organization_id, status, document_type, document_name, file_id,
|
||||
signer_email, consent_text, signer_full_name, signer_ip_address,
|
||||
signer_email, consent_text, email_subject, signer_full_name, signer_ip_address,
|
||||
signer_user_agent, file_hash, seal, seal_version, tsa_token, signed_at,
|
||||
certificate_file_id, certificate_processing_started_at,
|
||||
attempt_count, max_attempts, last_attempted_at, last_error,
|
||||
@@ -227,7 +229,7 @@ func (es *ElectronicSignature) LoadNextAcceptedForUpdateSkipLocked(
|
||||
q := `
|
||||
SELECT
|
||||
id, tenant_id, organization_id, status, document_type, document_name, file_id,
|
||||
signer_email, consent_text, signer_full_name, signer_ip_address,
|
||||
signer_email, consent_text, email_subject, signer_full_name, signer_ip_address,
|
||||
signer_user_agent, file_hash, seal, seal_version, tsa_token, signed_at,
|
||||
certificate_file_id, certificate_processing_started_at,
|
||||
attempt_count, max_attempts, last_attempted_at, last_error,
|
||||
@@ -265,7 +267,7 @@ func (es *ElectronicSignature) LoadNextCompletedWithoutCertificateForUpdate(
|
||||
q := `
|
||||
SELECT
|
||||
id, tenant_id, organization_id, status, document_type, document_name, file_id,
|
||||
signer_email, consent_text, signer_full_name, signer_ip_address,
|
||||
signer_email, consent_text, email_subject, signer_full_name, signer_ip_address,
|
||||
signer_user_agent, file_hash, seal, seal_version, tsa_token, signed_at,
|
||||
certificate_file_id, certificate_processing_started_at,
|
||||
attempt_count, max_attempts, last_attempted_at, last_error,
|
||||
|
||||
19
pkg/coredata/migrations/20260515T140410Z.sql
Normal file
19
pkg/coredata/migrations/20260515T140410Z.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- Copyright (c) 2026 Probo Inc <hello@getprobo.com>.
|
||||
--
|
||||
-- Permission to use, copy, modify, and/or distribute this software for any
|
||||
-- purpose with or without fee is hereby granted, provided that the above
|
||||
-- copyright notice and this permission notice appear in all copies.
|
||||
--
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
-- PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
ALTER TABLE electronic_signatures
|
||||
ADD COLUMN email_subject TEXT NOT NULL DEFAULT '';
|
||||
|
||||
ALTER TABLE electronic_signatures
|
||||
ALTER COLUMN email_subject DROP DEFAULT;
|
||||
Reference in New Issue
Block a user