Skip to content

Conversation

@aleksandernsilva
Copy link
Contributor

@aleksandernsilva aleksandernsilva commented Dec 18, 2025

Proposed changes

This pull request adds support for displaying appropriate messages in the room footer when federation features are disabled or unavailable. It introduces new settings, props, and logic to determine the federation status and show relevant descriptions to the user in the RoomView component.

Federation feature support and UI updates:

  • Added two new federation-related settings, Federation_Service_Enabled and Federation_Matrix_enabled, to the defaultSettings constant.
  • Updated the Redux state mapping in RoomView to provide isFederationEnabled and isFederationModuleEnabled props, based on the new settings and available enterprise modules.
  • Extended the IRoomViewProps interface to include the new federation-related props.
  • Added logic in RoomView to determine and display a footer description if federation is disabled or the required module is missing, using new i18n strings.
  • Added two new i18n strings for federation-related room descriptions: one for when federation is disabled and one for when the module is missing.

Issue(s)

FB-74

How to test or reproduce

  • Federation is disabled
    • Both settings Federation_Matrix_enabled and Federation_Service_Enabled are disabled.
    • Message "Federation is currently disabled on this workspace" is displayed in the room footer.
  • Missing license module
    • Workspace is missing federation license module (federation)
    • Message "Join federated rooms is a Premium feature" is displayed in the room footer.

Screenshots

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

Summary by CodeRabbit

  • New Features

    • Federation UI: localized descriptions and read‑only footer messaging for federated rooms (covers disabled, old‑version, and missing‑module states)
    • New settings to enable/disable federation and Matrix support
    • Room view updated to display federation status and related messaging
  • Chores

    • Persisted federation metadata for subscriptions, database schema, and migrations to store federation info

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 18, 2025

Warning

Rate limit exceeded

@diegolmello has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 0a5e39a and 2130dc7.

📒 Files selected for processing (26)
  • app/definitions/IRoom.ts
  • app/i18n/locales/ar.json
  • app/i18n/locales/bn-IN.json
  • app/i18n/locales/cs.json
  • app/i18n/locales/de.json
  • app/i18n/locales/en.json
  • app/i18n/locales/es.json
  • app/i18n/locales/fi.json
  • app/i18n/locales/fr.json
  • app/i18n/locales/hi-IN.json
  • app/i18n/locales/hu.json
  • app/i18n/locales/it.json
  • app/i18n/locales/ja.json
  • app/i18n/locales/nl.json
  • app/i18n/locales/nn.json
  • app/i18n/locales/no.json
  • app/i18n/locales/pt-BR.json
  • app/i18n/locales/pt-PT.json
  • app/i18n/locales/ru.json
  • app/i18n/locales/sl-SI.json
  • app/i18n/locales/sv.json
  • app/i18n/locales/ta-IN.json
  • app/i18n/locales/te-IN.json
  • app/i18n/locales/tr.json
  • app/i18n/locales/zh-CN.json
  • app/i18n/locales/zh-TW.json

Walkthrough

Adds typed federation data to room/subscription models, DB schema/migration and model serialization, new default settings and localization keys, federation helpers/type guards, merge propagation, and RoomView UI changes to display federation footer descriptions.

Changes

Cohort / File(s) Summary
Localization
app/i18n/locales/en.json
Added three localization keys: Federation_Matrix_room_description_disabled, Federation_Matrix_room_description_invalid_version, Federation_Matrix_room_description_missing_module.
Settings
app/lib/constants/defaultSettings.ts
Added two boolean settings: Federation_Service_Enabled, Federation_Matrix_enabled (type valueAsBoolean).
Type definitions
app/definitions/IRoom.ts, app/definitions/ISubscription.ts, app/views/RoomView/definitions.ts
IServerRoom.federation narrowed to { version: number; mrid: string; origin: string }; added federation to ISubscription; IRoomViewProps gains isFederationEnabled and isFederationModuleEnabled.
Database schema & migrations
app/lib/database/schema/app.js, app/lib/database/model/migrations.js
Adds optional federation (string) column to subscriptions and updates migration step for version 28 to add federation plus status and inviter.
Database model
app/lib/database/model/Subscription.js
Added federation field with @json('federation', sanitizer) and included it in asPlain() serialization.
Merge helper
app/lib/methods/helpers/mergeSubscriptionsRooms.ts
Propagates room.federation into merged subscription (mergedSubscription.federation = room.federation).
Federation utilities
app/lib/methods/isRoomFederated.ts
Exported IRoomFederated; added IRoomNativeFederated interface; added isRoomNativeFederated() type guard.
RoomView UI
app/views/RoomView/index.tsx
Imported federation helpers; added getFederatedFooterDescription(room) method; render logic updated to show federation footer descriptions for federated rooms; mapStateToProps exposes isFederationEnabled and isFederationModuleEnabled.

