Repository navigation
fix(react): resolve nested video attachment source, author info, and … - #1448
Open
swarnendusahu10-dotcom wants to merge 2 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes copy-paste reference bugs in
VideoAttachment(packages/react/src/views/AttachmentHandler/VideoAttachment.js) that caused nested video attachments (inside quotes, replies, or forwarded messages) to play the parent video, display the wrong author avatar/username, and evaluate the wrong attachment type for border styling.Problem
When mapping over nested attachments (
attachment.attachments.map((nestedAttachment, index) => ...)):<source src={host + attachment.video_url} ... />referenced the outer parent'sattachment.video_urlrather thannestedAttachment.video_url. As a result, quoted or forwarded video attachments played the parent message's video instead of their own.authorIconandauthorNamefrom the parent closure scope instead ofnestedAttachment.author_iconandnestedAttachment.author_name.${type === 'file'}(parent type) instead of${nestedAttachment.type === 'file'}.authorwas omitted oriconwas missing ingetUserAvatarUrl, it led to potential unhandled runtime exceptions or malformed URL strings (${instanceHost}undefined).Solution
host + nestedAttachment.video_url.nestedAttachment.author_iconandnestedAttachment.author_name.nestedAttachment.type === 'file'.author = {}and safe navigation ingetUserAvatarUrlto guard against missing icons or uninitialized context.propTypes(type,author,variantStyles,msg).Testing
eslint src/views/AttachmentHandler/VideoAttachment.js: 0 errors, 0 warnings.yarn build: Rollup build completed successfully with 0 errors.