manual commit 2026-04-10T19:27:53Z

This commit is contained in:
2026-04-10 19:27:53 +00:00
parent a1cd67fd73
commit 1017ef6ae7
6 changed files with 277 additions and 8 deletions

View File

@@ -0,0 +1,25 @@
const { mongoose } = require('../db-connection');
/**
* Returns { text, html } for a staff member's signature.
* Returns { text: '', html: '' } if no signature is set.
*/
async function getStaffSignatureBlocks(userId) {
const StaffSignature = mongoose.model('StaffSignature');
const sig = await StaffSignature.findOne({ userId }).lean();
if (!sig || (!sig.valediction && !sig.displayName && !sig.tagline)) {
return { text: '', html: '' };
}
const lines = [];
if (sig.valediction) lines.push(sig.valediction);
if (sig.displayName) lines.push(sig.displayName);
if (sig.tagline) lines.push(sig.tagline);
const text = lines.join('\n');
const html = lines.map(l => `<div>${l}</div>`).join('');
return { text, html };
}
module.exports = { getStaffSignatureBlocks };