Remove dead/stale code, dedup close+escalation paths
Dead/stale removals (grep-confirmed no consumers):
- config: drop 9 unread CONFIG keys (ROLE_TO_PING_ID, SIGNATURE,
REMINDER_*, RENAME_LOG_CHANNEL_ID, SETTINGS_*); remove their
ALLOWED_CONFIG_KEYS entries and the orphaned settings-site UI fields
- configSchema: delete unreachable json/string_or_json validators
- models: drop unused ticketTag field
- gmail-poll: remove unused isPollSuspended export
- utils: remove dead htmlToTextWithBlocks/decodeHtmlEntities/BLOCK_TAG_REGEX
- internalApi: remove router._allowedKeys (test it served is gone)
- discord client: drop unused GuildPresences privileged intent
- broccolini-discord: remove dormant /api 503 gate (no /api routes)
Fixes:
- context-menu ticket create now uses makeTicketName('unclaimed', ...)
instead of the contract-violating ticket-<n> name
- drop write-only pending.userId from both close paths
Dedup / simplify:
- new services/transcript.js shares the transcript text/date/header
builders between the button and force-close paths (had drifted)
- resolveEscalationCategoryId() replaces 3 copies of the category logic
- ticketChannelOverwrites() shares the create-permission array between
the two interactive ticket-create paths
- finalizeBody() shares the email-cleanup tail in parseGmailMessage
- getTicketActionRow drops its never-passed options arg;
sendTicketNotificationEmail drops its always-null subjectLine arg
- hoist invariant guild lookup out of the auto-close/unclaim loops
- drop redundant lastActivity write (and now-dead updateTicketActivity)
- /help lists all current commands and the right-click apps
This commit is contained in:
26
utils.js
26
utils.js
@@ -22,9 +22,6 @@ function isStaff(member) {
|
||||
|
||||
// --- TEXT PROCESSING ---
|
||||
|
||||
const BLOCK_TAG_REGEX =
|
||||
/<\/(p|div|li|h[1-6]|tr|table|section|article|blockquote)>/gi;
|
||||
|
||||
function escapeRegex(str) {
|
||||
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}
|
||||
@@ -40,28 +37,6 @@ function escapeHtml(str) {
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
function decodeHtmlEntities(str) {
|
||||
if (!str) return '';
|
||||
return str
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, "'")
|
||||
.replace(/ /g, ' ');
|
||||
}
|
||||
|
||||
function htmlToTextWithBlocks(html) {
|
||||
return decodeHtmlEntities(
|
||||
html
|
||||
.replace(/\r\n/g, '\n')
|
||||
.replace(/<br\s*\/?>/gi, '\n')
|
||||
.replace(BLOCK_TAG_REGEX, '\n\n')
|
||||
.replace(/<(ul|ol)[^>]*>/gi, '\n')
|
||||
.replace(/<[^>]*>?/gm, '')
|
||||
);
|
||||
}
|
||||
|
||||
// --- EMAIL BODY EXTRACTION ---
|
||||
|
||||
function decodeGmailData(p) {
|
||||
@@ -277,7 +252,6 @@ module.exports = {
|
||||
escapeHtml,
|
||||
safeEqual,
|
||||
isStaff,
|
||||
htmlToTextWithBlocks,
|
||||
getCleanBody,
|
||||
stripEmailQuotes,
|
||||
stripMobileFooter,
|
||||
|
||||
Reference in New Issue
Block a user