[client] add mms:downloaded webhook event support#42
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughReworked webhook event constants and registry in Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
smsgateway/domain_webhooks.go (1)
22-31: Keep the event list single-sourced.
allEventTypesandWebhookEventTypes()now require the same manual edits. Deriving the lookup map from one backing slice would avoid validation and enumeration drifting apart the next time a webhook event is added.♻️ Proposed refactor
+var webhookEventTypes = []WebhookEvent{ + WebhookEventSmsReceived, + WebhookEventSmsDataReceived, + WebhookEventSmsSent, + WebhookEventSmsDelivered, + WebhookEventSmsFailed, + WebhookEventSystemPing, + WebhookEventMmsReceived, + WebhookEventMmsDownloaded, +} + //nolint:gochecknoglobals // lookup table -var allEventTypes = map[WebhookEvent]struct{}{ - WebhookEventSmsReceived: {}, - WebhookEventSmsDataReceived: {}, - WebhookEventSmsSent: {}, - WebhookEventSmsDelivered: {}, - WebhookEventSmsFailed: {}, - WebhookEventSystemPing: {}, - WebhookEventMmsReceived: {}, - WebhookEventMmsDownloaded: {}, -} +var allEventTypes = func() map[WebhookEvent]struct{} { + m := make(map[WebhookEvent]struct{}, len(webhookEventTypes)) + for _, event := range webhookEventTypes { + m[event] = struct{}{} + } + return m +}() // WebhookEventTypes returns a slice of all supported webhook event types. func WebhookEventTypes() []WebhookEvent { - return []WebhookEvent{ - WebhookEventSmsReceived, - WebhookEventSmsDataReceived, - WebhookEventSmsSent, - WebhookEventSmsDelivered, - WebhookEventSmsFailed, - WebhookEventSystemPing, - WebhookEventMmsReceived, - WebhookEventMmsDownloaded, - } + return append([]WebhookEvent(nil), webhookEventTypes...) }Also applies to: 34-44
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@smsgateway/domain_webhooks.go` around lines 22 - 31, The event list is duplicated between the allEventTypes map and WebhookEventTypes(), causing drift; consolidate to a single source (e.g., define a slice variable like allEventTypeList or webhookEventList containing WebhookEvent values) and derive both the lookup map (allEventTypes) and the WebhookEventTypes() return from that single slice (build the map in init or lazily from the slice). Update references to use the new slice name and remove the duplicated literal lists (also apply the same change for the similar block referenced at lines 34-44).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@smsgateway/domain_webhooks.go`:
- Around line 22-31: The event list is duplicated between the allEventTypes map
and WebhookEventTypes(), causing drift; consolidate to a single source (e.g.,
define a slice variable like allEventTypeList or webhookEventList containing
WebhookEvent values) and derive both the lookup map (allEventTypes) and the
WebhookEventTypes() return from that single slice (build the map in init or
lazily from the slice). Update references to use the new slice name and remove
the duplicated literal lists (also apply the same change for the similar block
referenced at lines 34-44).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cf8000b6-bd61-40af-a423-010b3326805f
📒 Files selected for processing (1)
smsgateway/domain_webhooks.go
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@smsgateway/domain_webhooks.go`:
- Line 33: Update the nolint comment to reference the correct identifier:
replace "allWebhookEvents" with "webhookEventTypes" in the comment on the global
lookup table so the nolint annotation accurately reflects the actual source
variable (ensure the gochecknoglobals directive remains intact and only the
identifier text is corrected near the global lookup table declaration).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4901690a-ac8a-4736-96fb-f3c6dd243230
📒 Files selected for processing (1)
smsgateway/domain_webhooks.go
5a25f79 to
a95f5ae
Compare
|
Waiting for app release... |
Summary by CodeRabbit
New Features
Refactor
Enhancement