feat: polish reporting templates and shared controls
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
const LEADING_SMS_SIGNATURE = /^【[^】]+】/;
|
||||
|
||||
export function formatSmsSignature(name?: string | null) {
|
||||
const innerName = (name ?? '').trim().replace(/^[【\[]+|[】\]]+$/g, '').trim();
|
||||
return innerName ? `【${innerName}】` : '';
|
||||
}
|
||||
|
||||
export function replaceLeadingSmsSignature(content: string, signatureName?: string | null) {
|
||||
const body = content.replace(LEADING_SMS_SIGNATURE, '');
|
||||
return `${formatSmsSignature(signatureName)}${body}`;
|
||||
}
|
||||
Reference in New Issue
Block a user