Skip to content

Conversation

@aleksandernsilva
Copy link
Contributor

@aleksandernsilva aleksandernsilva commented Dec 18, 2025

Proposed changes

This pull request introduces a small but important change to how read receipts are handled in the RoomView component. Specifically, it disables the read receipt feature for federated rooms by checking if the room is federated before enabling read receipts.

Issue(s)

FB-77

How to test or reproduce

  • Access workspace
  • Enable message read receipts (Workspace > Settings > Message > Read Receipts)
  • Access a federated room (can use public server fed-1 or fed-2)
  • Read receipts should not be displayed for federated rooms even though setting is enabled

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

  • Bug Fixes
    • Read receipts are now automatically disabled in federated rooms to ensure correct behavior and privacy across federated participants.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 18, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a runtime federated-room check in RoomView/index.tsx and uses it to disable message read receipts for federated rooms by gating the isReadReceiptEnabled flag during message rendering.

Changes

Cohort / File(s) Summary
Read receipt gating
app/views/RoomView/index.tsx
Imports isRoomFederated, computes federated for the current room and per-item, and updates isReadReceiptEnabled to Message_Read_Receipt_Enabled && !federated so read receipts are disabled in federated rooms.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

🐰 I hop through code with a curious twitch,
Federated rooms get a privacy switch,
Read receipts hide where rabbits roam free,
Quiet conversations beneath the tree. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: disabling message read receipts in federated rooms, which matches the code modifications in RoomView/index.tsx.
Linked Issues check ✅ Passed The PR implements the core requirement from FB-77 by disabling read receipt visual indicators in federated rooms through conditional logic.
Out of Scope Changes check ✅ Passed All changes are scoped to disabling read receipts in federated rooms; no unrelated modifications detected in the RoomView component.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

📜 Recent 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 d88aa38 and a0e18fb.

📒 Files selected for processing (1)
  • app/views/RoomView/index.tsx

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.

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)

1355-1355: Refactor: Compute federated status once per room, not per message.

The federated flag is currently recomputed for every message in renderItem. Since the room's federated status is a property of the room itself and doesn't change per message, this is inefficient—especially for rooms with many messages.

Consider computing this once at the component level (e.g., in state, as a class property, or at the start of the render method) and reusing the cached value.

🔎 Proposed refactor options

Option 1: Add to component state

In the constructor or observeRoom method, compute and store in state:

 this.state = {
   joined: true,
   room,
+  isFederated: false,
   roomUpdate: {},
   // ... rest of state
 };

Then update when room changes:

 observeRoom = (room: TSubscriptionModel) => {
   const observable = room.observe();
   this.subSubscription = observable.subscribe(changes => {
     const roomUpdate = roomAttrsUpdate.reduce((ret: any, attr) => {
       ret[attr] = changes[attr];
       return ret;
     }, {});
+    const isFederated = 'id' in changes && isRoomFederated(changes as ISubscription);
     if (this.mounted) {
-      this.internalSetState({ room: changes, roomUpdate, isOnHold: !!changes?.onHold });
+      this.internalSetState({ room: changes, roomUpdate, isOnHold: !!changes?.onHold, isFederated });
     } else {
       // @ts-ignore
       this.state.room = changes;
       // @ts-ignore
       this.state.roomUpdate = roomUpdate;
+      // @ts-ignore
+      this.state.isFederated = isFederated;
     }
   });
 };

Then use in renderItem:

 renderItem = (item: TAnyMessageModel, previousItem: TAnyMessageModel, highlightedMessage?: string) => {
-  const { room, lastOpen, canAutoTranslate } = this.state;
+  const { room, lastOpen, canAutoTranslate, isFederated } = this.state;
   // ...
-  const federated = 'id' in room && isRoomFederated(room);
   // ...
   content = (
     <Message
       // ...
-      isReadReceiptEnabled={Message_Read_Receipt_Enabled && !federated}
+      isReadReceiptEnabled={Message_Read_Receipt_Enabled && !isFederated}

Option 2: Compute once at the start of render method

 render() {
   console.count(`${this.constructor.name}.render calls`);
   const { room, action, selectedMessages, isAutocompleteVisible, showMissingE2EEKey, showE2EEDisabledRoom } = this.state;
   const { user, baseUrl, theme, width, serverVersion, navigation } = this.props;
   const { rid, t } = room;
+  const isFederated = 'id' in room && isRoomFederated(room as ISubscription);

Then pass it to the List component via a closure or store it as an instance variable that renderItem can access.

Also applies to: 1423-1423

📜 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 0c1f9ca and d88aa38.

📒 Files selected for processing (1)
  • app/views/RoomView/index.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
app/views/RoomView/index.tsx (1)
app/lib/methods/isRoomFederated.ts (1)
  • isRoomFederated (7-8)
🔇 Additional comments (1)
app/views/RoomView/index.tsx (1)

105-105: LGTM: Import is correct.

The import statement is appropriate and follows the existing import patterns in the file.

@diegolmello diegolmello merged commit 5e1dc7e into develop Dec 23, 2025
4 of 6 checks passed
@diegolmello diegolmello deleted the chore/federation-hide-read-receipt branch December 23, 2025 16:21
@diegolmello diegolmello requested a deployment to official_android_build December 23, 2025 16:22 — with GitHub Actions Waiting
@diegolmello diegolmello requested a deployment to experimental_android_build December 23, 2025 16:22 — with GitHub Actions Waiting
@diegolmello diegolmello requested a deployment to experimental_ios_build December 23, 2025 16:22 — with GitHub Actions Waiting
@diegolmello diegolmello changed the title chore: Disabled message read receipt in federated rooms feat: Disabled message read receipt in federated rooms Dec 23, 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.

3 participants