Trata eventos de edição/deleção, caption, undefined e implementa deduplicação e LID refactor #2150
+1,828
−595
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📋 Description
Este PR resolve múltiplos bugs e melhora a lógica de tratamento de mensagens, especialmente eventos de edição e deleção (EDIT/DELETE):
Tratamento de Mensagem Apagada: Corrige o erro onde mensagens apagadas (REVOKE) exibiam undefined na integração Chatwoot. Agora, exibe Mensagem apagada pelo remetente.
Tratamento de Edição de Caption: Implementa lógica para processar corretamente a edição de captions (legendas de imagens/arquivos), que antes só tratava edição de mensagens de texto.
Deduplicação Reforçada: Implementa mecanismos de anti-duplicação mais robustos para eventos de edição e deleção.
Refactoring LID (onWhatsappCache.ts): Ajusta a lógica de persistência do campo lid (Local ID) para garantir consistência durante o upsert.
🔗 Related Issue
Closes #(issue_number)
🧪 Type of Change
[x] 🐛 Bug fix (non-breaking change which fixes an issue)
[ ] ✨ New feature (non-breaking change which adds functionality)
[ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] 📚 Documentation update
[x] 🔧 Refactoring (no functional changes)
[ ] ⚡ Performance improvement
[ ] 🧹 Code cleanup
[ ] 🔒 Security fix
🧪 Testing
[x] Manual testing completed
[x] Functionality verified in development environment
[x] No breaking changes introduced
[ ] Tested with different connection types (if applicable)
📸 Screenshots (if applicable)
N/A (As alterações são primariamente de lógica de backend e tratamento de eventos).
✅ Checklist
[x] My code follows the project's style guidelines
[x] I have performed a self-review of my code
[x] I have commented my code, particularly in hard-to-understand areas
[ ] I have made corresponding changes to the documentation
[x] My changes generate no new warnings
[x] I have manually tested my changes thoroughly
[x] I have verified the changes work with different scenarios
[ ] Any dependent changes have been merged and published
📝 Additional Notes
O código foi re-enviado a partir de uma base limpa para resolver problemas de histórico de fork. O diff contém o bug fix de deleção/edição e o refactoring do LID.