-
Notifications
You must be signed in to change notification settings - Fork 2
Add notes to tickets by event handling #775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the ticket note addition functionality to use event handling instead of direct database operations. The change moves from a synchronous database-first approach to an event-driven architecture using flow events and pre-commit hooks.
- Replaced direct database calls with event-based processing using
events.NewTicketNoteAdded
- Introduced new pre-commit hooks for updating ticket activity and inserting legacy events
- Removed the
TicketsAddNote
function and associated tests in favor of the new event-driven approach
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
web/ticket/add_note.go | Refactored to use event-driven approach with scenes and flow events |
core/runner/handlers/ticket_note_added.go | New event handler for processing ticket note added events |
core/runner/hooks/update_ticket_activity.go | New pre-commit hook for updating ticket last activity |
core/runner/hooks/insert_legacy_ticket_events.go | Updated to handle ticket-event pairs and notifications |
core/runner/handlers/ticket_topic_changed.go | Updated to use new TicketAndEvent structure |
core/models/ticket.go | Removed deprecated TicketsAddNote function |
core/models/ticket_test.go | Removed tests for deprecated TicketsAddNote function |
web/ticket/base_test.go | Updated test reset mode for new event handling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
web/ticket/add_note.go
Outdated
for _, scene := range scenes { | ||
for _, ticket := range scene.Tickets { | ||
if err := scene.AddEvent(ctx, rt, oa, events.NewTicketNoteAdded(ticket.UUID(), r.Note), r.UserID); err != nil { | ||
return nil, 0, fmt.Errorf("error adding ntoe added event to scene: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the error message: 'ntoe' should be 'note'.
return nil, 0, fmt.Errorf("error adding ntoe added event to scene: %w", err) | |
return nil, 0, fmt.Errorf("error adding note added event to scene: %w", err) |
Copilot uses AI. Check for mistakes.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #775 +/- ##
==========================================
- Coverage 50.88% 50.74% -0.14%
==========================================
Files 253 256 +3
Lines 15198 15220 +22
==========================================
- Hits 7733 7723 -10
- Misses 6662 6696 +34
+ Partials 803 801 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.