Skip to content

Conversation

@OtavioStasiak
Copy link
Contributor

@OtavioStasiak OtavioStasiak commented Jan 9, 2026

Proposed changes

Issue(s)

How to test or reproduce

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
    • Images embedded within message URLs are no longer fetched or displayed. URL rendering, click interactions, and long-press actions remain fully functional.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 9, 2026

Walkthrough

The PR removes axios-based image URL fetching from the Urls component by eliminating network logic, MessageContext dependencies, and the getImageUrl callback. Image URL state is hard-coded to null, disabling dynamic image embedding while preserving URL rendering and interaction handlers.

Changes

Cohort / File(s) Summary
Image URL Fetching Removal
app/containers/message/Urls.tsx
Removed axios import and commented out getImageUrl callback and useEffect logic that validated image URLs via HEAD requests. Eliminated MessageContext usage for baseUrl and user. Image URL state now hard-coded to null, disabling image embedding functionality.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • diegolmello

Poem

🐰 A rabbit hops through Urls so neat,
Removes the axios dance—no image feat!
No network calls, no fetching spree,
Just null and peace and simplicity!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'test: remove image load of attachments' is somewhat vague and misleading. The actual changes involve removing axios/network logic and disabling image URL fetching in the Urls component, but the title suggests this is merely a test change rather than a functional modification to production code. Consider revising the title to more accurately reflect the actual change, such as 'refactor: disable image URL fetching in message URLs' or clarify in the title whether this is a test-only modification.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.app-crashing-channel

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.

@OtavioStasiak OtavioStasiak deployed to experimental_ios_build January 9, 2026 21:54 — with GitHub Actions Active
@OtavioStasiak OtavioStasiak requested a deployment to experimental_android_build January 9, 2026 21:54 — with GitHub Actions Waiting
@OtavioStasiak OtavioStasiak requested a deployment to official_android_build January 9, 2026 21:54 — with GitHub Actions Waiting
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 (2)
app/containers/message/Urls.tsx (2)

125-150: Remove commented code or document temporary nature.

This large block of commented code should either be removed entirely or documented if it's a temporary measure. Dead code creates maintenance burden and confusion.

If this is a permanent fix:
Remove the commented code completely. Git history preserves the original implementation if needed.

♻️ Remove dead code
-	/* const getImageUrl = useCallback(() => {
-		const _imageUrl = url.image || url.url;
-
-		if (!_imageUrl) return null;
-		if (_imageUrl.startsWith('http')) return _imageUrl;
-		return `${baseUrl}/${_imageUrl}?rc_uid=${user.id}&rc_token=${user.token}`;
-	}, [url.image, url.url, baseUrl, user.id, user.token]);
-
-	useEffect(() => {
-		const verifyUrlIsImage = async () => {
-			try {
-				const _imageUrl = getImageUrl();
-				if (!_imageUrl || !API_Embed) return;
-
-				const response = await axios.head(_imageUrl);
-				const contentType = response.headers['content-type'];
-				if (contentType?.startsWith?.('image/')) {
-					setImageUrl(_imageUrl);
-				}
-			} catch {
-				// do nothing
-			}
-		};
-		verifyUrlIsImage();
-	}, [url.image, url.url, API_Embed, getImageUrl]);
- */

If this is a temporary workaround:
Add a TODO comment with an issue number explaining when/how this will be restored.


118-185: Add documentation for this significant functional change.

The code disables image embedding in URL previews (imageUrl hardcoded to null, getImageUrl logic commented out), which is a substantial behavioral change. This creates dead code in the UrlImage component that will never render.

Please provide:

  1. The specific crash or issue this addresses
  2. Whether this is a temporary workaround or permanent solution
  3. Plans to restore image functionality (if temporary)
  4. Any related issue numbers
🧹 Nitpick comments (1)
app/containers/message/Urls.tsx (1)

123-123: Remove unnecessary state declaration.

Since imageUrl is hardcoded to null and never updated, the state declaration serves no purpose. Consider replacing it with a constant.

♻️ Simplify to constant
-const [imageUrl] = useState<string | null>(null);
+const imageUrl = null;
📜 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 ede2569 and c2e4a73.

📒 Files selected for processing (1)
  • app/containers/message/Urls.tsx
🔇 Additional comments (1)
app/containers/message/Urls.tsx (1)

1-1: Imports correctly cleaned up.

Verification confirms that axios and MessageContext imports have been properly removed from the file, as expected for this refactoring.

@github-actions
Copy link

github-actions bot commented Jan 9, 2026

iOS Build Available

Rocket.Chat Experimental 4.69.0.108030

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.

2 participants