Skip to content

Conversation

@qispark
Copy link
Contributor

@qispark qispark commented Jun 23, 2023

Details

When pasting some HTML containing images into Composer, it will cause an error modal. This is because of the server's Content Security Policy, which prevents those images from being fetched separately. This PR prevents the images from being fetched, instead it will paste the plaintext that is copied.

Fixed Issues

$ #18583
$ #18583 (comment)

Tests

  1. Copy a web document which contains both text and images. (e.g. https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_image_test)
  2. Log in with any account.
  3. Go to any chat
  4. Paste the contents into the composer
  5. Verify that no image attachments are being created.
  6. Verify that the correct contents are within the composer box.
  7. Verify that no error modals are appearing upon paste.
  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

  1. Copy a web document which contains both text and image. (e.g. https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_image_test)
  2. Log in
  3. Go to any chat
  4. Paste the contents into the composer
  5. Verify that the correct contents are within the composer box.
  6. Verify that no error modals are appearing upon paste.
  • 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
    • 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-06-23.at.9.08.11.pm.mov
Mobile Web - Chrome
Screen.Recording.2023-06-23.at.10.48.26.pm.mov
Mobile Web - Safari
Screen.Recording.2023-06-23.at.9.10.32.pm.mov
Desktop
Screen.Recording.2023-06-23.at.11.17.31.pm.mov
iOS
Screen.Recording.2023-06-23.at.10.21.31.pm.mov
Android
Screen.Recording.2023-06-23.at.10.58.14.pm.mov

OSBotify and others added 30 commits June 15, 2023 00:33
…AE0-2CD3-40A8-8DCB-C8F744CA9F80

Update version to 1.3.28-2 on main

(cherry picked from commit 23ca9a7)
[No QA] Revert pod cache

(cherry picked from commit 4343d28)
…pick-staging-20784

🍒 Cherry pick PR Expensify#20784 to staging 🍒
…44C-2777-44BD-A7CD-203FAF8585FC

Update version to 1.3.28-3 on main

(cherry picked from commit 8742a58)
fix: 20412 new user is not navigating to concierge chat after tab on link
(cherry picked from commit 9ed4a16)
…k-staging-20740

🍒 Cherry pick PR Expensify#20740 to staging 🍒
…0EE-5E80-4D3B-A3B5-AC69AAD0DDD8

Update version to 1.3.28-5 on main

(cherry picked from commit c4ef02b)
…color-our-mention

Fix: Wrong text color for our mention
(cherry picked from commit 9fda6a5)
…k-staging-20845

🍒 Cherry pick PR Expensify#20845 to staging 🍒
…-main

Update version to 1.3.29-0 on staging
…381-2BB9-48BA-8AA7-DCFE3C371E22

Update version to 1.3.29-1 on main

(cherry picked from commit cd4c246)
Fix: Error message "Can't remove admin" isn't shown when selecting workspace admins
(cherry picked from commit 0b6a0ca)
…k-staging-21023

🍒 Cherry pick PR Expensify#21023 to staging 🍒
…81A-F884-4652-9E3A-E866333417C0

Update version to 1.3.29-2 on main

(cherry picked from commit 057a182)
…ltip

fix avatar tooltip issues across the app

(cherry picked from commit 84a2048)
…k-staging-21026

🍒 Cherry pick PR Expensify#21026 to staging 🍒
…04A-5205-4860-90DE-9205AC4D07DA

Update version to 1.3.29-3 on main

(cherry picked from commit 55e3cb9)
…lFallback

[CP Staging] Make sure that we first check the PersonalDetails we already have before creating fake optimistic personal details

(cherry picked from commit 8456d27)
…k-staging-20951

🍒 Cherry pick PR Expensify#20951 to staging 🍒
…15B-302A-410D-BB0B-132FC608343C

Update version to 1.3.29-4 on main

(cherry picked from commit b0e8364)
…ingIndicator

Fix "user is typing..." indicator - key by accountID

(cherry picked from commit b25a014)
…k-staging-21029

🍒 Cherry pick PR Expensify#21029 to staging 🍒
…922-2674-4550-B151-1327430FD5F9

Update version to 1.3.29-5 on main

(cherry picked from commit ad08447)
[Fix] New Room participants list is empty

(cherry picked from commit 3cd537c)
…k-staging-21072

🍒 Cherry pick PR Expensify#21072 to staging 🍒
…BEB-CDC0-4383-A11A-D303D4BAB5C7

Update version to 1.3.29-6 on main

(cherry picked from commit 6d92bc3)
@github-actions
Copy link
Contributor

github-actions bot commented Jun 23, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@qispark
Copy link
Contributor Author

qispark commented Jun 23, 2023

I have read the CLA Document and I hereby sign the CLA

@qispark
Copy link
Contributor Author

qispark commented Jun 23, 2023

recheck

@qispark qispark marked this pull request as ready for review June 23, 2023 04:32
@qispark qispark requested a review from a team as a code owner June 23, 2023 04:32
@melvin-bot melvin-bot bot removed the request for review from a team June 23, 2023 04:32
@melvin-bot
Copy link

melvin-bot bot commented Jun 23, 2023

@parasharrajat 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]

@melvin-bot melvin-bot bot requested a review from parasharrajat June 23, 2023 04:32
@parasharrajat
Copy link
Member

@qispark What's with these 37 commits? You must be doing something wrong. There should only be your commits.

image

@qispark
Copy link
Contributor Author

qispark commented Jun 23, 2023

@parasharrajat ok I'll cherry pick and update my branch. It's because I started working on it from an earlier commit. As you see from files changed it's only affecting one file.

@qispark qispark marked this pull request as draft June 23, 2023 23:43
@qispark
Copy link
Contributor Author

qispark commented Jun 23, 2023

@parasharrajat Please check new PR here: #21476

@qispark qispark closed this Jun 23, 2023
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.