Skip to content

Feature/295 reuse saved answers#1017

Open
Furan05 wants to merge 4 commits intomainfrom
feature/295-reuse-saved-answers
Open

Feature/295 reuse saved answers#1017
Furan05 wants to merge 4 commits intomainfrom
feature/295-reuse-saved-answers

Conversation

@Furan05
Copy link

@Furan05 Furan05 commented Nov 25, 2025

295

This PR implements the feature to reuse saved answers as templates.

Changes

Phase 1 - Entity

  • Add MessageTemplate entity with fields: name, content, type (normal/confidential/solution)
  • PostgreSQL migration with timezone support
  • Use MonitorableEntityTrait and UidEntityTrait

Phase 2 - Permission

  • Add admin:manage:templates permission
  • Add translations (EN/FR)

Phase 3 - Admin Interface

  • Add MessageTemplatesController (index, new, edit)
  • Add form with rich text editor
  • Add Twig templates and alphabetical sorter
  • Add "Templates" tab in admin menu

Phase 4 - Selection in Tickets

  • Add template selector in ticket answer form
  • Add Stimulus controller to pre-fill type and content
  • Optimize loading (only if user can answer)
  • Smart check for "solution" type option

Technical Decisions

  • Removed timeSpent field: not relevant (time varies depending on context)
  • Minimal Stimulus wrapper: wraps only the selector, not the entire form
  • Performance optimization: templates loaded only when needed

Tests

  • 799 tests pass out of 808
  • ⚠️ 5 MessagesController tests fail (to investigate - possibly related to HTML structure)

#295

How to test manually

Reviewer checklist

  • Code is manually tested
  • Permissions / authorizations are verified
  • New data can be imported
  • Interface works on both mobiles and big screens
  • Interface works in both light and dark modes
  • Interface works on both Firefox and Chrome
  • Accessibility has been tested
  • Translations are synchronized
  • Tests are up to date
  • Copyright notices are up to date
  • Documentation is up to date
  • Pull request has been reviewed and approved

François Dubois added 4 commits November 21, 2025 16:42
- Add MessageTemplate entity with name, content, type, timeSpent fields
- Add MessageTemplateRepository
- Create migration for message_template table
- Related to #295
- Add admin:manage:templates to admin permissions
- Add translations (EN/FR)
- Related to #295
- Add MessageTemplateSorter
- Add MessageTemplateForm
- Add MessageTemplatesController (index, new, edit)
- Add Twig templates (index, new, edit, _form)
- Add Templates tab in admin menu
- Add translations (EN/FR)
- Fix entity to use MonitorableEntityTrait
- Fix repository to implement UidGeneratorInterface
- Related to #295
- Load message templates in TicketsController::show (only if user can answer)
- Add message_template_controller.js (Stimulus)
- Register controller in application.js
- Add template selector in ticket answer form
- Pre-fill type and content when selecting a template
- Check if type option exists before setting it
- Remove timeSpent field (not needed - KISS principle)
- Add translations (EN/FR)
- Related to #295
@Furan05 Furan05 self-assigned this Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant