Repository navigation
Fix: Offline message not displayed when opening video in Chat while offline - #89786
puneetlath merged 21 commits into
Conversation
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@Ollyws, friendly bump. thanks. |
|
Will get to this asap. |
| // Skip API root normalization for search attachments because this route is only opened from preview, | ||
| // which already passes a resolved source. Keep normalization for other types to support email entry points. | ||
| const source = getValidatedImageSource(sourceParam, type !== CONST.ATTACHMENT_TYPE.SEARCH); | ||
| const fileName = originalFileName ?? (typeof source === 'string' ? getFileName(source) : ''); |
There was a problem hiding this comment.
Could you explain this line?
There was a problem hiding this comment.
We need this because the modal offline-video check was not working reliably when originalFileName was missing. AttachmentModalBaseContent uses this value to create file.name, and AttachmentView uses file.name to detect video attachments. Without this fallback, the modal can fail to recognize the attachment as a video and skip the offline handling.
| const attrHref = htmlAttribs[CONST.ATTACHMENT_SOURCE_ATTRIBUTE] || htmlAttribs.src || htmlAttribs.href || ''; | ||
| const sourceURL = tryResolveUrlFromApiRoot(attrHref); | ||
| const fileName = getFileName(`${sourceURL}`); | ||
| const fileName = htmlAttribs[CONST.ATTACHMENT_ORIGINAL_FILENAME_ATTRIBUTE] || getFileName(`${sourceURL}`); |
There was a problem hiding this comment.
We need this because the route was sometimes passing a filename derived from an opaque attachment URL, so the modal could fail to detect the attachment as a video. The actual uploaded filename is available in the HTML data-name attribute, so passing that as originalFileName makes the modal’s video/offline logic reliable.
|
@Ollyws I need one clarification. This PR currently fixes the attachment modal behavior so the offline view is shown when opening a video while offline. However, in the chat view itself, the same video can still be played while offline from the preview. Should this PR also block offline video playback directly in chat, or is the expected scope only the attachment modal? Thanks REC-20260514103200.mp4 |
|
@Ollyws, gentle bump. thanks. |
|
@nabi-ebrahimi Yeah I think it would be best if the same behaviour applied to the preview, i.e it's disabled using the same conditions. |
|
@Ollyws I’ve updated this as well, so the offline indicator is now shown in the chat preview using the same conditions as the modal. Could you please take another look when you get a chance? Thanks! |
|
@Ollyws, gentle bump. thanks. |
| accessibilityLabel={fileName} | ||
| isDeleted={isDeleted} | ||
| /> | ||
| {shouldShowOfflineVideoIndicator && <AttachmentOfflineIndicator isPreview />} |
|
@nabi-ebrahimi Thanks for the update, generally looks good but I'm getting this issue when I move from small to large screen width, the overlay isn't applied in small screen: Screen.Recording.2026-06-04.at.18.18.45.mov |
|
All contributors have signed the CLA ✍️ ✅ |
@Ollyws Thanks for the feedback. This got resolved as well. Please check it again when you get a chance. Thanks |
|
@nabi-ebrahimi Thanks for the update, but this leads to an inconsistency where if you haven't started the video we only get the offline placeholder in small screen: Screen.Recording.2026-06-11.at.19.50.10.mov |
@Ollyws Thanks for checking. I updated this so while offline we render through |
|
@Ollyws Gentle bump. thanks |
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp01_Android_Native.mp4Android: mWeb Chrome02_Android_Chrome.mp4iOS: HybridApp03_iOS_Native.mp4iOS: mWeb Safari04_iOS_Safari.mp4MacOS: Chrome / Safari05_MacOS_Chrome.mp4 |
|
🚧 @puneetlath has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 9.4.10-0 🚀
Bundle Size Analysis (Sentry): |
Help site review — no changes requiredI reviewed the changes in this PR against the help site articles under Conclusion: No help site updates are needed. Why:
Since the help site does not document the offline behavior of in-chat video attachments, there is nothing to add or correct. No draft docs PR was created. @nabi-ebrahimi, if you believe a help article should document this offline behavior, let me know and I'll draft one. |
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 9.4.12-0 🚀
Bundle Size Analysis (Sentry): |
|
🤖 No help site changes required. I reviewed the changes in this PR against Expensify's help site files under This PR is a narrow frontend behavior fix: while offline, it prevents remote video attachments from auto-playing/loading, shows the player's offline indicator, and hides actions like download and the three-dot menu until connectivity is restored ( I searched
None of the help articles document this UI-level behavior. The chat articles (e.g. If you'd like a new help article added to document expected offline attachment behavior, let me know and I can draft one. @nabi-ebrahimi, since no draft help site PR was created, there is nothing to review here. If you disagree and believe a docs update is warranted, reply and I'll create a draft PR for you to review and mark |
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 9.4.14-0 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.4.14-1 🚀
|

Explanation of Change
These changes prevent remote video attachments from trying to load while the user is offline. Instead, the attachment modal shows an offline blocking view, hides attachment actions like download and the three-dot menu, and avoids rendering the video content until connectivity is restored.
This gives users clearer feedback when a video cannot be accessed offline, instead of showing a broken or stuck attachment preview.
Fixed Issues
$ #88216
PROPOSAL: #88216 (comment)
Tests
Offline tests
Same as Tests.
QA Steps
Same as Tests.
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2026-05-07.at.2.00.10.AM.mov
Android: mWeb Chrome
Screen.Recording.2026-05-06.at.11.52.35.PM.mov
iOS: Native
Screen.Recording.2026-05-07.at.12.08.51.PM.mov
iOS: mWeb Safari
Screen.Recording.2026-05-11.at.1.56.07.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-05-07.at.11.59.10.AM.mov