fix: añadir metadata a response_queue y unificar ack en CommandService

Co-authored-by: aider (openrouter/openai/gpt-5) <aider@aider.chat>
pull/1/head
borja 2 months ago
parent 79692248ef
commit 89398d2dfd

@ -167,24 +167,16 @@ export class CommandService {
const responses: CommandResponse[] = []; const responses: CommandResponse[] = [];
// 1) Ack al creador, salvo que él sea el único asignado // 1) Ack al creador siempre, en una sola línea con id y descripción
const creatorIsOnlyAssignee = assignmentUserIds.length === 1 && assignmentUserIds[0] === createdBy;
if (!creatorIsOnlyAssignee) {
responses.push({ responses.push({
recipient: createdBy, recipient: createdBy,
message: message: `✅ Tarea ${taskId} creada: "${description || '(sin descripción)'}"`,
`✅ Tarea ${taskId} creada:\n` +
`${description || '(sin descripción)'}\n` +
(dueDate ? `• Vence: ${dueDate}\n` : '') +
(assignmentUserIds.length
? `• Asignados: ${assignmentUserIds.map((uid, idx) => `${assignedDisplayNames[idx] || uid} (@${uid})`).join(', ')}`
: ''),
mentions: mentionsForSending.length > 0 ? mentionsForSending : undefined mentions: mentionsForSending.length > 0 ? mentionsForSending : undefined
}); });
}
// 2) DM a cada asignado // 2) DM a cada asignado (excluyendo al creador para evitar duplicados)
for (const uid of assignmentUserIds) { for (const uid of assignmentUserIds) {
if (uid === createdBy) continue;
responses.push({ responses.push({
recipient: uid, recipient: uid,
message: message:

@ -88,7 +88,7 @@ describe('Database', () => {
.query("PRAGMA table_info(response_queue)") .query("PRAGMA table_info(response_queue)")
.all() .all()
.map((c: any) => c.name); .map((c: any) => c.name);
expect(columns).toEqual(['id', 'recipient', 'message', 'status', 'attempts', 'last_error', 'created_at', 'updated_at']); expect(columns).toEqual(['id', 'recipient', 'message', 'status', 'attempts', 'last_error', 'metadata', 'created_at', 'updated_at']);
}); });
}); });

Loading…
Cancel
Save