fix: user-specific banners failing with Banner not found error when dismissing it - #41755
Conversation
|
Looks like this PR is ready to merge! 🎉 |
🦋 Changeset detectedLatest commit: 656c7fe The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (4)
|
| Layer / File(s) | Summary |
|---|---|
User banner read-state update packages/models/src/models/Users.ts |
setBannerReadById now updates a user only when the specified banner exists in the user record. |
Dismissal service and validation apps/meteor/server/services/banner/service.ts, apps/meteor/tests/end-to-end/api/banners.ts, .changeset/some-banks-spend.md |
The dismissal service updates user-record banners, publishes an updated user-change notification, and returns Banner not found only when no record matches. End-to-end tests cover dismissal, repeated dismissal, and unknown banner IDs. The changeset documents the behavior. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Suggested labels: type: bug
Sequence Diagram(s)
sequenceDiagram
participant BannerAPI
participant BannerService
participant Users
participant UserChangeNotifier
BannerAPI->>BannerService: dismiss banner
BannerService->>Users: setBannerReadById
Users-->>BannerService: update result
BannerService->>UserChangeNotifier: publish updated user change
BannerService-->>BannerAPI: success or Banner not found
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title clearly describes the main fix for user-specific banners incorrectly returning a Banner not found error during dismissal. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
- Create stacked PR
- Commit on current branch
Warning
Review ran into problems
🔥 Problems
Errors were encountered while retrieving linked issues.
Errors (1)
- SUP-1095: Request failed with status code 401
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 @coderabbitai help to get the list of available commands.
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 `@apps/meteor/tests/end-to-end/api/banners.ts`:
- Around line 88-90: Update the after teardown hook to unset the seeded
banners.alert-user-banner-test field from the admin user record before invoking
connection.close(). Reuse the existing connection and admin-user update
mechanism, then preserve the current connection shutdown 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 42f4e24d-1831-4f79-abe0-1ca87e4e5b5a
📒 Files selected for processing (4)
.changeset/some-banks-spend.mdapps/meteor/server/services/banner/service.tsapps/meteor/tests/end-to-end/api/banners.tspackages/models/src/models/Users.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: 📦 Build Packages
- GitHub Check: Hacktron Security Check
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
packages/models/src/models/Users.tsapps/meteor/tests/end-to-end/api/banners.tsapps/meteor/server/services/banner/service.ts
packages/**
📄 CodeRabbit inference engine (CLAUDE.md)
Shared libraries belong in
packages/, while other services belong inapps/andee/.
Files:
packages/models/src/models/Users.ts
apps/meteor/**
📄 CodeRabbit inference engine (CLAUDE.md)
The main Rocket.Chat Meteor application resides in
apps/meteor/; place its application code there rather than in other monorepo areas.
Files:
apps/meteor/tests/end-to-end/api/banners.tsapps/meteor/server/services/banner/service.ts
🧠 Learnings (6)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
packages/models/src/models/Users.tsapps/meteor/tests/end-to-end/api/banners.tsapps/meteor/server/services/banner/service.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
packages/models/src/models/Users.tsapps/meteor/tests/end-to-end/api/banners.tsapps/meteor/server/services/banner/service.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
packages/models/src/models/Users.tsapps/meteor/tests/end-to-end/api/banners.tsapps/meteor/server/services/banner/service.ts
📚 Learning: 2026-07-15T01:31:50.632Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 41382
File: packages/model-typings/src/models/IPushTokenModel.ts:10-10
Timestamp: 2026-07-15T01:31:50.632Z
Learning: In Rocket.Chat’s push-token model, APNs/GCM standard tokens and PushKit VoIP tokens use distinct, globally-unique token string values. As a result, when deduplicating/looking up tokens, key identity solely on `{ tokenValue, appName }` (e.g., for `findOneByTokenAndAppName`, `removeDuplicateTokens`) and do **not** include `tokenType` in the uniqueness criteria to avoid collisions between standard and VoIP tokens.
Applied to files:
packages/models/src/models/Users.ts
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.
Applied to files:
.changeset/some-banks-spend.md
📚 Learning: 2026-08-05T22:02:59.828Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 41707
File: apps/meteor/server/hooks/messages/processThreads.ts:66-68
Timestamp: 2026-08-05T22:02:59.828Z
Learning: In Rocket.Chat Meteor server code, `callbacks.runAsync` returns its input item rather than the asynchronous callback promise. Callers of `afterReadMessages` must invoke `callbacks.runAsync` without awaiting it, keeping read-receipt I/O off the message-send path; this includes `apps/meteor/server/hooks/messages/processThreads.ts`.
Applied to files:
apps/meteor/server/services/banner/service.ts
🪛 LanguageTool
.changeset/some-banks-spend.md
[grammar] ~6-~6: Ensure spelling is correct
Context: ...oes not exist in the banners collection nor in the user's record.
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🔇 Additional comments (4)
packages/models/src/models/Users.ts (1)
2915-2927: LGTM!apps/meteor/server/services/banner/service.ts (1)
8-9: LGTM!Also applies to: 92-106
apps/meteor/tests/end-to-end/api/banners.ts (1)
1-8: LGTM!Also applies to: 57-86, 92-139
.changeset/some-banks-spend.md (1)
1-6: LGTM!
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #41755 +/- ##
===========================================
+ Coverage 68.68% 68.71% +0.02%
===========================================
Files 4166 4168 +2
Lines 159382 159492 +110
Branches 28253 28302 +49
===========================================
+ Hits 109479 109595 +116
+ Misses 44747 44737 -10
- Partials 5156 5160 +4
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Proposed changes (including videos or screenshots)
When migrating some Meteor methods to REST endpoints in #40704 we overlooked that
banners.dismissdo not cover user-specific banners (banners within the user record in abannersarray).To fix this:
dismissmethod from theBannerServiceto try to mark user-specific banners as read as fallback if there is none matching therocketchat_bannercollection. I did this following thebanner/dismissMeteor method current logic (the one used before).setBannerReadByIdUser model method was modified to avoid the user from arbitrarily setting a banner in their record.Issue(s)
SUP-1095 "Update your Rocket.Chat" banner cannot be dismissed on 8.6.0 and later
Steps to test or reproduce
(the version number must be higher than the current one you’re using to test for the banner to show up)
Expected result: Banner should be dismissed without errors and if you refresh the page it shouldn’t come back.
Further comments
Summary by CodeRabbit