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

Make bold/italic/strikethrough work with multi-line emails #15393

Merged
merged 4 commits into from
Feb 24, 2023

Conversation

marktoman
Copy link
Contributor

Details

Upgrade expensify-common, which adds support for bold/italic/strikethrough emails in multi-line mode. This is achieved by preventing the email from starting with the ~_* MD characters. Such emails are not supported by major platforms. The consensus on the issue is that they should not be supported.

Fixed Issues

$ #14695
$ #14695 (comment)

Tests

New changes

  1. Add the below as a new comment (paste as plain text):
~abc@gmail.com
def@gmail.com~
_abc@gmail.com
def@gmail.com_
*abc@gmail.com
def@gmail.com*
  1. Verify that it looks like the screenshots
  2. Edit the comment and verify that it is the same as 1.

Current behavior

  1. Add the below as a new comment (paste as plain text):
~abc@gmail.com~
*abc@gmail.com*
_abc@gmail.com_
a~b@gmail.com
a*b@gmail.com
a_b@gmail.com
  1. Verify that it looks like the screenshots
  2. Edit the comment and verify that it is the same as 1.
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

New changes

  1. Add the below as a new comment (paste as plain text):
~abc@gmail.com
def@gmail.com~
_abc@gmail.com
def@gmail.com_
*abc@gmail.com
def@gmail.com*
  1. Verify that it looks like the screenshots
  2. Edit the comment and verify that it is the same as 1.

Current behavior

  1. Add the below as a new comment (paste as plain text):
~abc@gmail.com~
*abc@gmail.com*
_abc@gmail.com_
a~b@gmail.com
a*b@gmail.com
a_b@gmail.com
  1. Verify that it looks like the screenshots
  2. Edit the comment and verify that it is the same as 1.
  • 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 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 correct English and 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 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

desktop-chrome

desktop-safari

Mobile Web - Chrome

android-chrome

Mobile Web - Safari

ios-safari

Desktop

desktop-native

iOS

ios-native

Android

android-native

@marktoman marktoman requested a review from a team as a code owner February 23, 2023 00:47
@melvin-bot melvin-bot bot requested review from NikkiWines and thesahindia and removed request for a team February 23, 2023 00:47
@MelvinBot
Copy link

@NikkiWines @thesahindia One of you needs to 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]

@marktoman
Copy link
Contributor Author

This PR is not yet mergeable because it references my fork, but I'm raising it already to meet the deadline.

@thesahindia You are in the opposite time zone to @NikkiWines. Can you please review both PRs at once? This way, @NikkiWines can do the same and merge both in one day.

I will update package.json immediately once the expensify-common PR merges.

@thesahindia
Copy link
Member

@marktoman, I don't think I can approve this PR right now. We need to wait.

@marktoman
Copy link
Contributor Author

Updated

package.json Outdated Show resolved Hide resolved
@thesahindia
Copy link
Member

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 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 correct English and 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 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 Screenshot 2023-02-23 at 3 22 11 PM
Mobile Web - Chrome Screenshot 2023-02-23 at 3 51 08 PM
Mobile Web - Safari Screenshot 2023-02-23 at 3 42 07 PM
Desktop Screenshot 2023-02-23 at 3 53 35 PM
iOS Screenshot 2023-02-23 at 3 37 18 PM
Android Screenshot 2023-02-23 at 3 50 13 PM

Copy link
Member

@thesahindia thesahindia left a comment

Choose a reason for hiding this comment

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

LGTM!

All yours @NikkiWines

Copy link
Contributor

@NikkiWines NikkiWines left a comment

Choose a reason for hiding this comment

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

:shipit:

@NikkiWines NikkiWines merged commit 2df7f86 into Expensify:main Feb 24, 2023
@github-actions
Copy link
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
App start TTI 722.748 ms → 745.643 ms (+22.896 ms, +3.2%)
App start runJsBundle 194.935 ms → 207.063 ms (+12.127 ms, +6.2%)
App start nativeLaunch 20.724 ms → 21.448 ms (+0.724 ms, +3.5%)
App start regularAppStart 0.014 ms → 0.015 ms (+0.001 ms, +7.9%)
Open Search Page TTI 612.020 ms → 609.377 ms (-2.643 ms, ±0.0%)
Show details
Name Duration
App start TTI Baseline
Mean: 722.748 ms
Stdev: 31.647 ms (4.4%)
Runs: 667.570074999705 676.5721140000969 681.8485449999571 686.8890890004113 693.3359460001811 693.4504030002281 695.0909740002826 698.2423329995945 699.4636610001326 704.4502370003611 706.6745319999754 708.0037709996104 710.5162829998881 713.4931530002505 718.1507719997317 720.359596000053 720.9910880001262 721.8447430003434 722.0915179997683 724.0616410002112 730.0880800001323 732.3118300000206 735.4810889996588 738.1340990001336 738.6103710001335 748.1884500002488 751.0597660001367 752.4540290003642 763.7447279999033 785.9980899998918 786.1876779999584 802.5628389995545

