mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 03:27:52 +00:00
This PR implements the **"Lock to Single Conversation"** option for Telegram inboxes, bringing it to parity with WhatsApp, SMS, and other channels. - When **enabled**: resolved conversations can be reopened (single thread). - When **disabled**: new messages from a resolved conversation create a **new conversation**. - Added **agent name display** in outgoing Telegram messages (formatted as `Agent Name: message`). - Updated frontend to display agent name above messages in the dashboard (consistent with WhatsApp behavior). This fixes [#8046](https://github.com/chatwoot/chatwoot/issues/8046). ## Type of change Please delete options that are not relevant. - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality not to work as expected) - [ ] This change requires a documentation update ## How Has This Been Tested? - Unit tests added in `spec/services/telegram/incoming_message_service_spec.rb` - Scenarios covered: - Lock enabled → reopens resolved conversation - Lock disabled → creates new conversation if resolved - Lock disabled → appends to last open conversation - Manual tests: 1. Create a Telegram conversation 2. Mark it as resolved 3. Send a new message from same user 4. ✅ Expected: new conversation created (if lock disabled) ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules ## Additional Documentation For full technical details of this implementation, please refer to: [TELEGRAM_LOCK_TO_SINGLE_CONVERSATION_IMPLEMENTATION_EN.md](./TELEGRAM_LOCK_TO_SINGLE_CONVERSATION_IMPLEMENTATION_EN.md) --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>