-
Notifications
You must be signed in to change notification settings - Fork 1.4k
test: remove image load of attachments #6908
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
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThe 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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:
- The specific crash or issue this addresses
- Whether this is a temporary workaround or permanent solution
- Plans to restore image functionality (if temporary)
- Any related issue numbers
🧹 Nitpick comments (1)
app/containers/message/Urls.tsx (1)
123-123: Remove unnecessary state declaration.Since
imageUrlis hardcoded tonulland 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.
📒 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.
|
iOS Build Available Rocket.Chat Experimental 4.69.0.108030 |
Proposed changes
Issue(s)
How to test or reproduce
Screenshots
Types of changes
Checklist
Further comments
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.