MM-69657 Added guards to prevent cases of replies sent on GM/DMs - #1338
MM-69657 Added guards to prevent cases of replies sent on GM/DMs#1338avasconcelos114 wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe change adds connected-member checks for DM and GM webhook delivery, improves subscription discovery when channel indexes drift, and expands disconnect cleanup to preserve subscriptions while another member remains connected. ChangesSubscription delivery lifecycle
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant WebhookRequest
participant WebhookWorker
participant ChannelAPI
participant UserStore
participant SubscriptionStore
WebhookRequest->>ChannelAPI: resolve target channel
WebhookWorker->>ChannelAPI: check channel members
ChannelAPI->>UserStore: load member connections
UserStore-->>ChannelAPI: connection lookup result
WebhookWorker->>SubscriptionStore: remove orphaned subscription
WebhookWorker-->>WebhookRequest: post notification when allowed
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@server/subscribe_test.go`:
- Around line 1799-1809: Assert that the expected KVSetWithOptions calls occur
in all three positive test cases: server/subscribe_test.go lines 1799-1809 and
1993-2004, and server/webhook_worker_test.go lines 83-95. Add api.AssertCalled
or api.AssertExpectations after the relevant operations, preserving the existing
argument matchers and test behavior.
🪄 Autofix
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: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 638079a5-67c3-4f08-a090-4ab4c8a9e3a2
📒 Files selected for processing (7)
server/command_test.goserver/subscribe.goserver/subscribe_test.goserver/webhook_http.goserver/webhook_http_test.goserver/webhook_worker.goserver/webhook_worker_test.go
Summary
This PR adds guards that handle an edgecase where a plugin running v4.6.0 or lower can create a DM/GM subscription, and continue to receive replies on an issue even if they had previously disconnected their accounts
Ticket Link
Fixes https://mattermost.atlassian.net/browse/MM-69657
QA Notes
Setup
/jira subscribe listshould show a Group and Direct Messages section containing the subscription.Test 1: Disconnect removes the DM subscription
/jira instance list//jira connectshows connected)./jira disconnect.Test 2: Delivery guard and self-heal
/jira disconnectChange Impact: 🟠 Medium
Reasoning: The changes span subscription cleanup and webhook delivery across multiple server modules. They affect account disconnection and user-facing message delivery, but include broad test coverage.
Regression Risk: Medium. Delivery guards and subscription removal change behavior for DM and GM channels. Failure handling and legacy subscription paths still require validation.
** QA Recommendation:** Perform manual QA for disconnect behavior, legacy subscriptions, threaded replies, connected members, and connection lookup failures. Skipping manual QA carries moderate risk.
Generated by CodeRabbitAI