Skip to content

Comments

fix: restore banner dismissal fallback for cloud announcements#38282

Merged
kodiakhq[bot] merged 4 commits intodevelopfrom
fix/banner-closing
Jan 23, 2026
Merged

fix: restore banner dismissal fallback for cloud announcements#38282
kodiakhq[bot] merged 4 commits intodevelopfrom
fix/banner-closing

Conversation

@ricardogarim
Copy link
Contributor

@ricardogarim ricardogarim commented Jan 21, 2026

Customers reported that the "Enterprise plan active" popup displays on every server restart. When inspecting the network tab, a POST request to /api/apps/ui.interaction/cloud-announcements-core returns error 500 with "Banner not found".

Upon investigation, we found that some banners from Cloud have different values for view.id and view.viewId. For example:

  • view.id: "enterprise_active_main"
  • view.viewId: "enterprise_active"
  • Banner _id: "enterprise_active"

The change was introduced in PR #31090 (a051362) when the cloud announcements system was refactored from using CloudAnnouncements model to the Banner service. During this refactor, the fallback logic for resolving the banner ID was removed.

This mismatch is expected and was handled by the original code, but the refactored code assumed they would always match.

Proposed changes (including videos or screenshots)

Find the banner by _id matching either view.id or view.viewId, then dismiss using the actual _id.

Issue(s)

Steps to test or reproduce

  1. Connect workspace to Rocket.Chat Cloud with an enterprise/starter plan
  2. Wait for the plan announcement popup to appear
  3. Dismiss the popup
  4. Restart the server
  5. Before the fix: popup reappears, network shows 500 error on dismiss
  6. After the fix: popup stays dismissed, no 500 error

Manual Test Scenarios

Scenario view.id view.viewId Before Fix After Fix
Normal case matches _id matches _id Works Works
id correct only matches _id wrong 500 error Works
viewId correct only wrong matches _id 500 error Works
Both wrong wrong wrong 500 error 500 error (expected)

Summary by CodeRabbit

  • Bug Fixes
    • Dismissed banner popups no longer reappear after a server restart.
    • Dismissal now persists reliably and consistently for both banner and modal announcement types.

✏️ Tip: You can customize this high-level summary in your review settings.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Jan 21, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is targeting the wrong base branch. It should target 8.2.0, but it targets 8.1.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Jan 21, 2026

🦋 Changeset detected

Latest commit: 7540b00

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 40 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

Walkthrough

Refactors banner dismissal to accept viewId or id, look up the banner via a new findByIds model method, determine interaction type from the banner document, and dismiss by the banner's _id so dismissed banners do not reappear after server restart.

Changes

Cohort / File(s) Summary
Changeset Entry
\.changeset/proud-laws-melt.md``
Adds a patch changeset noting fix: "Fixes dismissed banner popups reappearing after server restart."
Banner dismissal module
\apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts``
viewClosed now accepts viewId or id, validates inputs, queries banners via findByIds, selects the announcement, determines interaction from announcement.surface, dismisses using announcement._id, and returns announcement._id as viewId.
Model API (typings)
\packages/model-typings/src/models/IBannersModel.ts``
Adds findByIds(bannerIds: string[]): FindCursor<IBanner>; to the interface.
Model implementation
\packages/models/src/models/Banners.ts``
Implements findByIds(bannerIds: string[]): FindCursor<IBanner> querying { _id: { $in: bannerIds } }.

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client
  participant Server as CloudAnnouncementsModule
  participant Model as BannersModel
  participant DB as Database

  Client->>Server: viewClosed({ viewId?, id? })
  Server->>Model: findByIds([viewId, id].filter(Boolean))
  Model->>DB: find({_id: { $in: [...] }})
  DB-->>Model: matching banner docs
  Model-->>Server: banner cursor/array
  Server->>Server: select announcement by viewId or id
  Server->>Server: determine interaction from announcement.surface
  Server->>Model: dismiss(announcement._id, userId)
  Server-->>Client: { viewId: announcement._id, type: interaction }
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • ggazzo
  • scuciatto
  • dougfabris

Poem

🐰 I hopped through code and followed each id,
Found banners hiding where old links once tried.
I nudged them to sleep with a gentle dismiss,
Now server rest keeps them quiet—what bliss! ✨

🚥 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 and concisely summarizes the main change: restoring the banner dismissal fallback for cloud announcements, which directly addresses the core bug fix.
Linked Issues check ✅ Passed The code changes implement the core requirement from SUP-875 by restoring fallback logic to resolve banners by either view.id or view.viewId and dismiss using the matched banner._id.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the banner dismissal issue: adding findByIds API, updating the cloudAnnouncements module, and creating a changeset. No unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/banner-closing

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.78%. Comparing base (e22b852) to head (7540b00).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #38282      +/-   ##
===========================================
+ Coverage    70.77%   70.78%   +0.01%     
===========================================
  Files         3158     3158              
  Lines       109355   109359       +4     
  Branches     19648    19677      +29     
===========================================
+ Hits         77397    77414      +17     
+ Misses       29934    29914      -20     
- Partials      2024     2031       +7     
Flag Coverage Δ
e2e 60.34% <ø> (+0.02%) ⬆️
e2e-api 48.04% <0.00%> (+0.02%) ⬆️
unit 71.92% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 21, 2026

📦 Docker Image Size Report

➡️ Changes

Service Current Baseline Change Percent
sum of all images 0B 0B 0B
account-service 0B 0B 0B
authorization-service 0B 0B 0B
ddp-streamer-service 0B 0B 0B
omnichannel-transcript-service 0B 0B 0B
presence-service 0B 0B 0B
queue-worker-service 0B 0B 0B
rocketchat 0B 0B 0B

📊 Historical Trend

---
config:
  theme: "dark"
  xyChart:
    width: 900
    height: 400
---
xychart
  title "Image Size Evolution by Service (Last 30 Days + This PR)"
  x-axis ["11/18 22:53", "11/19 23:02", "11/21 16:49", "11/24 17:34", "11/27 22:32", "11/28 19:05", "12/01 23:01", "12/02 21:57", "12/03 21:00", "12/04 18:17", "12/05 21:56", "12/08 20:15", "12/09 22:17", "12/10 23:26", "12/11 21:56", "12/12 22:45", "12/13 01:34", "12/15 22:31", "12/16 22:18", "12/17 21:04", "12/18 23:12", "12/19 23:27", "12/20 21:03", "12/22 18:54", "12/23 16:16", "12/24 19:38", "12/25 17:51", "12/26 13:18", "12/29 19:01", "12/30 20:52", "01/22 22:22 (PR)"]
  y-axis "Size (GB)" 0 --> 0.5
  line "account-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "authorization-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "ddp-streamer-service" [0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.00]
  line "omnichannel-transcript-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "presence-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "queue-worker-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "rocketchat" [0.35, 0.35, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.00]
Loading

Statistics (last 30 days):

  • 📊 Average: 1.5GiB
  • ⬇️ Minimum: 1.4GiB
  • ⬆️ Maximum: 1.6GiB
  • 🎯 Current PR: 0B
ℹ️ About this report

This report compares Docker image sizes from this build against the develop baseline.

  • Tag: pr-38282
  • Baseline: develop
  • Timestamp: 2026-01-22 22:22:37 UTC
  • Historical data points: 30

Updated: Thu, 22 Jan 2026 22:22:38 GMT

@ricardogarim ricardogarim marked this pull request as ready for review January 21, 2026 11:23
@ricardogarim ricardogarim requested a review from a team as a code owner January 21, 2026 11:23
@ricardogarim ricardogarim added this to the 8.2.0 milestone Jan 21, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts`:
- Around line 65-69: The current lookup using bannerIds and Banners.findOne({
_id: { $in: bannerIds } }) is non-deterministic when both id and viewId exist;
change to an ordered lookup that prefers id then falls back to viewId: first
attempt a findOne for _id equal to id (using the same projection), and only if
that returns null/undefined attempt a second findOne for _id equal to viewId
(keeping projection). Update the code around bannerIds, Banners.findOne, id, and
viewId to implement this deterministic fallback.
🧹 Nitpick comments (1)
apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts (1)

64-64: Drop the inline comment to keep implementation comment-free.

The code is self-explanatory; consider removing the comment at Line 64 to align with the no-comments guideline.

Proposed change
-		// Find banner by _id matching either view.id or view.viewId for backwards compatibility

As per coding guidelines, avoid code comments in the implementation.

tassoevan
tassoevan previously approved these changes Jan 21, 2026
@ricardogarim ricardogarim added the stat: QA assured Means it has been tested and approved by a company insider label Jan 22, 2026
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Jan 22, 2026
@kodiakhq kodiakhq bot merged commit c107092 into develop Jan 23, 2026
77 of 79 checks passed
@kodiakhq kodiakhq bot deleted the fix/banner-closing branch January 23, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants