Skip to content

Conversation

@MartinSchoeler
Copy link
Member

@MartinSchoeler MartinSchoeler commented Sep 8, 2025

Proposed changes (including videos or screenshots)

Removes the deprecated hideRoomsWithNoActivity param from admin/engagement-dashboard/channels/list endpoint

Issue(s)

ARCH-1757

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Refactor
    • Removed deprecated hideRoomsWithNoActivity parameter from the Engagement Dashboard Channels List API. The endpoint now hides channels with no activity by default. Response shape remains unchanged.
  • Chores
    • Upgraded core dependency to a new major version to keep the platform up to date.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Sep 8, 2025

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

  • This PR is missing the 'stat: QA assured' label

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 Sep 8, 2025

🦋 Changeset detected

Latest commit: 2f3ec5d

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

This PR includes changesets to release 38 packages
Name Type
@rocket.chat/meteor Major
@rocket.chat/core-typings Major
@rocket.chat/rest-typings Major
@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/freeswitch Patch
@rocket.chat/fuselage-ui-kit Major
@rocket.chat/gazzodown Major
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Major
@rocket.chat/ui-client Major
@rocket.chat/ui-contexts Major
@rocket.chat/web-ui-registration Major
@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/license 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 Major
@rocket.chat/ui-voip Major
@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

@MartinSchoeler MartinSchoeler added this to the 8.0.0 milestone Sep 8, 2025
@codecov
Copy link

codecov bot commented Sep 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.52%. Comparing base (712e2f3) to head (2f3ec5d).
⚠️ Report is 8 commits behind head on release-8.0.0.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                @@
##           release-8.0.0   #36886      +/-   ##
=================================================
- Coverage          66.37%   65.52%   -0.85%     
=================================================
  Files               3312     3216      -96     
  Lines             111671   110191    -1480     
  Branches           20940    20592     -348     
=================================================
- Hits               74121    72203    -1918     
- Misses             34872    35407     +535     
+ Partials            2678     2581      -97     
Flag Coverage Δ
e2e 54.88% <ø> (-3.35%) ⬇️
unit 70.92% <ø> (+0.05%) ⬆️

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 15, 2025

Walkthrough

Major-version bump of @rocket.chat/meteor; removal of the hideRoomsWithNoActivity parameter from the engagement-dashboard channels list API, client usage, and tests. Server-side logic now exclusively uses Analytics aggregation in findChannelsWithNumberOfMessages, dropping Rooms-based logic and the auxiliary function.

Changes

Cohort / File(s) Summary
Changeset
\.changeset/warm-boats-care.md
Records major bump for @rocket.chat/meteor and notes removal of hideRoomsWithNoActivity from admin/engagement-dashboard/channels/list.
Client hook: channels list
apps/meteor/client/views/admin/engagementDashboard/channels/useChannelsList.ts
Removes hideRoomsWithNoActivity: true from the GET request; retains start, end, offset, count; response augmentation unchanged.
EE API: channels endpoint
apps/meteor/ee/server/api/engagementDashboard/channels.ts
Drops support and validation for hideRoomsWithNoActivity; updates REST typings; uses pagination helpers; calls findChannelsWithNumberOfMessages without the flag.
EE Lib: analytics aggregation
apps/meteor/ee/server/lib/engagementDashboard/channels.ts
Refactors to a single Analytics-based path; removes Rooms import and helper; updates findChannelsWithNumberOfMessages signature (no hideRoomsWithNoActivity); handles empty aggregation; returns { channels, total }.
E2E tests: engagement dashboard
apps/meteor/tests/end-to-end/api/34-engagement-dashboard.ts
Removes the hideRoomsWithNoActivity query param and updates test descriptions; assertions preserved based on default behavior.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as Admin UI (Client)
  participant API as REST API (/v1/engagement-dashboard/channels/list)
  participant SVC as Channels Service
  participant AN as Analytics

  rect rgba(227,242,253,0.5)
  note over UI,API: New flow (no hideRoomsWithNoActivity)
  UI->>API: GET list?start&end&offset&count
  API->>SVC: findChannelsWithNumberOfMessages({ start, end, options })
  SVC->>AN: findRoomsByTypesWithNumberOfMessagesBetweenDate(start, end, options)
  AN-->>SVC: Aggregation result ({ channels, total } or empty)
  SVC-->>API: { channels, total }
  API-->>UI: 200 OK { channels, total, offset, count }
  end