Current
Mean: 745.643 ms
Stdev: 22.148 ms (3.0%)
Runs: 700.8901850003749 704.327801999636 708.797751000151 716.9602210000157 719.0999440001324 723.9074550000951 724.016232999973 724.2935290001333 729.3027609996498 736.1608229996637 736.8461800003424 741.5422069998458 745.0297170002013 745.548522000201 745.6443830002099 746.0207359995693 747.0462830001488 752.2044310001656 753.28278900031 755.5715210000053 757.5556870000437 760.781902000308 760.9856190001592 765.1067289998755 766.3370219999924 767.3852190002799 770.0077510001138 776.2430790001526 777.0607719998807 778.275283000432 778.715447999537
App start runJsBundle Baseline
Mean: 194.935 ms
Stdev: 11.528 ms (5.9%)
Runs: 177 179 180 182 183 184 185 185 185 185 189 189 190 192 192 193 195 196 197 199 200 201 202 203 205 206 208 209 211 217 224

Current
Mean: 207.063 ms
Stdev: 12.303 ms (5.9%)
Runs: 187 188 189 190 192 197 197 198 200 201 201 202 202 202 204 204 205 208 210 211 211 211 212 213 213 216 219 226 227 227 230 233
App start nativeLaunch Baseline
Mean: 20.724 ms
Stdev: 0.979 ms (4.7%)
Runs: 19 19 19 20 20 20 20 20 20 20 20 21 21 21 21 21 21 21 21 21 21 21 21 21 21 22 22 23 23

Current
Mean: 21.448 ms
Stdev: 1.773 ms (8.3%)
Runs: 19 19 19 20 20 20 20 20 20 20 20 21 21 21 21 21 22 22 22 22 22 22 23 23 23 24 24 25 26
App start regularAppStart Baseline
Mean: 0.014 ms
Stdev: 0.001 ms (6.3%)
Runs: 0.01269499957561493 0.012695000506937504 0.012776999734342098 0.012777000665664673 0.012980000115931034 0.013021000660955906 0.013021000660955906 0.013143000192940235 0.013183999806642532 0.013224000111222267 0.013306000269949436 0.013427999801933765 0.013549000024795532 0.013712999410927296 0.013753999955952168 0.013875999487936497 0.013915999792516232 0.014078999869525433 0.014078999869525433 0.014159999787807465 0.014201000332832336 0.014282000251114368 0.01444500032812357 0.01460800040513277 0.014770000241696835 0.014852000400424004 0.014891999773681164 0.0148930000141263 0.015177999623119831 0.015422000549733639 0.016154000535607338

Current
Mean: 0.015 ms
Stdev: 0.001 ms (6.2%)
Runs: 0.012939000502228737 0.014119000174105167 0.014159999787807465 0.014200999401509762 0.014201000332832336 0.014281999319791794 0.014281999319791794 0.014282000251114368 0.014363999478518963 0.014526000246405602 0.014689000323414803 0.0147299999371171 0.014771000482141972 0.014810999855399132 0.014851999469101429 0.014852000400424004 0.014892000705003738 0.014933000318706036 0.015015000477433205 0.015217999927699566 0.015217999927699566 0.015461999922990799 0.015625 0.0157880000770092 0.01582799945026636 0.016153999604284763 0.016195000149309635 0.0168869998306036 0.017700000666081905
Open Search Page TTI Baseline
Mean: 612.020 ms
Stdev: 17.426 ms (2.8%)
Runs: 578.8200679998845 579.7408050000668 582.3481040000916 595.7256670007482 596.3594970004633 596.6032709991559 598.5683599999174 601.5286459997296 602.3043619999662 602.6105150002986 603.5735280001536 603.9961349992082 604.1056320006028 607.9705809997395 609.701132000424 610.8516039997339 610.943563000299 614.3677170006558 615.3399660000578 615.6087650004774 615.9066159995273 616.8146970001981 617.0598140005022 624.8605140000582 625.4036459997296 628.5264889998361 629.147135999985 629.4429120002314 630.4096280001104 632.488078000024 648.1870529996231 655.3332929993048

Current
Mean: 609.377 ms
Stdev: 14.230 ms (2.3%)
Runs: 584.1341960001737 586.3252769997343 589.4129229998216 593.9000659994781 594.012085000053 596.140788000077 596.1520999995992 598.0932620000094 600.0590419992805 600.7642830004916 602.7424720004201 603.0677080005407 603.266235999763 606.4386809999123 607.1863609999418 607.4490970000625 608.1016440000385 608.1704919999465 608.2042239997536 610.2014570003375 612.2509359996766 613.131795999594 615.0448810001835 616.2637529997155 617.2674969993532 617.9954030001536 622.4533689999953 623.6040449999273 625.6978759998456 625.9053960004821 629.3634850000963 642.545167000033 644.1097410004586

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/NikkiWines in version: 1.2.77-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/NikkiWines in version: 1.2.77-0 🚀

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

@marktoman
Copy link
Contributor Author

marktoman commented Mar 1, 2023

@kbecciv @johncschuster I am not able to reproduce on staging. Your video shows that it appears correctly for a moment, then the lines are added. This suggests the second version comes from the server. Could it be a bug on the server that has been fixed?

New.Expensify.-.Google.Chrome.2023-03-01.02-20-49.mp4

#15561

@OSBotify
Copy link
Contributor

OSBotify commented Mar 2, 2023

🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.2.77-4 🚀

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

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.

5 participants