Skip to content
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

display the not found page when attachment is deleted. #23143

Merged
merged 15 commits into from
Aug 17, 2023

Conversation

ahmedGaber93
Copy link
Contributor

@ahmedGaber93 ahmedGaber93 commented Jul 18, 2023

Details

Fixed Issues

$ #22261
PROPOSAL: #22261 (comment), #23143 (comment), #22261 (comment)

Tests

1- Open the app and login with user A and user B from different browsers.
2- Start chat between user A and user B.
3- From user A send an attachment in the chat.
4- From user B open the attachment in preview, and copy the URL.
5- From user A delete the attachment and Verify the user B attachment preview is dissmised.
6- Open the URL and Verify that the app displays 'Hmm its not here' page and doesn't crash.

  • Verify that no errors appear in the JS console

Offline tests

N/A.

QA Steps

Same as Tests step.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • If we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
Screen.Recording.2023-08-05.at.10.20.34.PM.mov
Screen.Recording.2023-07-19.at.12.03.13.AM.mov
Screen.Recording.2023-07-25.at.5.16.12.PM.mov
Mobile Web - Chrome
Screen.Recording.2023-08-05.at.9.53.00.PM.mov
Screen.Recording.2023-07-19.at.1.07.42.AM.mov
Screen.Recording.2023-07-25.at.5.15.01.PM.mov
Mobile Web - Safari
Screen.Recording.2023-08-05.at.9.47.52.PM.mov
Screen.Recording.2023-07-19.at.12.28.49.AM.mov
Screen.Recording.2023-07-25.at.5.10.46.PM.mov
Desktop
Screen.Recording.2023-08-05.at.2.10.35.AM.mov
Screen.Recording.2023-07-21.at.10.40.41.PM.mov
Screen.Recording.2023-07-25.at.5.05.53.PM.mov
iOS
Screen.Recording.2023-08-04.at.7.23.05.PM.mov
Screen.Recording.2023-07-21.at.10.20.33.PM.mov
Screen.Recording.2023-07-25.at.3.41.34.PM.mov
Android
Screen.Recording.2023-08-05.at.6.30.43.PM.mov
Screen.Recording.2023-07-21.at.10.35.54.PM.mov
Screen.Recording.2023-07-25.at.4.48.56.PM.mov

@ahmedGaber93 ahmedGaber93 requested a review from a team as a code owner July 18, 2023 23:34
@melvin-bot melvin-bot bot requested review from mananjadhav and removed request for a team July 18, 2023 23:34
@melvin-bot
Copy link

melvin-bot bot commented Jul 18, 2023