Loading
sequenceDiagram
  autonumber
  participant UI as Admin UI (Client)
  participant API as REST API (old)
  participant SVC as Channels Service (old)
  participant RM as Rooms (old)
  participant AN as Analytics (old)

  rect rgba(253,236,200,0.4)
  note over UI,API: Old flow (deprecated flag)
  UI->>API: GET list?...&hideRoomsWithNoActivity=true|false
  API->>SVC: findChannelsWithNumberOfMessages({ start, end, hideRoomsWithNoActivity, options })
  alt hideRoomsWithNoActivity
    SVC->>AN: Analytics aggregation
  else
    SVC->>RM: Rooms-based query path
  end
  SVC-->>API: { channels, total }
  API-->>UI: 200 OK
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • KevLehman
  • aleksandernsilva
  • sampaiodiego

Poem

Thump-thump, I hop through fields of bytes,
Dropped a dusty flag in moonlit nights.
Channels chirp with counted chatter,
Analytics nibble what truly matters.
Version bumps under starry sky—
Carrots tall, the tests comply.
Hop on! The dashboards fly.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and succinctly captures the primary change: removal of the deprecated hideRoomsWithNoActivity parameter from the admin/engagement-dashboard/channels/list API endpoint; it names the specific parameter and endpoint and aligns with the PR summary and file diffs. The phrasing is specific and not overly broad or noisy, so a reviewer scanning history will understand the main intent. The "chore!" prefix is a conventional commit-style marker and does not obscure meaning.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remove/engagement-dashboard-channels-list-param

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

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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
apps/meteor/tests/end-to-end/api/34-engagement-dashboard.ts (1)

151-170: Contradiction with next test: empty rooms excluded here but included later.

This test asserts empty rooms are NOT returned, while the very next test expects the same empty room to be present with zero counts. Pick one behavior (default seems “hide empties”) and drop/adjust the other test to avoid flakiness.

Apply one of:

  • Keep this test, remove the next “empty room counts 0” test.
  • Or invert this assertion if product decision is to include empties by default.
apps/meteor/ee/server/api/engagementDashboard/channels.ts (1)

54-68: Validate that start <= end (prevent negative “last week” windows).

Currently only ISO format is validated. If start > end, diffBetweenDaysInclusive may produce a negative span, breaking last-week bounds silently.

Apply:

-			const { start, end } = this.queryParams;
-			const { offset, count } = await getPaginationItems(this.queryParams);
-
-			const { channels, total } = await findChannelsWithNumberOfMessages({
-				start: mapDateForAPI(start),
-				end: mapDateForAPI(end),
+			const { start, end } = this.queryParams;
+			const { offset, count } = await getPaginationItems(this.queryParams);
+
+			const startDate = mapDateForAPI(start);
+			const endDate = mapDateForAPI(end);
+			if (startDate.getTime() > endDate.getTime()) {
+				return API.v1.failure('start must be less than or equal to end');
+			}
+
+			const { channels, total } = await findChannelsWithNumberOfMessages({
+				start: startDate,
+				end: endDate,
 				options: { offset, count },
 			});
apps/meteor/ee/server/lib/engagementDashboard/channels.ts (1)

35-38: Off-by-one: last-week window is 1 day too long — fix startOfLastWeek

diffBetweenDaysInclusive(end, start) = moment(end).diff(start, 'days') + 1 (daysBetweenDates). With endOfLastWeek = moment(start).subtract(1, 'days') and startOfLastWeek = moment(endOfLastWeek).subtract(daysBetweenDates, 'days'), the derived last-week span becomes daysBetweenDates + 1. Make both windows equal-length by computing startOfLastWeek as either:

  • moment(start).subtract(daysBetweenDates, 'days').toDate()
    or
  • moment(endOfLastWeek).subtract(daysBetweenDates - 1, 'days').toDate()

Location: apps/meteor/ee/server/lib/engagementDashboard/channels.ts (around lines 35–38).

🧹 Nitpick comments (5)
.changeset/warm-boats-care.md (1)

5-5: Add explicit BREAKING section and migration note.

Call out the removed query param in a “BREAKING CHANGE” block with brief migration guidance (clients must stop sending hideRoomsWithNoActivity; server ignores unknown keys but typings will fail). Consider linking to admin REST docs and release notes.

Apply:

 Removes the deprecated  `hideRoomsWithNoActivity`  param from `admin/engagement-dashboard/channels/list`
+
+BREAKING CHANGE:
+- The endpoint `admin/engagement-dashboard/channels/list` no longer accepts the `hideRoomsWithNoActivity` query parameter.
+- Clients must remove this parameter; default behavior hides rooms with no activity.
apps/meteor/tests/end-to-end/api/34-engagement-dashboard.ts (4)

172-205: Remove or gate the “empty room returns with zero counts” test.

Given the parameter was removed and default behavior is to hide rooms with no activity, this test likely no longer applies.

Apply:

-		it('should correctly count messages in an empty room', async () => {
-      ...
-		});

207-241: Update test title: stale reference to a removed param.

Drop “when the param is provided” from the description; the endpoint no longer accepts that flag.

Apply:

-		it('should correctly count messages diff compared to last week when the param is provided and there are messages in a room', async () => {
+		it('should correctly count messages diff compared to last week when there are messages in a room', async () => {

276-309: Duplicate test block; remove one to reduce noise and runtime.

This test is duplicated at Lines 310–342 with identical assertions.

Apply:

-		it('should correctly count messages from last week and diff when moving to the next week', async () => {
-      ...
-		});

119-119: Fix typo in test name.

“succesfuly” → “successfully”.

-		it('should succesfuly return results', async () => {
+		it('should successfully return results', async () => {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 712e2f3 and 2f3ec5d.

📒 Files selected for processing (5)
  • .changeset/warm-boats-care.md (1 hunks)
  • apps/meteor/client/views/admin/engagementDashboard/channels/useChannelsList.ts (0 hunks)
  • apps/meteor/ee/server/api/engagementDashboard/channels.ts (2 hunks)
  • apps/meteor/ee/server/lib/engagementDashboard/channels.ts (1 hunks)
  • apps/meteor/tests/end-to-end/api/34-engagement-dashboard.ts (3 hunks)
💤 Files with no reviewable changes (1)
  • apps/meteor/client/views/admin/engagementDashboard/channels/useChannelsList.ts
🔇 Additional comments (2)
apps/meteor/ee/server/lib/engagementDashboard/channels.ts (1)

40-48: Happy path LGTM; single Analytics codepath simplifies behavior.

Switching to Analytics aggregation and returning empty arrays when no results is clean and predictable.

apps/meteor/ee/server/api/engagementDashboard/channels.ts (1)

13-31: Typings update looks correct — confirm no callers still pass hideRoomsWithNoActivity

Automated search failed: ripgrep returned "No files were searched"; verification couldn't be completed.

Run locally and confirm no matches:

#!/bin/bash
rg -nC2 --hidden --no-ignore -S 'hideRoomsWithNoActivity' || true
rg -nC2 --hidden --no-ignore -S 'engagement-dashboard/channels/list' || true

Changed: apps/meteor/ee/server/api/engagementDashboard/channels.ts (lines 13-31)

@juliajforesti
Copy link
Contributor

Done here #36951

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants