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

Fix: Can delete attachments in archived workspace #17329

Merged
merged 4 commits into from
May 1, 2023

Conversation

ShogunFire
Copy link
Contributor

@ShogunFire ShogunFire commented Apr 12, 2023

Details

Fixed Issues

$ #16092
PROPOSAL: #16092 (comment)

Tests

On mobile only (Long press has been disabled on web and desktop):

  1. Create a new workspace
  2. Send an attachment in the announce section of that workspace
  3. Delete the workspace
  4. Go to the announce section again
  5. Long press the attachment and verify that the delete comment button is not present
  • Verify that no errors appear in the JS console

Offline tests

No test offline

QA Steps

On mobile only (Long press has been disabled on web and desktop):

  1. Create a new workspace
  2. Send an attachment in the announce section of that workspace
  3. Delete the workspace
  4. Go to the announce section again
  5. Long press the attachment and verify that the "delete comment" button is not present
  • 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 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
2023-04-20.18-05-28.mp4
Mobile Web - Chrome
2023-04-21.18-36-49.mp4
Mobile Web - Safari
2023-04-25.16-40-15.mp4
Desktop
2023-04-26.05-50-53.mp4
iOS
2023-04-25.16-28-39.mp4
Android
2023-04-21.18-18-33.mp4

@ShogunFire ShogunFire requested a review from a team as a code owner April 12, 2023 09:23
@github-actions
Copy link
Contributor

github-actions bot commented Apr 12, 2023

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

@melvin-bot melvin-bot bot requested review from Beamanator and removed request for a team April 12, 2023 09:23
@MelvinBot
Copy link

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

@ShogunFire
Copy link
Contributor Author

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

@Beamanator
Copy link
Contributor

@tylerkaraszewski you were the engineer assigned on the related issue, do you want to review this? I'm OOO till the 20th anyway haha

@eVoloshchak
Copy link
Contributor

Weird, melvin should have requested a review from both of us, I wonder what is the problem.
I'll review this tomorrow, haven't seen this during the day unfortunately

src/components/ShowContextMenuContext.js Show resolved Hide resolved
@@ -328,5 +329,8 @@ export default compose(
preferredSkinTone: {
key: ONYXKEYS.PREFERRED_EMOJI_SKIN_TONE,
},
report: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this? Isn't report passed as a prop in ReportActionsList?

Copy link
Contributor Author

@ShogunFire ShogunFire Apr 16, 2023

Choose a reason for hiding this comment

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

We need it because without it when we delete the workspace the ReportActionItems are not rerendered and the context menu is created during the rendering so the menu still had the delete comment option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually you might be right that we don't need it, I changed shouldComponentUpdate after changing this so maybe changing shouldComponentUpdate is enough I am testing this and I let you know

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 tried to remove it but then the item is not rerendered and delete comment option is present until the next rerender. Do you think it's a problem to keep it ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this doesn't look right. Is there a way we could fix that? Or refactor components so the problem isn't present?

Also, could you merge with main please? There are some conflicts with the main branch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Due to the way FlatList work the ReportActionItem is not rerender even if the component ReportActionList is rerendered. The way to make the FlatList rerender even when the data doesn't change is to use extraData. We used it here https://github.com/Expensify/App/blob/8c99aa34f96054123c6a9a0612549068cbb814ab/src/pages/home/report/ReportActionsList.js#L149

So we could add a condition to pass a different extraData if the report is closed. Do you think that would be a better way ?

Ok I will merge with main at the end.

Copy link
Contributor

Choose a reason for hiding this comment

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

So we could add a condition to pass a different extraData if the report is closed. Do you think that would be a better way ?

Nice find, yeah, I think it's a better approach.

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 did the change and the merge

Copy link
Contributor Author

@ShogunFire ShogunFire Apr 18, 2023

Choose a reason for hiding this comment

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

Seems like there is a bug on the main branch on android for workspace report I can't see any message. It's not related to my changes.

Copy link
Contributor

@eVoloshchak eVoloshchak left a comment

Choose a reason for hiding this comment

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

@ShogunFire, the code looks good to me.
I did encounter a problem in your branch (a crash even), so for my testing I had to cherry-pick your PR into the latest main. I think you can merge with main once again and the problem will be resolved.
Once you do that, I'll be able to do a final sweep and go through the checklist.

Also, please upload screen recordings for all of the platforms

@ShogunFire
Copy link
Contributor Author

I redid the merge but for me the main branch still has a problem. ReportActionList has changed a lot so it may be related. Anyway I don't know what I can do more than that, my changes are not creating the problem.

Sorry but I can't test on all platforms right now.

@eVoloshchak
Copy link
Contributor

eVoloshchak commented Apr 20, 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 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
Screen.Recording.2023-04-23.at.14.04.04.mov
Mobile Web - Chrome
Screen.Recording.2023-04-20.at.14.11.38.mov
Mobile Web - Safari
Screen.Recording.2023-04-20.at.13.27.51.mov
Desktop
Screen.Recording.2023-04-23.at.14.06.07.mov
iOS
Screen.Recording.2023-04-20.at.13.36.50.mov
Android
Screen.Recording.2023-04-20.at.14.09.14.mov

Copy link
Contributor

@eVoloshchak eVoloshchak left a comment

Choose a reason for hiding this comment

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

@ShogunFire , there's an issue on web

  1. In tab A open announce of the workspace
  2. In tab B delete the workspace
  3. Go back to tab A
  4. Refresh the tab A
  5. Notice how it flashes and delete button is still available for a brief moment
Screen.Recording.2023-04-20.at.14.17.19.mov

Copy link
Contributor

@eVoloshchak eVoloshchak left a comment

Choose a reason for hiding this comment

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

This works well on iOS, Android, mWeb Safari and Chrome. Besides the issue on web above, there are a couple of things that need to be sorted out:

  • Please finish the checklist by uploading videos for all platforms when you have the time
  • All of your commits need to be signed, you can rebase your current commits with the signed ones

@ShogunFire
Copy link
Contributor Author

Good testing I would have never found this bug, but do you think this is in the scope of this issue ? In the video we can see that the whole report is in a wrong state after the refresh, not just the context menu.

Ah I thought my commits were signed :(

For the recordings I will do what I can.

@eVoloshchak
Copy link
Contributor

Good testing I would have never found this bug, but do you think this is in the scope of this issue ? In the video we can see that the whole report is in a wrong state after the refresh, not just the context menu.

I tried to reproduce this on new.expensify.com and couldn't. I can't reproduce it reliably, so I'm not sure if it was caused by this PR, but it would be better if we both double-check this.

…"delete comment" option was still present in a closed report.

Signed-off-by: Pierre Michel <pmiche04@gmail.com>
…t anymore

Signed-off-by: Pierre Michel <pmiche04@gmail.com>
@ShogunFire
Copy link
Contributor Author

I can't reproduce this issue on web. What I have is another issue on Android since I merged with main, I also have the problem when I just checkout main without anything to do with my branch. The messages in workspaces are not seen:

2023-04-20.18-50-43.mp4

If it's working for other people I am not sure what I am doing wrong...

My commits are signed even if I couldn't make it the way you asked me (not an expert of git)

@Beamanator
Copy link
Contributor

@ShogunFire Just FYI we won't be able to merge your PR until all commits are signed... So if the instructions in point 10 here don't work for you, let's figure out how to make the instructions clearer and get them to work for you

@ShogunFire
Copy link
Contributor Author

@Beamanator Hello, all commits are signed, I just couldn't make it with a rebase method so I forced push and the commits are not the same.

If everything is ok now, I can try to fix the Lint's errors today.

@Beamanator
Copy link
Contributor

Aah ok thanks @ShogunFire maybe I was a bit confused 😅 That part looks great for now 👍

Signed-off-by: Pierre Michel <pmiche04@gmail.com>
@ShogunFire
Copy link
Contributor Author

@eVoloshchak I think I have resolved the Lint's errors, commits are signed, I have done 3 recordings, I tried to create a Mac mini M1 instance on scaleway to do the 2 other recordings but they are currently out of stock:
OutOfStock

Concerning the bug you had found I really don't see how that could be induced by the changes I made and I think when the state of the report will be good the context menu will be good.

Do you think, you can approve the merge as it is or do you really need those recordings ?

@eVoloshchak
Copy link
Contributor

Concerning the bug you had found I really don't see how that could be induced by the changes I made and I think when the state of the report will be good the context menu will be good.

I can't reproduce with latest sources, so all the platforms work great now, I've uploaded the missing recordings

Do you think, you can approve the merge as it is or do you really need those recordings ?

This is a requirement for all PR's, they have to have recordings for each platform. It's about all platforms being tested by multiple people independently.
I'd suggest you try other services, I've used MacInCloud personally, never had a problem.

eVoloshchak
eVoloshchak previously approved these changes Apr 23, 2023
Copy link
Contributor

@eVoloshchak eVoloshchak left a comment

Choose a reason for hiding this comment

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

The code looks good and it tests well on all platforms.
All that's lest if for @ShogunFire to upload missing recordings

@tylerkaraszewski, could you take a look at this please>

@eVoloshchak
Copy link
Contributor

@ShogunFire, friendly bump on the missing recordings and merge conflicts
Also, could you please request a review from @tylerkaraszewski?

…ossible

Signed-off-by: Pierre Michel <pmiche04@gmail.com>

# Conflicts:
#	src/components/ShowContextMenuContext.js
@ShogunFire
Copy link
Contributor Author

@tylerkaraszewski Hello, I put the last recordings and merged with main, can you review this PR ?

@eVoloshchak
Copy link
Contributor

@ShogunFire, the screen recording for Desktop is missing

@ShogunFire
Copy link
Contributor Author

@eVoloshchak Sorry, I added it

Copy link
Contributor

@eVoloshchak eVoloshchak left a comment

Choose a reason for hiding this comment

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

Looks good and tests well
cc: @tylerkaraszewski

@ShogunFire
Copy link
Contributor Author

@tylerkaraszewski Hello, can you review this PR soon ?

@tylerkaraszewski tylerkaraszewski merged commit 9b7d6cd into Expensify:main May 1, 2023
@OSBotify
Copy link
Contributor

OSBotify commented May 1, 2023

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

@OSBotify
Copy link
Contributor

OSBotify commented May 3, 2023

🚀 Deployed to staging by https://github.com/tylerkaraszewski in version: 1.3.9-12 🚀

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

@mvtglobally
Copy link

@Beamanator We dont need to QA this?

@Beamanator
Copy link
Contributor

Goooood question - @ShogunFire @eVoloshchak it looks like we need QA test steps! Can you add them please?

@ShogunFire
Copy link
Contributor Author

@Beamanator @mvtglobally I added the QA steps

@OSBotify
Copy link
Contributor

OSBotify commented May 9, 2023

🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.12-0 🚀

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.

7 participants