|
|
|
|
@ -13,7 +13,7 @@ import { Metrics } from './metrics';
|
|
|
|
|
import { ResponseQueue } from './response-queue';
|
|
|
|
|
import { randomTokenBase64Url, sha256Hex } from '../utils/crypto';
|
|
|
|
|
import { route as routeCommand } from './commands';
|
|
|
|
|
import { ACTION_ALIASES, SCOPE_ALIASES, todayYMD as todayYMD_TZ, resolveTaskIdFromInput, parseMultipleIds } from './commands/shared';
|
|
|
|
|
import { ACTION_ALIASES, SCOPE_ALIASES, todayYMD as todayYMD_TZ, resolveTaskIdFromInput, parseMultipleIds, enforceMembership } from './commands/shared';
|
|
|
|
|
import { parseNueva } from './commands/parsers/nueva';
|
|
|
|
|
|
|
|
|
|
type CommandContext = {
|
|
|
|
|
@ -357,8 +357,7 @@ export class CommandService {
|
|
|
|
|
message: `⚠️ Tarea ${codeId(resolvedId)} no encontrada.`
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
const enforce = String(process.env.GROUP_MEMBERS_ENFORCE || '').toLowerCase() === 'true';
|
|
|
|
|
if (task && task.group_id && GroupSyncService.isSnapshotFresh(task.group_id) && enforce && !GroupSyncService.isUserActiveInGroup(context.sender, task.group_id)) {
|
|
|
|
|
if (!enforceMembership(context.sender, task)) {
|
|
|
|
|
return [{
|
|
|
|
|
recipient: context.sender,
|
|
|
|
|
message: 'No puedes completar esta tarea porque no eres de este grupo.'
|
|
|
|
|
@ -389,7 +388,6 @@ export class CommandService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Modo múltiple
|
|
|
|
|
const enforce = String(process.env.GROUP_MEMBERS_ENFORCE || '').toLowerCase() === 'true';
|
|
|
|
|
let cntUpdated = 0, cntAlready = 0, cntNotFound = 0, cntBlocked = 0;
|
|
|
|
|
const lines: string[] = [];
|
|
|
|
|
|
|
|
|
|
@ -406,7 +404,7 @@ export class CommandService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const task = TaskService.getTaskById(resolvedId);
|
|
|
|
|
if (task && task.group_id && GroupSyncService.isSnapshotFresh(task.group_id) && enforce && !GroupSyncService.isUserActiveInGroup(context.sender, task.group_id)) {
|
|
|
|
|
if (!enforceMembership(context.sender, task)) {
|
|
|
|
|
lines.push(`🚫 ${codeId(resolvedId)} — no permitido (no eres miembro activo).`);
|
|
|
|
|
cntBlocked++;
|
|
|
|
|
continue;
|
|
|
|
|
@ -475,8 +473,7 @@ export class CommandService {
|
|
|
|
|
message: `⚠️ Tarea ${codeId(resolvedId)} no encontrada.`
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
const enforce = String(process.env.GROUP_MEMBERS_ENFORCE || '').toLowerCase() === 'true';
|
|
|
|
|
if (task.group_id && GroupSyncService.isSnapshotFresh(task.group_id) && enforce && !GroupSyncService.isUserActiveInGroup(context.sender, task.group_id)) {
|
|
|
|
|
if (!enforceMembership(context.sender, task)) {
|
|
|
|
|
return [{
|
|
|
|
|
recipient: context.sender,
|
|
|
|
|
message: 'No puedes tomar esta tarea porque no eres de este grupo.'
|
|
|
|
|
@ -517,7 +514,6 @@ export class CommandService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Modo múltiple
|
|
|
|
|
const enforce = String(process.env.GROUP_MEMBERS_ENFORCE || '').toLowerCase() === 'true';
|
|
|
|
|
let cntClaimed = 0, cntAlready = 0, cntCompleted = 0, cntNotFound = 0, cntBlocked = 0;
|
|
|
|
|
const lines: string[] = [];
|
|
|
|
|
|
|
|
|
|
@ -534,7 +530,7 @@ export class CommandService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const task = TaskService.getTaskById(resolvedId);
|
|
|
|
|
if (task && GroupSyncService.isSnapshotFresh(task.group_id) && enforce && !GroupSyncService.isUserActiveInGroup(context.sender, task.group_id)) {
|
|
|
|
|
if (!enforceMembership(context.sender, task)) {
|
|
|
|
|
lines.push(`🚫 ${codeId(resolvedId)} — no permitido (no eres miembro activo).`);
|
|
|
|
|
cntBlocked++;
|
|
|
|
|
continue;
|
|
|
|
|
@ -601,8 +597,7 @@ export class CommandService {
|
|
|
|
|
message: `⚠️ Tarea ${codeId(resolvedId)} no encontrada.`
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
const enforce = String(process.env.GROUP_MEMBERS_ENFORCE || '').toLowerCase() === 'true';
|
|
|
|
|
if (task.group_id && GroupSyncService.isSnapshotFresh(task.group_id) && enforce && !GroupSyncService.isUserActiveInGroup(context.sender, task.group_id)) {
|
|
|
|
|
if (!enforceMembership(context.sender, task)) {
|
|
|
|
|
return [{
|
|
|
|
|
recipient: context.sender,
|
|
|
|
|
message: '⚠️ No puedes soltar esta tarea porque no eres de este grupo.'
|
|
|
|
|
|