Conversation
e63613e to
866f51d
Compare
There was a problem hiding this comment.
Pull request overview
Adds an unsubscribe status lookup in the management subscriptions store and uses it in the campaigns send consumer to skip non-transactional sends for users who have unsubscribed from the campaign’s subscription.
Changes:
- Add
IsUserUnsubscribedtoSubscriptionsStore(withsql.ErrNoRowshandling). - Update campaign send consumer to skip sending when the user is unsubscribed (non-transactional campaigns only).
- Add store-level tests covering
IsUserUnsubscribedbehavior across no-record/unsubscribe/resubscribe cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/store/management/subscriptions.go | Adds IsUserUnsubscribed query helper for user+subscription unsubscribe state. |
| internal/store/management/subscriptions_test.go | Adds unit test coverage for IsUserUnsubscribed across key state transitions. |
| internal/pubsub/consumer/campaigns.go | Skips non-transactional campaign sends when the user is unsubscribed from the campaign’s subscription. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return false, err | ||
| } | ||
| return state != nil && *state == 1, nil | ||
| } |
There was a problem hiding this comment.
This introduces another hard-coded 1 for the unsubscribe state. Consider defining a named constant (e.g., subscriptionStateUnsubscribed = 1) and reusing it across the file (CASE expressions, insert, and this check) to make the meaning explicit and reduce the chance of inconsistent updates later.
|
@RickieeeDev could you please take a look at the failing lint and tests? |
No description provided.