@mananjadhav Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@@ -310,7 +325,7 @@ function AttachmentModal(props) {
<HeaderWithBackButton
title={props.headerTitle || props.translate('common.attachment')}
shouldShowBorderBottom
shouldShowDownloadButton={props.allowDownload}
shouldShowDownloadButton={props.allowDownload && shouldShowDownloadButton}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if this can be just replaced with state, and props.allowDownload can be used in the useCallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using props.allowDownload in useCallback dependencies will trigger change definition for method setDownloadButtonVisibility not shouldShowDownloadButton value.

but we can use it in useEffect.

const [shouldShowDownloadButton, setShouldShowDownloadButton] = React.useState(props.allowDownload);

useEffect(() => {
  if (shouldShowDownloadButton === props.allowDownload) {
      return;
  }
  setShouldShowDownloadButton(props.allowDownload);
}, [props.allowDownload]);

what do you think? @mananjadhav

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can ignore this change.

@mananjadhav
Copy link
Collaborator

@ahmedGaber93 I've raised comment on the method name and about the prop usage.

@ahmedGaber93
Copy link
Contributor Author

@mananjadhav I've pushed a commit that change the method name, and I replied about "the prop usage" and waiting your decision.

@melvin-bot melvin-bot bot requested a review from marcochavezf July 20, 2023 13:35
@mananjadhav
Copy link
Collaborator

@ahmedGaber93 Two quick things:

  • Not all of your platforms show the Blocking View page. Can you please update those?

  • I was a bit stuck on my iOS testing because it crashes the app when I open this particular chat. I don't think it is related to our change, but blocks me from testing. cc - @marcochavezf.

ios-link-crash.mov

@mananjadhav
Copy link
Collaborator

@ahmedGaber93 Also for a valid attachment I can see the blocking view page on mobile web and apps.

ios-error-page.mov
image

@ahmedGaber93
Copy link
Contributor Author

ahmedGaber93 commented Jul 21, 2023

@mananjadhav

Also for a valid attachment I can see the blocking view page on mobile web and apps.

I test it in main branch and I found deeplink attachment also not work in main branch and the app crashed, so it seems not related to this fix.

i think we may need to open new issue for it "attachment deep link not work in native"

the issue is when we try getting the current page in AttachmentCarousel we get it by matching attachment source.

const page = _.findIndex(attachments, (a) => a.source === this.props.source);

the attachment source is different between native (with domain) and web (without domain), and when we use deeplink we pass web link which not work in native (see the explanation below)

the function tryResolveUrlFromApiRoot is the function that setting and return the source when message image clicked here

const source = tryResolveUrlFromApiRoot(isAttachment ? htmlAttribs[CONST.ATTACHMENT_SOURCE_ATTRIBUTE] : htmlAttribs.src);

this is the logs for prop.source

in web (work fine)
/chat-attachments/6623927148101768966/w_8f63b3dae38c31b1f511173d3badd7d8d3dfe5ba.png

in ios native when image message click (work fine)
https://www.expensify.com/chat-attachments/6623927148101768966/w_8f63b3dae38c31b1f511173d3badd7d8d3dfe5ba.png

in ios native deeplink (not work) <<<<<<<<<<<<
/chat-attachments/6623927148101768966/w_8f63b3dae38c31b1f511173d3badd7d8d3dfe5ba.png

after following the tryResolveUrlFromApiRoot code I found the different between native (with domain) and web (without domain) is here

const expensifyComWithProxy = getPlatform() === 'web' && useWebProxy ? '/' : expensifyURL;

expensifyComWithProxy in web return /
expensifyComWithProxy in native return https://www.expensify.com

the fix

my proposal is to apply tryResolveUrlFromApiRoot to prop.source here to confirm the a.source and this.props.source here are with domain

const page = _.findIndex(attachments, (a) => a.source === this.props.source);

a.source already have tryResolveUrlFromApiRoot here

source: tryResolveUrlFromApiRoot(expensifySource || attribs.src),

we need to add it to this.props.source

// const page = _.findIndex(attachments, (a) => a.source === this.props.source);
const source = tryResolveUrlFromApiRoot(this.props.source);
const page = _.findIndex(attachments, (a) => a.source === source);

result

Screen.Recording.2023-07-21.at.5.37.59.PM.mov

@mananjadhav
Copy link
Collaborator

@marcochavezf Should we create a new issue here? or double the bounty here and resolve it here?

@mananjadhav
Copy link
Collaborator

mananjadhav commented Jul 21, 2023

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web-deleted-attachment.mov
web-deep-link-attachment.mov
Mobile Web - Chrome
mweb-chrome-deleted-attachment.mov
mweb-chrome-deep-link-attachment.mov
Mobile Web - Safari
mweb-safari-deleted-attachment.mov
mweb-safari-deep-link-attachment.mov
Desktop
desktop-deleted-attachment.mov
desktop-deep-link-attachment.mov
iOS
ios-deleted-attachment.mov
ios-deep-link-attachment.mov
Android
android-deleted-attachment.mov
android-deep-link-attachment.mov

@mananjadhav
Copy link
Collaborator

I've completed the checklist just in case we plan to create a separate issue, but considering it's broken and we have the likely fix, I think we should just resolve in this issue.

@mananjadhav
Copy link
Collaborator

@marcochavezf Quick bump on the previous comments.

@marcochavezf
Copy link
Contributor

@mananjadhav @ahmedGaber93 let's resolve the deep link problem in this issue please

@ahmedGaber93
Copy link
Contributor Author

@mananjadhav are you accept this fix #23143 (comment)?

@mananjadhav
Copy link
Collaborator

@ahmedGaber93 Yes about adding the tryResolveUrlFromApiRoot call right?

@ahmedGaber93
Copy link
Contributor Author

yes, right.

@ahmedGaber93
Copy link
Contributor Author

@mananjadhav I've pushed the commit and update Tests step and videos.

@mananjadhav
Copy link
Collaborator

Thanks give me a day I'll go through this and do the QA.

@mananjadhav
Copy link
Collaborator

@marcochavezf I've updated the checklist with the new screenshots in the same #23143 (comment)

🎀 👀 🎀 C+ reviewed

@marcochavezf
Copy link
Contributor

Hi @mananjadhav, let me know when the tests are done for a final review 👍🏽

@mananjadhav
Copy link
Collaborator

I had some struggle with my Android builds, but it got working yesterday. I'll be done for sure today. @marcochavezf I see you've requested changes, is there anything pending on the changes front? I don't see any comments pending.

@marcochavezf
Copy link
Contributor

I see you've requested changes, is there anything pending on the changes front? I don't see any comments pending.

Nope, nothing pending, all the changes I requested were already addressed

@mananjadhav
Copy link
Collaborator

mananjadhav commented Aug 16, 2023

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web-deleted-attachment.mov
Mobile Web - Chrome
mweb-chrome-deleted-attachment.mov
Mobile Web - Safari
mweb-safari-deleted-attachment.mov
Desktop
desktop-deleted-attachment.mov
iOS
ios-deleted-attachment.mov
Android
android-deleted-attachment.mov

@mananjadhav
Copy link
Collaborator

@marcochavezf I've updated the checklist with the new screencasts. @ahmedGaber93 Can you confirm if we keep continuously opening the deep links back to back does it result into any error?

@ahmedGaber93
Copy link
Contributor Author

Can you confirm if we keep continuously opening the deep links back to back does it result into any error?

@mananjadhav sorry, I did not understand clearly what you are asking.
Can you write specific steps to follow?

@mananjadhav
Copy link
Collaborator

mananjadhav commented Aug 16, 2023

@ahmedGaber93 Here's the test case.

  1. Open any chat
  2. Basically have two URLs one deleted and one valid attachment.
  3. Copy the URLs.
  4. Paste the deeplink and open the deleted URL.
  5. It shows the attachment not found modal.
  6. While the modal is open, open the valid attachment URL.
  7. It shows the attachment in the modal.
  8. Repeat step 4 to 7 while the modal is always open (say 4-5 times).

Ensure it opens the valid state in the modal every time.

@ahmedGaber93
Copy link
Contributor Author

ahmedGaber93 commented Aug 16, 2023

@mananjadhav
I tested it well in native and it works fine.
this case is only on native android and iOS because we can't keep the modal open in web, link always open in new tab

This just a short video as GitHub file's size limitation

Screen.Recording.2023-08-16.at.11.11.58.PM.mov

@ahmedGaber93
Copy link
Contributor Author

pump @mananjadhav @marcochavezf

@mananjadhav
Copy link
Collaborator

Okay apologies, I should've corrected myself. I am done from my end. I've also tested the back to back screens, but one of my chat results into Maximum JS depth. It does on the main as well, wanted to check if you face the same.

@marcochavezf All yours.

🎀 👀 🎀 C+ Reviewed.

Copy link
Contributor

@marcochavezf marcochavezf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks guys, LGTM

@marcochavezf marcochavezf merged commit f45ddbe into Expensify:main Aug 17, 2023
12 checks passed
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@ayazhussain79
Copy link
Contributor

@marcochavezf "Hmm... it's not here" displayed when attempting to open an image using its URL

https://expensify.slack.com/archives/C049HHMV9SM/p1692302960249539

screen-recording-2023-08-18-at-10333-am_kVGRsPUb.mp4

@mananjadhav
Copy link
Collaborator

mananjadhav commented Aug 17, 2023

@ayazhussain79 Could you help us with the reproduction steps? Because I can't reproduce this. I had explicitly tested this case, attaching the video here again. @ahmedGaber93 Are you able to reproduce the above bug?

web-attachment-link-click.mov

@ahmedGaber93
Copy link
Contributor Author

ahmedGaber93 commented Aug 17, 2023

@mananjadhav
yes it reproduced with me after pull last version, but this issue not related to our fix.
when we work on our fix the link is open in new tab and it still work fine (you can copy the link and open it in new tab), but the issue now is the link is opened in the same tab is not complete (link without params), i now searching about the PR that make the link open in the same tab and why the link is not open completely and remove the params

// not complete link open in the same tab when click the attachment link
http://localhost:8082/r/592589459564169/attachment

// the complete link should be
http://localhost:8082/r/592589459564169/attachment?source=/chat-attachments/2323255261707990908/w_27c02e267d4a31ceb507e27614174b78309fd003.png

Screenshot 2023-08-17 at 11 02 50 PM

@ayazhussain79
Copy link
Contributor

@mananjadhav Idk why i can still reproduce it:
Action Performed:

  1. Open a chat.
  2. Attach an image file and send it.
  3. Open the sent image in the preview.
  4. Copy the URL of the opened image and share it in the chat.
  5. Click on the shared URL to open the image.

@ahmedGaber93
Copy link
Contributor Author

ahmedGaber93 commented Aug 17, 2023

@mananjadhav
this PR #24483 in this file AnchorRenderer since 17 Hours ago is the responsible about open attachment link in the same tab with not complete URL (URL path without params)

if (internalNewExpensifyPath && hasSameOrigin) {
Navigation.navigate(internalNewExpensifyPath);
return;
}

@mananjadhav
Copy link
Collaborator

Thanks for finding the PR @ahmedGaber93. Can you comment it on the PR?

@ahmedGaber93
Copy link
Contributor Author

@mananjadhav yes, I will do.

@ayazhussain79
Copy link
Contributor

ayazhussain79 commented Aug 18, 2023

@mananjadhav @ahmedGaber93 when clicking on deleted image url "notFound.goBackHome" is not showing in correct way it should be "Go back to Home page"

is this issue caused by this PR? its was not displaying before

Screenshot 2023-08-19 at 1 31 13 AM

@ahmedGaber93
Copy link
Contributor Author

@ayazhussain79 it is not related to this PR, but it related to #25164

@ayazhussain79
Copy link
Contributor

@ahmedGaber93 Ok thank you

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/marcochavezf in version: 1.3.56-0 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.56-24 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

@@ -342,9 +354,10 @@ function AttachmentModal(props) {
<AttachmentCarousel
report={props.report}
onNavigate={onNavigate}
source={props.source}
source={tryResolveUrlFromApiRoot(props.source)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahmedGaber93 Can you please help explain why do we need to use tryResolveUrlFromApiRoot here? Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tienifr
We decide here #23143 (comment) to used it, and here #23143 (comment) to move it in this place.

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.

6 participants