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

Show assigned user as mention in the task preview #19990

Merged
merged 9 commits into from
Jun 5, 2023

Conversation

dukenv0307
Copy link
Contributor

@dukenv0307 dukenv0307 commented Jun 1, 2023

Details

Fixed Issues

$ #19089
PROPOSAL: #19089 (comment)

$ #19959
$ #19967

Tests for #19089

  1. Login with Expensifail account
  2. Go to FAB > Assign task
  3. Enter title, description and click on next button
  4. Click on assignee and select any user or enter an email or phone number to select a new user if don't have any user
  5. Click on confirm button to create a new task
  6. Verify that the assigned user displays as metion in the task preview
  7. Edit the title of this task
  8. Logout and login again
  9. Verify that the assigned users still displays as mention in the task preview as well

Tests for #19959

  1. Go to App and Click on + icon
  2. Select Assign task option
  3. Create a new task
  4. Go to settings > logout
  5. Login again
  6. Verify that the task name is created in above display

Tests for #19967

  1. Go to any chat
  2. Click on + icon and select Assign task option
  3. Enter title and description
  4. Click on Next button
  5. Click on confirm task button
  6. click on title
  7. Edit task title
  8. Go back to previous report screen
  9. Verify that Task title is updated
  • Verify that no errors appear in the JS console

Offline tests

Same above

QA Steps

Same above

  • 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

#19089

Screencast.from.02-06-2023.00.47.25.webm
Screencast.from.06-06-2023.01.44.51.webm

#19959

Screen-Recording-2023-06-03-at-00.34.30.mp4

#19967

Screen-Recording-2023-06-03-at-00.32.13.mp4
Mobile Web - Chrome

#19089

Record_2023-06-02-00-53-26.mp4
Record_2023-06-06-01-47-22.1.mp4

#19959

Record_2023-06-03-00-38-32.1.mp4

#19967

Record_2023-06-03-00-12-59.1.mp4
Mobile Web - Safari

#19089

Screen-Recording-2023-06-02-at-07.48.14.mp4
original-D9D1C959-BD83-4FDC-9811-2E9B0EC1E104.1.mp4

#19959

Screen.Recording.2023-06-03.at.00.41.56.1.mp4

#19967

Screen.Recording.2023-06-03.at.00.38.40.mp4
Desktop

#19089

Screen-Recording-2023-06-02-at-07.51.18.mp4
Screen.Recording.2023-06-06.at.01.17.15.online-video-cutter.com.1.mp4

#19959

Screen-Recording-2023-06-03-at-00.50.39.mp4

#19967

Screen-Recording-2023-06-03-at-00.48.31.mp4
iOS

#19089

Screen-Recording-2023-06-02-at-08.08.07.mp4
Screen.Recording.2023-06-06.at.01.28.56.mp4

#19959

Screen.Recording.2023-06-03.at.01.10.02.mp4

#19967

Screen.Recording.2023-06-03.at.01.08.36.1.mp4
Android

#19089

19089.mp4
untitled.mp4

#19959

19956.mp4

#19967

19089.1.mp4

@dukenv0307 dukenv0307 marked this pull request as ready for review June 2, 2023 01:10
@dukenv0307 dukenv0307 requested a review from a team as a code owner June 2, 2023 01:10
@melvin-bot melvin-bot bot requested review from bondydaa and sobitneupane and removed request for a team June 2, 2023 01:10
@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

@bondydaa @sobitneupane 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]

@sobitneupane
Copy link
Contributor

@dukenv0307 Can you please include the test steps from #19959 and #19967 issues and verify that they are no longer reproducible. This PR is expected to solve those issues as well as mentioned by @thienlnam here.

const parentReportID = props.action.parentReportID || props.taskReport.parentReportID;
const taskTitle = props.taskReport.reportName || props.action.childReportName;
const taskAssignee = props.taskReport.managerEmail || props.action.childManagerEmail || '';
const htmlForTaskPreview = taskAssignee === '' ? `<comment>${taskTitle}</comment>` : `<comment><mention-user>@${taskAssignee}</mention-user> ${taskTitle}</comment>`;
Copy link
Contributor

Choose a reason for hiding this comment

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

htmlForTaskPreview = taskAssignee ? <comment><mention-user>@${taskAssignee}</mention-user> ${taskTitle}</comment> : <comment>${taskTitle}</comment>;

@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

❗ Please, do not use Github auto-linking keywords such as these: close, closes, closed, fix, fixes, fixed, resolve, resolves or resolved.

For more details, see the Contributing Guidelines, specifically Submit your pull request for a final review 📖.

1 similar comment
@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

❗ Please, do not use Github auto-linking keywords such as these: close, closes, closed, fix, fixes, fixed, resolve, resolves or resolved.

For more details, see the Contributing Guidelines, specifically Submit your pull request for a final review 📖.

@dukenv0307
Copy link
Contributor Author

@sobitneupane @thienlnam Everything is updated. Help to check again

Copy link
Contributor

@sobitneupane sobitneupane left a comment

Choose a reason for hiding this comment

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

@dukenv0307 When I logout and login again, task assignee goes missing from task preview.

Screen.Recording.2023-06-05.at.12.37.57.mov

@dukenv0307
Copy link
Contributor Author

@dukenv0307 When I logout and login again, task assignee goes missing from task preview.

@sobitneupane I'm not able to reproduce this bug above. Did I miss something ?

Screencast.from.05-06-2023.14.12.47.webm

@sobitneupane
Copy link
Contributor

@dukenv0307

Looks like when I edit the task report title, the task assignee is removed. Might not be related to this PR.

Copy link
Contributor

@sobitneupane sobitneupane left a comment

Choose a reason for hiding this comment

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

Screenshots/Videos

Web
Screen.Recording.2023-06-05.at.12.32.05.mov
Screen.Recording.2023-06-05.at.12.37.57.mov
Screenshot 2023-06-05 at 13 05 40
Mobile Web - Chrome
Mobile Web - Safari
Screen.Recording.2023-06-05.at.13.47.02.mov
Desktop
Screen.Recording.2023-06-05.at.13.08.29.mov
iOS
Screen.Recording.2023-06-05.at.13.22.58.mov
Android
Screen.Recording.2023-06-05.at.13.31.39.mov

@sobitneupane
Copy link
Contributor

Found few issues. Most of them are not related to this PR. Few issues close to this PR:

  • @thienlnam Do we want to show taskAssignee in LHN lastMessageText as well?
Screenshot 2023-06-05 at 13 51 00
  • @thienlnam Even after the task title is edited, LHN lastMessageText is not updated and shows the old task title. Do we want to address the issue in this PR?
Screenshot 2023-06-05 at 13 53 30

@thienlnam
Copy link
Contributor

Looks like when I edit the task report title, the task assignee is removed. Might not be related to this PR.

Oh interesting, I'll look into this. Does this happen on main?

@thienlnam Do we want to show taskAssignee in LHN lastMessageText as well?

No need to show the task assignee in the LHN for now

@thienlnam Even after the task title is edited, LHN lastMessageText is not updated and shows the old task title. Do we want to address the issue in this PR?

I'm not sure if that can be fixed in the front-end, that probably also requires a BE change

@sobitneupane
Copy link
Contributor

Oh interesting, I'll look into this. Does this happen on main?

Yes, It happens in main as well.

sobitneupane
sobitneupane previously approved these changes Jun 5, 2023
Copy link
Contributor

@sobitneupane sobitneupane 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 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.

@thienlnam
Copy link
Contributor

Yes, It happens in main as well.

Actually, I bet it happens on main because we changed what is returned via the API.
When you edit a task, you always have to provide all information on a task (title, description, assignee) otherwise it will default to null. Can we double check here that when we edit a task we're passing the correct fields to EditTask? I'm guessing this is happening because taskAssignee is null/empty somewhere in the params hence it is getting set to empty

bondydaa
bondydaa previously approved these changes Jun 5, 2023
Copy link
Contributor

@bondydaa bondydaa left a comment

Choose a reason for hiding this comment

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

Nothing stands out to me as problematic, 👍

@bondydaa
Copy link
Contributor

bondydaa commented Jun 5, 2023

I'll leave this to @thienlnam to merge once the remaining questions are figured out.

@dukenv0307
Copy link
Contributor Author

dukenv0307 commented Jun 5, 2023

@thienlnam In here, when calling api we get wrong assignee. To get assignee from report, we should get managerEmail of this report instead of assignee. That wrong make assignee is removed after update title or description of task

assignee: assignee || report.assignee,

@dukenv0307
Copy link
Contributor Author

@thienlnam I will update right now

@dukenv0307 dukenv0307 dismissed stale reviews from bondydaa and sobitneupane via 6f07296 June 5, 2023 17:24
@dukenv0307
Copy link
Contributor Author

@thienlnam Do we need to update test steps accordingly?

@dukenv0307
Copy link
Contributor Author

@thienlnam I just updated, please help to check again.

thienlnam
thienlnam previously approved these changes Jun 5, 2023
Copy link
Contributor

@thienlnam thienlnam left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@thienlnam
Copy link
Contributor

thienlnam commented Jun 5, 2023

@thienlnam Do we need to update test steps accordingly?

Yes, please do

Also seems like we have lint problems as well

Copy link
Contributor

@thienlnam thienlnam left a comment

Choose a reason for hiding this comment

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

One last thing I noticed as I pulled down your branch, you will have to update these

reportAction.reportAction.taskTitle = taskTitle;
reportAction.reportAction.taskAssignee = taskAssignee;

to use
childReportName and childManagerEmail

@dukenv0307
Copy link
Contributor Author

@thienlnam

Yes, please do

The test steps, screenshot updated accordingly

and also updated follow this comment

Please help to check again

Copy link
Contributor

@thienlnam thienlnam left a comment

Choose a reason for hiding this comment

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

Lovely, thank you!

@thienlnam thienlnam merged commit f8a0a34 into Expensify:main Jun 5, 2023
@OSBotify
Copy link
Contributor

OSBotify commented Jun 5, 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 Jun 6, 2023

🚀 Cherry-picked to staging by https://github.com/thienlnam in version: 1.3.24-5 🚀

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

@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes.

@OSBotify
Copy link
Contributor

OSBotify commented Jun 7, 2023

🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.24-5 🚀

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

@OSBotify
Copy link
Contributor

OSBotify commented Jun 7, 2023

🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.24-5 🚀

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

@@ -380,8 +380,8 @@ function editTaskAndNavigate(report, ownerEmail, title, description, assignee) {
{
taskReportID: report.reportID,
title: reportName,
description: description.trim(),
assignee: assignee || report.assignee,
description: (description || report.description).trim(),
Copy link
Contributor

Choose a reason for hiding this comment

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

@dukenv0307, @sobitneupane There is a potential regression from this line. @dukenv0307 It appears that when you merged main , you reverted some changes made in #19749, and that caused a regression where the description cannot be set to empty. More details https://expensify.slack.com/archives/C049HHMV9SM/p1686034899013369

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fedirjh my mistake, but #19749 may be a regression. Help to check my comment in this PR. If it is true, help me to fix my mistake in here with fixing the regression. Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

@dukenv0307 I have posted a simple fix for this regression , check my comment here #19749 (comment)

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