Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: grandfather apps installed before 7.0.0 while handling license downgrades #35374

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

ricardogarim
Copy link
Contributor

@ricardogarim ricardogarim commented Mar 1, 2025

Proposed changes (including videos or screenshots)

Previously, when a workspace downgraded from a trial or paid license to the community edition, all installed apps (both marketplace and private apps) remained enabled, regardless of the workspace’s new limitations. This led to workspaces retaining premium features beyond what was intended.

Marketplace Apps:

  • If the workspace has more than 5 marketplace apps, only the oldest 5 will remain enabled.
  • If the workspace has any premium marketplace apps, they will be disabled.

Private Apps:

  • Private apps that do not match the grandfathering condition will be disabled.
  • The grandfathering condition checks:
    • If the workspace was previously running a <7 version.
    • If the app was installed before upgrading to version 7.

Issue(s)

Steps to test or reproduce

Marketplace Apps

  • Create a workspace and activate a trial license.
  • Install multiple apps from the Marketplace, including both normal and premium apps.
  • Navigate to Settings > Subscription and cancel the trial or subscription.
  • Go to the Apps listing and verify:
    • Any marketplace app exceeding the 5-app limit is disabled (only the oldest 5 remain enabled).
    • All premium marketplace apps are disabled.

Private Apps

  • Create a workspace and activate a trial license.
  • Install a private app.
  • Navigate to Settings > Subscription and cancel the trial or subscription.
  • Go to the Apps listing and confirm the private app has been disabled.

Grandfathered Private Apps

  • Create a workspace and activate a trial license.
  • Install a private app and ensure it is successfully installed.
  • In the database:
    • Duplicate a document from the rocketchat_statistics collection.
    • Change the version field to a pre-7 version (e.g., 6.9.0).
    • Update the installedDate to a date before the upgrade to version 7.
  • In the installed apps database (rocketchat_apps collection):
    • Modify the createdDate field to a date that aligns with the pre-7 installation date.
  • Navigate to Settings > Subscription and cancel the trial or subscription.
  • Go to the Apps listing and verify that the private app remains enabled (grandfathered condition is met).

Further comments

It's a bit tricky to enforce the grandfathering condition reliably. After discussing with the team, we identified a potential approach: checking app statistics. If any recorded statistics indicate usage from a pre-7 version, we can infer that the workspace previously ran that version, allowing us to determine eligibility for grandfathering.

Copy link
Contributor

dionisio-bot bot commented Mar 1, 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

Copy link

changeset-bot bot commented Mar 1, 2025

🦋 Changeset detected

Latest commit: 13cfa08

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

This PR includes changesets to release 35 packages
Name Type
@rocket.chat/model-typings Patch
@rocket.chat/models Patch
@rocket.chat/meteor Patch
@rocket.chat/apps 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/stream-hub-service Patch
@rocket.chat/omnichannel-services Patch
rocketchat-services Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/instance-status Patch
@rocket.chat/presence Patch
@rocket.chat/network-broker Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/license Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration 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

Copy link

codecov bot commented Mar 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.42%. Comparing base (19f34c5) to head (13cfa08).
Report is 21 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #35374   +/-   ##
========================================
  Coverage    59.42%   59.42%           
========================================
  Files         2829     2829           
  Lines        68334    68334           
  Branches     15133    15133           
========================================
  Hits         40610    40610           
  Misses       25066    25066           
  Partials      2658     2658           
Flag Coverage Δ
unit 75.50% <ø> (ø)

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.

@ricardogarim ricardogarim force-pushed the refactor/legacy-app-support branch from 5f986ed to d84a316 Compare March 6, 2025 10:40
@ricardogarim ricardogarim marked this pull request as ready for review March 6, 2025 10:56
@ricardogarim ricardogarim requested a review from a team as a code owner March 6, 2025 10:56
@ricardogarim ricardogarim added this to the 7.5.0 milestone Mar 6, 2025
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.

1 participant