mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-24 22:27:46 -06:00
feat(chatwoot): comprehensive improvements to message handling, editing, deletion and i18n
- Fix bidirectional message deletion between Chatwoot and WhatsApp - Support deletion of multiple attachments sent together - Implement proper message editing with 'Edited Message:' prefix format - Enable deletion of edited messages by updating chatwootMessageId - Skip cache for deleted messages (messageStubType === 1) to prevent duplicates - Fix i18n translation path detection for production environment - Add automatic dev/prod path resolution for translation files - Improve error handling and logging for message operations Technical improvements: - Changed Chatwoot deletion query from findFirst to findMany for multiple attachments - Fixed instanceId override issue in message deletion payload - Added retry logic with Prisma MessageUpdate validation - Implemented cache bypass for revoked messages to ensure proper processing - Enhanced i18n to detect dist/ folder in production vs src/ in development Resolves issues with: - Message deletion not working from Chatwoot to WhatsApp - Multiple attachments causing incomplete deletion - Edited messages showing raw i18n keys instead of translated text - Cache collision preventing deletion of edited messages - Production environment not loading translation files correctly Note: Tested and validated with Chatwoot v4.1 in production environment
This commit is contained in:
@@ -3,10 +3,12 @@ import fs from 'fs';
|
||||
import i18next from 'i18next';
|
||||
import path from 'path';
|
||||
|
||||
const __dirname = path.resolve(process.cwd(), 'src', 'utils');
|
||||
// Detect if running from dist/ (production) or src/ (development)
|
||||
const isProduction = fs.existsSync(path.join(process.cwd(), 'dist'));
|
||||
const baseDir = isProduction ? 'dist' : 'src/utils';
|
||||
const translationsPath = path.join(process.cwd(), baseDir, 'translations');
|
||||
|
||||
const languages = ['en', 'pt-BR', 'es'];
|
||||
const translationsPath = path.join(__dirname, 'translations');
|
||||
const configService: ConfigService = new ConfigService();
|
||||
|
||||
const resources: any = {};
|
||||
|
||||
Reference in New Issue
Block a user