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

Hide room from LHN if user does not have the permission #15401

Merged
merged 3 commits into from
Feb 27, 2023

Conversation

bernhardoj
Copy link
Contributor

Details

When a user gets invited to a report that they can't see, we need to hide it from the LHN.

Fixed Issues

$ #14518
PROPOSAL: #14518 (comment)

Tests

Same as QA Steps

  • Verify that no errors appear in the JS console

Offline tests

Same as QA Steps

QA Steps

Requires 2 account. Account A have a room beta permission, while B does not.

  1. Login with account A and create a workspace if you haven't one yet.
  2. Invite account B to the workspace
  3. Create a new room and linked it to the workspace
  4. Logout and login with account B
  5. Change the Priority mode to #focus
  6. Verify the new room is not shown on the LHN
  • 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

Before

330906

Web

web

Mobile Web - Chrome

330911

Mobile Web - Safari

ios mweb

Desktop

desktop

iOS

ios

Android

330908

@bernhardoj bernhardoj requested a review from a team as a code owner February 23, 2023 08:10
@melvin-bot melvin-bot bot requested review from Gonals and rushatgabhane and removed request for a team February 23, 2023 08:10
@MelvinBot
Copy link

@Gonals @rushatgabhane 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]

@@ -471,11 +478,19 @@ describe('Sidebar', () => {
};
LHNTestUtils.getDefaultRenderedSidebarLinks();

// Given the user is in all betas
const betas = [
Copy link
Member

@rushatgabhane rushatgabhane Feb 23, 2023

Choose a reason for hiding this comment

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

@bernhardoj
nitpick: remove the comment and name the variable something like "all chat only betas"?

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 have removed the comment as it is misleading. I think we can keep the name to just "betas" so we can put any beta later if needed without changing the name again 😅.

}

// Exclude user created policy rooms if the user isn't on the policy rooms beta
if (isUserCreatedPolicyRoom(report) && !Permissions.canUsePolicyRooms(betas)) {
Copy link
Member

Choose a reason for hiding this comment

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

@Gonals @bernhardoj is a comment for this necessary? I think the code is pretty clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree!

Copy link
Member

@rushatgabhane rushatgabhane left a comment

Choose a reason for hiding this comment

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

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 image
Mobile Web - Chrome image
Mobile Web - Safari image
Desktop image
iOS image
Android

WhatsApp Image 2023-02-25 at 04 12 13

@rushatgabhane
Copy link
Member

rushatgabhane commented Feb 24, 2023

NOTE: Because this is hard to reproduce - here's me reproducing this bug on main

WhatsApp.Video.2023-02-25.at.04.07.00.mp4

Copy link
Member

@rushatgabhane rushatgabhane left a comment

Choose a reason for hiding this comment

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

@Gonals LGTM! 🎉

@Gonals Gonals merged commit 0f8cdd2 into Expensify:main Feb 27, 2023
@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.

@github-actions
Copy link
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

Name Duration
Open Search Page TTI 611.570 ms → 674.339 ms (+62.769 ms, +10.3%) 🔴
Show details
Name Duration
Open Search Page TTI Baseline
Mean: 611.570 ms
Stdev: 11.964 ms (2.0%)
Runs: 584.5765790001024 592.0897219998296 594.1199950000737 594.8063149999361 595.7659509999212 597.7464199999813 603.8334969999269 604.540527000092 605.736654000124 606.2963870000094 607.1153160000686 607.8187259999104 607.8922940001357 611.4857179999817 612.32865400007 613.031576000154 613.1609700000845 613.7926839999855 615.1101479998324 615.9606119999662 616.9914549998939 618.0176999999676 618.1540939998813 618.3443199999165 618.5471200000029 622.6533200000413 625.2313240000512 625.9976399999578 631.8619389999658 632.5167640000582 633.1313070000615

Current
Mean: 674.339 ms
Stdev: 25.147 ms (3.7%)
Runs: 619.9013269999996 623.1425779997371 630.5220949999057 633.5823980001733 633.5901289996691 654.8994960002601 656.5802819998935 656.9272870002314 657.8864339999855 659.9372970000841 670.9479979998432 672.8495689998381 675.1055510002188 676.0814219997264 678.435099999886 679.5090330000967 680.5083419997245 680.6455080001615 681.2390140001662 682.6691090003587 683.5946859996766 684.8436690000817 685.6754560000263 688.95080600027 689.3656420004554 689.9126380002126 691.4393719998188 694.3341479999945 697.2668870002963 698.4121909998357 703.7246509999968 706.009074000176 734.6824949998409

Meaningless Changes To Duration

Show entries
Name Duration
App start TTI 719.944 ms → 733.101 ms (+13.157 ms, +1.8%)
App start runJsBundle 197.500 ms → 201.094 ms (+3.594 ms, +1.8%)
App start nativeLaunch 20.032 ms → 20.375 ms (+0.343 ms, +1.7%)
App start regularAppStart 0.014 ms → 0.017 ms (+0.003 ms, +20.4%) 🟡
Show details
Name Duration
App start TTI Baseline
Mean: 719.944 ms
Stdev: 27.081 ms (3.8%)
Runs: 669.5035119999666 669.5275749999564 682.3237679998856 682.7488339999691 693.6251240000129 694.7243250000756 694.7664650001097 698.6911979999859 705.1304270001128 707.5718859999906 711.087804999901 711.3716120000463 714.6732840000186 715.9212289999705 717.2474980000407 717.7957550000865 718.1859909999184 721.4293859999161 721.7029520000797 722.6382329999469 724.3042059999425 725.0773920000065 731.1850880000275 732.0650400000159 732.472545000026 748.8542110000271 750.9936059999745 752.5017009999137 758.6182800000533 763.4955060000066 772.609896000009 775.3596510000061

Current
Mean: 733.101 ms
Stdev: 25.954 ms (3.5%)
Runs: 688.2545289997943 693.9228129999246 704.3402200001292 704.8329199999571 706.4013880002312 708.2859970000573 710.2437249999493 713.673090999946 713.9169479999691 715.0100449998863 715.9845679998398 717.2908970001154 723.8183650001884 724.3061339999549 726.1079529998824 728.7917670002207 731.2980399997905 731.5745509997942 731.653460000176 732.8890820001252 735.1578509998508 738.4580419999547 749.3682030001655 751.5303299999796 754.4011599998921 758.5448410001118 760.322021999862 767.8375160000287 775.3137039998546 778.3508179998025 778.7919600000605 788.5528140000533
App start runJsBundle Baseline
Mean: 197.500 ms
Stdev: 16.494 ms (8.4%)
Runs: 166 174 176 176 182 182 182 182 183 184 187 191 191 192 194 198 198 201 201 201 204 205 206 207 212 213 213 216 221 222 225 235

Current
Mean: 201.094 ms
Stdev: 16.821 ms (8.4%)
Runs: 167 179 180 183 184 185 185 186 188 190 190 191 194 197 199 200 200 201 201 204 209 209 211 211 213 216 220 222 224 227 228 241
App start nativeLaunch Baseline
Mean: 20.032 ms
Stdev: 1.675 ms (8.4%)
Runs: 18 18 18 18 18 19 19 19 19 19 19 19 19 19 19 19 20 20 20 20 20 21 21 22 22 22 22 22 23 23 24

Current
Mean: 20.375 ms
Stdev: 2.666 ms (13.1%)
Runs: 18 18 18 18 18 18 18 18 19 19 19 19 19 19 19 19 19 19 19 19 20 21 21 22 23 23 23 24 25 25 25 28
App start regularAppStart Baseline
Mean: 0.014 ms
Stdev: 0.001 ms (5.6%)
Runs: 0.012653999961912632 0.013264999957755208 0.0133050000295043 0.013306000037118793 0.013428000034764409 0.013508999953046441 0.013509000185877085 0.013550000032410026 0.013550000032410026 0.013590999878942966 0.013630999950692058 0.013671999797224998 0.013672000030055642 0.013753999955952168 0.013794000027701259 0.013835000107064843 0.01387499994598329 0.013998000184074044 0.014118999941274524 0.014160000020638108 0.01432300009764731 0.014445000095292926 0.014485999941825867 0.014567000092938542 0.014649000018835068 0.014730000169947743 0.014770000008866191 0.014850999927148223 0.015014000004157424 0.0157880000770092 0.015868999995291233 0.01603199983946979

Current
Mean: 0.017 ms
Stdev: 0.001 ms (7.3%)
Runs: 0.01460800040513277 0.015178000088781118 0.015299999853596091 0.015583999920636415 0.015829000156372786 0.015868999995291233 0.01599099999293685 0.01615400006994605 0.01615400006994605 0.01631700014695525 0.01643899967893958 0.016561000142246485 0.016600999981164932 0.016601999755948782 0.01660200022161007 0.01696799974888563 0.016967999981716275 0.017211999744176865 0.017211999744176865 0.017293999902904034 0.01737500005401671 0.017416000133380294 0.017496999818831682 0.017537000123411417 0.017537999898195267 0.018188999965786934 0.018554000183939934 0.019003000110387802 0.019246999640017748 0.01936900010332465 0.0197350000962615

@github-actions github-actions bot added the DeployBlockerCash This issue or pull request should block deployment label Feb 27, 2023
@github-actions
Copy link
Contributor

@Expensify/mobile-deployers 📣 Please look into this performance regression as it's a deploy blocker.

@rushatgabhane
Copy link
Member

interesting. some early returns degraded performance by 10%

is this the typical standard deviation? or im missing something

@bernhardoj
Copy link
Contributor Author

It has been happening to all PR for a few days. Here is the discussion

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/Gonals 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/Gonals in version: 1.2.77-0 🚀

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

@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
DeployBlockerCash This issue or pull request should block deployment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants