cambia algunos iconos para que sin responsable sea 🙅 y que las badges en la web estén centradas aunque la row sea de dos lineas

main
borja 7 days ago
parent 226e1bc01f
commit a24e591cb4

@ -27,7 +27,7 @@
const groups = data.groups || []; const groups = data.groups || [];
let itemsByGroup: Record<string, Task[]> = {}; let itemsByGroup: Record<string, Task[]> = {};
for (const [gid, arr] of Object.entries(data.itemsByGroup || {})) { for (const [gid, arr] of Object.entries(data.itemsByGroup || {})) {
itemsByGroup[gid] = Array.isArray(arr as any) ? ([...(arr as any)]) : []; itemsByGroup[gid] = Array.isArray(arr as any) ? [...(arr as any)] : [];
} }
function buildQuery(params: { unassignedFirst?: boolean }) { function buildQuery(params: { unassignedFirst?: boolean }) {
@ -103,12 +103,21 @@
queueMicrotask(() => window.scrollTo({ top: y })); queueMicrotask(() => window.scrollTo({ top: y }));
} }
function updateGroupTask(groupId: string, detail: { id: number; action: string; patch: Partial<Task & { completed?: boolean; completed_at?: string | null }> }) { function updateGroupTask(
groupId: string,
detail: {
id: number;
action: string;
patch: Partial<
Task & { completed?: boolean; completed_at?: string | null }
>;
},
) {
const { id, action, patch } = detail; const { id, action, patch } = detail;
const arr = itemsByGroup[groupId] || []; const arr = itemsByGroup[groupId] || [];
const idx = arr.findIndex((t) => t.id === id); const idx = arr.findIndex((t) => t.id === id);
if (action === 'complete') { if (action === "complete") {
if (idx >= 0) { if (idx >= 0) {
maintainScrollWhile(() => { maintainScrollWhile(() => {
arr.splice(idx, 1); arr.splice(idx, 1);
@ -228,6 +237,8 @@
border: 1px solid var(--color-border); border: 1px solid var(--color-border);
border-radius: 999px; border-radius: 999px;
font-size: 12px; font-size: 12px;
align-self: center;
white-space: nowrap;
} }
.badge.warn { .badge.warn {
border-color: var(--color-warning); border-color: var(--color-warning);

@ -1037,7 +1037,7 @@ export class CommandService {
VALUES (?, ?, ?, NULL) VALUES (?, ?, ?, NULL)
`).run(ensured, tokenHash, expiresIso); `).run(ensured, tokenHash, expiresIso);
try { Metrics.inc('web_tokens_issued_total'); } catch {} try { Metrics.inc('web_tokens_issued_total'); } catch { }
const url = new URL(`/login?token=${encodeURIComponent(token)}`, base).toString(); const url = new URL(`/login?token=${encodeURIComponent(token)}`, base).toString();
return [{ return [{
@ -1050,7 +1050,7 @@ export class CommandService {
const feature = String(process.env.FEATURE_HELP_V2 ?? 'true').toLowerCase(); const feature = String(process.env.FEATURE_HELP_V2 ?? 'true').toLowerCase();
const helpV2Enabled = !['false', '0', 'no'].includes(feature); const helpV2Enabled = !['false', '0', 'no'].includes(feature);
try { Metrics.inc('commands_unknown_total'); } catch {} try { Metrics.inc('commands_unknown_total'); } catch { }
if (!helpV2Enabled) { if (!helpV2Enabled) {
return [{ return [{
recipient: context.sender, recipient: context.sender,
@ -1093,7 +1093,7 @@ export class CommandService {
try { try {
const gid = isGroupId(context.groupId) ? context.groupId : 'dm'; const gid = isGroupId(context.groupId) ? context.groupId : 'dm';
Metrics.inc('onboarding_assign_failures_total', 1, { group_id: String(gid), source, reason }); Metrics.inc('onboarding_assign_failures_total', 1, { group_id: String(gid), source, reason });
} catch {} } catch { }
}; };
// 1) Menciones aportadas por el backend (JIDs crudos) // 1) Menciones aportadas por el backend (JIDs crudos)
@ -1229,7 +1229,7 @@ export class CommandService {
`).run(taskId, groupIdToUse, context.messageId); `).run(taskId, groupIdToUse, context.messageId);
} }
} }
} catch {} } catch { }
// Recuperar la tarea creada para obtener display_code asignado // Recuperar la tarea creada para obtener display_code asignado
const createdTask = TaskService.getTaskById(taskId); const createdTask = TaskService.getTaskById(taskId);
@ -1292,15 +1292,15 @@ export class CommandService {
? String(process.env.ONBOARDING_ENABLE_IN_TEST || '').toLowerCase() === 'true' ? String(process.env.ONBOARDING_ENABLE_IN_TEST || '').toLowerCase() === 'true'
: (() => { : (() => {
const v = process.env.ONBOARDING_PROMPTS_ENABLED; const v = process.env.ONBOARDING_PROMPTS_ENABLED;
return v == null ? true : ['true','1','yes'].includes(String(v).toLowerCase()); return v == null ? true : ['true', '1', 'yes'].includes(String(v).toLowerCase());
})(); })();
const groupLabel = isGroupId(context.groupId) ? String(context.groupId) : 'dm'; const groupLabel = isGroupId(context.groupId) ? String(context.groupId) : 'dm';
if (!enabled) { if (!enabled) {
try { Metrics.inc('onboarding_prompts_skipped_total', 1, { group_id: groupLabel, source: 'jit_assignee_failure', reason: 'disabled' }); } catch {} try { Metrics.inc('onboarding_prompts_skipped_total', 1, { group_id: groupLabel, source: 'jit_assignee_failure', reason: 'disabled' }); } catch { }
} else { } else {
const bot = String(process.env.CHATBOT_PHONE_NUMBER || '').trim(); const bot = String(process.env.CHATBOT_PHONE_NUMBER || '').trim();
if (!bot || !/^\d+$/.test(bot)) { if (!bot || !/^\d+$/.test(bot)) {
try { Metrics.inc('onboarding_prompts_skipped_total', 1, { group_id: groupLabel, source: 'jit_assignee_failure', reason: 'missing_bot_number' }); } catch {} try { Metrics.inc('onboarding_prompts_skipped_total', 1, { group_id: groupLabel, source: 'jit_assignee_failure', reason: 'missing_bot_number' }); } catch { }
} else { } else {
const list = unresolvedList.join(', '); const list = unresolvedList.join(', ');
let groupCtx = ''; let groupCtx = '';
@ -1310,7 +1310,7 @@ export class CommandService {
} }
const msg = `No puedo asignar a ${list} aún${groupCtx}. Pídele que toque este enlace y diga 'activar': https://wa.me/${bot}`; const msg = `No puedo asignar a ${list} aún${groupCtx}. Pídele que toque este enlace y diga 'activar': https://wa.me/${bot}`;
responses.push({ recipient: createdBy, message: msg }); responses.push({ recipient: createdBy, message: msg });
try { Metrics.inc('onboarding_prompts_sent_total', 1, { group_id: groupLabel, source: 'jit_assignee_failure' }); } catch {} try { Metrics.inc('onboarding_prompts_sent_total', 1, { group_id: groupLabel, source: 'jit_assignee_failure' }); } catch { }
} }
} }
} }
@ -1332,12 +1332,12 @@ export class CommandService {
// Gating de grupos en modo 'enforce' (cuando CommandService se invoca directamente) // Gating de grupos en modo 'enforce' (cuando CommandService se invoca directamente)
if (isGroupId(context.groupId)) { if (isGroupId(context.groupId)) {
try { (AllowedGroups as any).dbInstance = this.dbInstance; } catch {} try { (AllowedGroups as any).dbInstance = this.dbInstance; } catch { }
const mode = String(process.env.GROUP_GATING_MODE || 'off').toLowerCase(); const mode = String(process.env.GROUP_GATING_MODE || 'off').toLowerCase();
if (mode === 'enforce') { if (mode === 'enforce') {
try { try {
if (!AllowedGroups.isAllowed(context.groupId)) { if (!AllowedGroups.isAllowed(context.groupId)) {
try { Metrics.inc('commands_blocked_total'); } catch {} try { Metrics.inc('commands_blocked_total'); } catch { }
return { responses: [], ok: true }; return { responses: [], ok: true };
} }
} catch { } catch {

@ -4,7 +4,7 @@ export const ICONS = {
assignNotice: '📬', assignNotice: '📬',
reminder: '⏰', reminder: '⏰',
date: '📅', date: '📅',
unassigned: '🚫👤', unassigned: '🙅',
take: '✋', take: '✋',
unassign: '↩️', unassign: '↩️',
info: '', info: '',

Loading…
Cancel
Save