Sequence Diagram(s)

(No sequence diagrams generated — changes are primarily additions of fields, types, settings, localization, and localized UI rendering without a complex multi-component sequential control flow that requires visualization.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • OtavioStasiak

Poem

🐰 I hopped through keys and typed new fields,
Flags planted neatly in tiny fields,
Rooms now murmur of federated lore,
Migrations and models add one more,
I nibble code and hum — a happy hop! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately reflects the main objective: adding federation room license and settings validations. It directly aligns with the UI support and validation logic changes made across multiple files.
Linked Issues check ✅ Passed The PR successfully addresses FB-74 by implementing license and settings validations for federation. It provides UI messages when federation is disabled or the license/module is missing, as required.
Out of Scope Changes check ✅ Passed All changes are within scope of the federation room validations objective. Database schema updates, type definitions, and UI logic changes are all necessary to support the federation feature flags and license checks.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@aleksandernsilva
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 18, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

🧹 Nitpick comments (3)
app/i18n/locales/en.json (1)

354-355: Minor grammar improvement suggested.

The localization keys are well-named and the first message is clear. However, the second message has a minor grammatical issue: "Join federated rooms" should be "Joining federated rooms" to maintain parallel structure with other feature descriptions.

🔎 Consider this grammar improvement:
-  "Federation_Matrix_room_description_missing_module": "Join federated rooms is a Premium feature",
+  "Federation_Matrix_room_description_missing_module": "Joining federated rooms is a Premium feature",
app/views/RoomView/index.tsx (2)

105-105: Import is correct, but underlying helper has typing concern.

The import of isRoomFederated is appropriate for the federation feature. However, the helper implementation uses (room as any).federated which suggests the type system doesn't properly account for the federated property on room objects. This is pre-existing technical debt but worth noting.

Consider updating the room types to properly include the federated property to eliminate the need for type assertions in isRoomFederated.


1671-1673: Federation state mapping logic is correct, but consider defensive checks.

The OR logic on line 1672 correctly implements the requirement: federation is enabled if either Federation_Matrix_enabled or Federation_Service_Enabled is true. This aligns with the PR description stating that both must be disabled to show the "disabled" message.

However, consider adding explicit boolean coercion or handling for cases where these settings might be undefined or null:

🔎 Consider more defensive boolean coercion:
 	encryptionEnabled: state.encryption.enabled,
-	isFederationEnabled: (state.settings.Federation_Matrix_enabled || state.settings.Federation_Service_Enabled) as boolean,
+	isFederationEnabled: Boolean(state.settings.Federation_Matrix_enabled || state.settings.Federation_Service_Enabled),
-	isFederationModuleEnabled: state.enterpriseModules.includes('federation') as boolean
+	isFederationModuleEnabled: Boolean(state.enterpriseModules?.includes('federation'))

This provides clearer intent and handles potential undefined/null values more safely.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 59e873a and 6f6c379.

📒 Files selected for processing (4)
  • app/i18n/locales/en.json (1 hunks)
  • app/lib/constants/defaultSettings.ts (1 hunks)
  • app/views/RoomView/definitions.ts (1 hunks)
  • app/views/RoomView/index.tsx (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/views/RoomView/index.tsx (2)
app/lib/methods/isRoomFederated.ts (1)
  • isRoomFederated (7-8)
app/lib/constants/colors.ts (1)
  • themes (304-304)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: ESLint and Test / run-eslint-and-test
🔇 Additional comments (4)
app/views/RoomView/definitions.ts (1)

35-36: LGTM! Clear federation-related props added.

The addition of isFederationEnabled and isFederationModuleEnabled boolean properties to IRoomViewProps is clean and follows TypeScript best practices. These props provide clear separation between the federation service being enabled and the federation module/license being available.

app/lib/constants/defaultSettings.ts (1)

303-308: LGTM! Federation settings added correctly.

The two new federation-related settings follow the established pattern for boolean settings in the codebase. The placement before deprecatedSettings is appropriate, and the naming convention is consistent with other settings in the file.

app/views/RoomView/index.tsx (2)

1339-1351: LGTM! Clear federation status logic.

The getFederatedFooterDescription method correctly prioritizes checking if federation is enabled before checking module availability. The logic flow is clean:

  1. First checks if federation service is disabled → returns disabled message
  2. Then checks if federation module/license is missing → returns premium feature message
  3. Otherwise returns undefined to allow normal operation

The method is pure, has clear return types, and uses proper I18n localization.


1523-1533: LGTM! Federation footer rendering is well-integrated.

The federation footer rendering follows the established pattern for other room states (blocked, read-only, on-hold). The checks are appropriate:

  • Type guard 'id' in room ensures room has necessary properties
  • isRoomFederated(room) determines if federation logic should apply
  • Conditional rendering based on description presence prevents unnecessary renders

The styling and placement are consistent with other footer states in the same method.

@aleksandernsilva aleksandernsilva marked this pull request as ready for review December 22, 2025 17:24
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

🧹 Nitpick comments (2)
app/lib/database/model/Subscription.js (1)

156-156: LGTM: Federation field added with proper decorator.

The @json('federation', sanitizer) decorator correctly handles JSON serialization of the federation object, following the same pattern used for other structured fields like roles, muted, and visitor.

Note: The sanitizer function (from app/lib/database/utils.ts) is a passthrough that doesn't validate the federation object structure. If stricter validation is needed in the future, consider creating a dedicated sanitizer that validates the { version, mrid, origin } shape.

app/lib/methods/helpers/mergeSubscriptionsRooms.ts (1)

17-17: Acceptable: Complexity directive added.

The ESLint complexity directive is added, likely due to the growing number of conditional checks in the merge function. While this is acceptable for now, consider refactoring the function into smaller, focused helpers if complexity continues to increase.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6f6c379 and dc15352.

📒 Files selected for processing (9)
  • app/definitions/IRoom.ts
  • app/definitions/ISubscription.ts
  • app/i18n/locales/en.json
  • app/lib/database/model/Subscription.js
  • app/lib/database/model/migrations.js
  • app/lib/database/schema/app.js
  • app/lib/methods/helpers/mergeSubscriptionsRooms.ts
  • app/lib/methods/isRoomFederated.ts
  • app/views/RoomView/index.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/views/RoomView/index.tsx
  • app/i18n/locales/en.json
🧰 Additional context used
🧬 Code graph analysis (2)
app/lib/database/model/Subscription.js (1)
app/lib/database/utils.ts (1)
  • sanitizer (19-19)
app/lib/methods/isRoomFederated.ts (1)
app/definitions/ISubscription.ts (1)
  • ISubscription (40-124)
🔇 Additional comments (10)
app/lib/database/schema/app.js (2)

4-4: LGTM: Schema version bumped correctly.

The schema version increment from 27 to 28 follows the sequential migration pattern and aligns with the new migration step added in app/lib/database/model/migrations.js.


73-74: LGTM: Federation columns added to subscriptions.

The addition of both federated (boolean) and federation (string) columns is consistent with the migration and type definitions. The string type for federation enables storing JSON-serialized federation metadata (version, mrid, origin).

app/lib/database/model/migrations.js (1)

335-343: LGTM: Migration for federation column is properly structured.

The version 28 migration correctly adds the federation column to the subscriptions table, matching the schema definition in app/lib/database/schema/app.js. The migration follows the established pattern and is properly positioned after the version 27 migration.

app/lib/database/model/Subscription.js (1)

224-225: LGTM: Federation included in serialization.

The federation field is correctly included in the asPlain() method, ensuring proper serialization of subscription objects.

app/lib/methods/helpers/mergeSubscriptionsRooms.ts (1)

107-109: LGTM: Federation data propagated correctly.

The federation field is properly propagated from the room object to the merged subscription, following the same pattern as other optional properties like usersCount. The 'federation' in room check ensures safe property access.

app/definitions/ISubscription.ts (1)

119-123: LGTM: Federation field properly typed.

The federation field is correctly defined as an optional structured object with version, mrid, and origin properties. This matches the federation type added to IServerRoom in app/definitions/IRoom.ts (lines 166-170), ensuring consistency across room and subscription interfaces.

app/definitions/IRoom.ts (1)

166-170: LGTM: Federation type narrowed for better type safety.

The federation field type has been improved from any to a properly structured object with version, mrid, and origin properties. This change:

  • Matches the ISubscription.federation type (lines 119-123 in app/definitions/ISubscription.ts)
  • Provides better type safety and IDE autocomplete
  • Enables compile-time validation of federation metadata
app/lib/methods/isRoomFederated.ts (3)

3-5: LGTM: IRoomFederated exported for external use.

The export keyword correctly exposes the IRoomFederated interface, enabling its use in RoomView and other components that need to work with federated rooms.


7-13: LGTM: IRoomNativeFederated interface properly defined.

The new IRoomNativeFederated interface extends IRoomFederated and adds the required federation object with version, mrid, and origin properties. This allows distinguishing between:

  • Rooms that are simply marked as federated (federated: true)
  • Rooms with full federation metadata (native federated rooms)

The federation object structure matches the types defined in ISubscription and IServerRoom.


18-19: LGTM: Type guard correctly narrows to IRoomNativeFederated.

The isRoomNativeFederated type guard properly checks:

  1. The room passes the isRoomFederated check
  2. The federation property exists
  3. The federation object is truthy

This ensures safe narrowing to the IRoomNativeFederated type.

@diegolmello diegolmello changed the title chore(federation): Added room license and settings validations feat(federation): Added room license and settings validations Dec 23, 2025
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

🧹 Nitpick comments (1)
app/views/RoomView/index.tsx (1)

1702-1703: Verify the federation enabled logic and handle undefined settings.

Two concerns with the state mapping:

  1. OR logic verification: Line 1702 enables federation if EITHER Federation_Matrix_enabled OR Federation_Service_Enabled is true. Please confirm this is the intended behavior. Should both settings need to be enabled instead?

  2. Type safety: Settings might be undefined if not configured. The current implementation with || and as boolean casts could hide undefined values. Consider explicit handling:

🔎 Suggested improvement for type safety
-	isFederationEnabled: (state.settings.Federation_Matrix_enabled || state.settings.Federation_Service_Enabled) as boolean,
-	isFederationModuleEnabled: state.enterpriseModules.includes('federation') as boolean
+	isFederationEnabled: !!(state.settings.Federation_Matrix_enabled || state.settings.Federation_Service_Enabled),
+	isFederationModuleEnabled: state.enterpriseModules?.includes('federation') ?? false

Please also confirm that isFederationEnabled and isFederationModuleEnabled have been added to the IRoomViewProps interface definition, as mentioned in the PR description but not visible in the provided diff.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between dc15352 and 0a5e39a.

📒 Files selected for processing (7)
  • app/definitions/ISubscription.ts
  • app/i18n/locales/en.json
  • app/lib/database/model/Subscription.js
  • app/lib/database/model/migrations.js
  • app/lib/database/schema/app.js
  • app/lib/methods/helpers/mergeSubscriptionsRooms.ts
  • app/views/RoomView/index.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
  • app/lib/database/schema/app.js
  • app/lib/database/model/Subscription.js
  • app/i18n/locales/en.json
  • app/lib/methods/helpers/mergeSubscriptionsRooms.ts
  • app/lib/database/model/migrations.js
🧰 Additional context used
🧬 Code graph analysis (1)
app/views/RoomView/index.tsx (1)
app/lib/methods/isRoomFederated.ts (3)
  • IRoomFederated (3-5)
  • isRoomNativeFederated (18-19)
  • isRoomFederated (15-16)
🔇 Additional comments (6)
app/definitions/ISubscription.ts (1)

119-123: LGTM! Clean addition of federation metadata.

The optional federation object is well-typed and appropriately structured for federation support. The optional nature correctly reflects that not all subscriptions are federated.

app/views/RoomView/index.tsx (5)

105-105: LGTM! Appropriate federation helper imports.

The imports provide necessary type guards and types for federation feature support.


1354-1370: LGTM! Well-structured federation description logic.

The method correctly handles the cascade of federation checks:

  1. Validates native federation support (presence of federation object)
  2. Checks if federation is enabled via settings
  3. Verifies enterprise module availability

Returns appropriate localized messages for each failure scenario.


1388-1388: LGTM! Proper federation detection for room.

The type guard and federation check correctly identify federated rooms for conditional rendering logic.


1456-1456: LGTM! Read receipts correctly disabled for federated rooms.

Disabling read receipts for federated rooms is appropriate as this feature may not be supported across federation boundaries.


1542-1554: LGTM! Federation footer rendering follows established patterns.

The implementation correctly:

  • Type-checks the room before calling federation helpers
  • Conditionally renders only when a description exists
  • Follows the same read-only footer pattern used elsewhere in the method

@diegolmello diegolmello requested a deployment to experimental_ios_build December 23, 2025 16:41 — with GitHub Actions Waiting
@diegolmello diegolmello requested a deployment to official_android_build December 23, 2025 16:41 — with GitHub Actions Waiting
@diegolmello diegolmello requested a deployment to experimental_android_build December 23, 2025 16:41 — with GitHub Actions Waiting
@diegolmello diegolmello merged commit d019d4b into develop Dec 23, 2025
4 of 9 checks passed
@diegolmello diegolmello deleted the chore/federation-room-checks branch December 23, 2025 16:41
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