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

Migrate welcome message to room description for report #34150

Merged
merged 58 commits into from
Feb 5, 2024

Conversation

esh-g
Copy link
Contributor

@esh-g esh-g commented Jan 9, 2024

Details

Fixed Issues

$ #32615
PROPOSAL: #32615 (comment)

Tests

  1. Create a new workspace.
  2. Go to '+' -> 'start chat'
  3. Create a new workspace room with a custom description.
  4. Make sure the description is shown in the header as well as in the Central pane above composer.
  5. Click on the header
  6. Click on description
  7. Edit the description and try adding markdown
  8. Make sure the description is changed in header and above composer
  9. Make sure markdown is not rendered in Header.
    [The markdown is still not supported on backend (as of 31/Jan)]
  • Verify that no errors appear in the JS console

Offline tests

  1. Go offline.
  2. Create a new workspace room with a description
  3. Make sure the description is shown in chat mast head and header.
  4. Click on header and edit the description.
  5. Make sure the description menu item gets greyed out after editing offline.
  6. Make sure markdown is rendered correctly.

QA Steps

  1. Create a new workspace.
  2. Go to '+' -> 'start chat'
  3. Create a new workspace room with a custom description.
  4. Make sure the description is shown in the header as well as in the Central pane above composer.
  5. Click on the header
  6. Click on description
  7. Edit the description and try adding markdown
  8. Make sure the description is changed in header and above composer
  9. Make sure markdown is not rendered in Header.
    [The markdown is still not supported on backend (as of 31/Jan)]
  • 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: mWeb Chrome
    • iOS: Native
    • iOS: mWeb 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 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(theme.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 the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label so the design team can review the changes.
  • 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.

Screenshots/Videos

Android: Native
Screen.Recording.2024-02-01.at.3.38.10.PM.mov
Android: mWeb Chrome
Screen.Recording.2024-01-31.at.7.09.07.PM.mov
iOS: Native
fcaab924-1f36-4c33-961a-7dfe1347c158.mp4
iOS: mWeb Safari
Screen.Recording.2024-01-30.at.10.09.56.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-01-30.at.10.01.40.PM.mov
Screen.Recording.2024-01-31.at.9.11.46.PM.mov
MacOS: Desktop
Screen.Recording.2024-01-30.at.10.07.08.PM.mov

@esh-g esh-g requested a review from a team as a code owner January 9, 2024 15:08
@melvin-bot melvin-bot bot requested review from rushatgabhane and removed request for a team January 9, 2024 15:08
Copy link

melvin-bot bot commented Jan 9, 2024

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

@esh-g
Copy link
Contributor Author

esh-g commented Jan 9, 2024

Some things that are pending:

  • Update AddWorkspaceRoom to accept description instead of welcomeMessage on backend.
  • Make the Backend capable of saving the description as html instead of converting to plain text.
  • Make sure the translations and copy added here is as expected. (for room description)
  • Look into how to reconcile tasks/description with report/description (currently, I made it /roomDescription)

@rushatgabhane Could you please also confirm the test steps? I'll attach the videos once I know they are correct!

@puneetlath
Copy link
Contributor

Update AddWorkspaceRoom to accept description instead of welcomeMessage on backend.

This is in progress. I'll let you know when it's live.

Make the Backend capable of saving the description as html instead of converting to plain text.

This is in-progress. We'll save it as JSON `{'html': 'this is the description'}' like we do for the welcome message today.

Make sure the translations and copy added here is as expected. (for room description)

Can you post these in the #expensify-open-source channel and I'll make sure they get confirmed.

Look into how to reconcile tasks/description with report/description (currently, I made it /roomDescription)

Can you expand on this? What is the problem?

@esh-g
Copy link
Contributor Author

esh-g commented Jan 13, 2024

Can you post these in the #expensify-open-source channel and I'll make sure they get confirmed.

@puneetlath I have posted the translations here

Look into how to reconcile tasks/description with report/description (currently, I made it /roomDescription)
Can you expand on this? What is the problem?

@puneetlath Currently, the path r/:reportID/description is used only for setting task descriptions. So, what I did was that I set the report description path to r/:reportID/roomDescription as it was only specific to a room. But I'm not sure if we mean to reconcile these routes somehow or rename them to /description and /taskDescription or maybe just use /description for both.

@esh-g
Copy link
Contributor Author

esh-g commented Jan 13, 2024

gentle bump @rushatgabhane on the review...

src/pages/ReportDescriptionPage.js Outdated Show resolved Hide resolved
src/pages/ReportDescriptionPage.js Outdated Show resolved Hide resolved
src/pages/ReportDetailsPage.js Outdated Show resolved Hide resolved
@rushatgabhane
Copy link
Member

@esh-g thank you for the changes. The app doesn't crash now

@rushatgabhane
Copy link
Member

rushatgabhane commented Jan 15, 2024

Bug: Can't set room description when creating a room inside a workspace that the user doesn't own. They are a member tho.

Prereq: be part of another user's workspace.

  1. Create new room and set description whilst creating the room

Expected: room description is set and can be changed.
Actual: room description is not set, and user can't update it.

image

@rushatgabhane
Copy link
Member

Bug: when creating a new room with a descpription, the description doesn't persist.

  1. New room -> set description when creating the room
    Expected: room description persists.
    Actual: description disappears
Screen.Recording.2024-01-15.at.11.08.50.mov

@esh-g
Copy link
Contributor Author

esh-g commented Jan 15, 2024

@rushatgabhane This is because backend doesn't save the description for now. I already highlighted this here: #32615 (comment)

@puneetlath
Copy link
Contributor

Update AddWorkspaceRoom to accept description instead of welcomeMessage on backend.

This is live now on staging.

Make the Backend capable of saving the description as html instead of converting to plain text.

This is live now on staging.

Make sure the translations and copy added here is as expected. (for room description)

Asked in the internal channel. Should hear back on this soon.

@puneetlath Currently, the path r/:reportID/description is used only for setting task descriptions. So, what I did was that I set the report description path to r/:reportID/roomDescription as it was only specific to a room. But I'm not sure if we mean to reconcile these routes somehow or rename them to /description and /taskDescription or maybe just use /description for both.

I think we could use /description for both. Unless it creates some sort of problem. Ultimately, they are both for setting the "description" field on a report.

@esh-g
Copy link
Contributor Author

esh-g commented Jan 16, 2024

@puneetlath @rushatgabhane I have another question:
When a workspace member (who isn't an admin) creates a new room, they are able to set the description on creation but are not able to edit it since we currently only allow admins. Is this something that should be changed?

@esh-g
Copy link
Contributor Author

esh-g commented Jan 16, 2024

I think we could use /description for both. Unless it creates some sort of problem. Ultimately, they are both for setting the "description" field on a report.

To do that, I'm thinking of making the /description correspond to ReportDescriptionPage and then check if it is a task:

  • If task: Render the TaskDescription page
  • else: Render RoomDescriptionPage(new)

@puneetlath
Copy link
Contributor

When a workspace member (who isn't an admin) creates a new room, they are able to set the description on creation but are not able to edit it since we currently only allow admins. Is this something that should be changed?

Yes, any workspace member who is also a member of the room should be able to change the description.

To do that, I'm thinking of making the /description correspond to ReportDescriptionPage and then check if it is a task:

Makes sense to me. cc @rushatgabhane in case you have any concerns.

@rushatgabhane
Copy link
Member

To do that, I'm thinking of making the /description correspond to ReportDescriptionPage and then check if it is a task:

Makes sense to me. cc @rushatgabhane in case you have any concerns.

To achieve same route paths /description, we would be pushing the logic from router to code.

Also, from product perspective, the task description is same as a room description. i.e. a short summary of what the task is / what the room is for.

I'm okay with this.

@puneetlath
Copy link
Contributor

Is it a bug that the room description isn't in this menu? Or was that not part of the scope?

image

@puneetlath
Copy link
Contributor

It seems like it wasn't part of the scope, though I think it should be. We can handle that as a follow-up.

@puneetlath
Copy link
Contributor

NAB: I feel like we should allow this input to grow to the height of the page:

image

Copy link
Contributor

@puneetlath puneetlath left a comment

Choose a reason for hiding this comment

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

Some very minor comments, great job with this!

src/libs/ReportUtils.ts Outdated Show resolved Hide resolved
src/pages/RoomDescriptionPage.tsx Outdated Show resolved Hide resolved
src/pages/RoomDescriptionPage.tsx Outdated Show resolved Hide resolved
@puneetlath puneetlath merged commit 7511ec4 into Expensify:main Feb 5, 2024
15 checks passed
@OSBotify
Copy link
Contributor

OSBotify commented Feb 5, 2024

✋ 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 Feb 5, 2024

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

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

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

1 similar comment
@OSBotify
Copy link
Contributor

OSBotify commented Feb 5, 2024

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

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

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

@lanitochka17
Copy link

lanitochka17 commented Feb 6, 2024

This PR is failing because of issue #35901

The issue is reproducible in: Web, mWeb/Chrome, Android, IOS

Bug6369339_1707227714073.Recording__2100.mp4

@esh-g
Copy link
Contributor Author

esh-g commented Feb 6, 2024

Yes, this is because the backend markdown handling is pending
cc @puneetlath

@puneetlath
Copy link
Contributor

Yep, that's a known issue that is being worked on.

@OSBotify
Copy link
Contributor

OSBotify commented Feb 7, 2024

🚀 Deployed to production by https://github.com/Julesssss in version: 1.4.37-7 🚀

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

@mananjadhav
Copy link
Collaborator

@ishpaul777 @esh-g We set disablePressOnEnter={false} in WorkspaceNewRoomPage in this commit, can we confirm why we explicitly set this? I am currently reviewing this issue.

@ishpaul777
Copy link
Contributor

I think this was intentional to resolve #34150 (comment)

<FullPageNotFoundView shouldShow={!ReportUtils.canEditReportDescription(report, policy)}>
<HeaderWithBackButton
title={translate('reportDescriptionPage.roomDescription')}
onBackButtonPress={() => Navigation.goBack(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(report.reportID))}
Copy link
Contributor

Choose a reason for hiding this comment

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

This approach isn't perfect after we enable deep linking to room description page from room header.
Now no longer need param in goBack.


const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {welcomeMessage: parsedWelcomeMessage},
value: {description: parsedDescription, pendingFields: {description: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}},
Copy link
Contributor

@allgandalf allgandalf Aug 27, 2024

Choose a reason for hiding this comment

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

We should had created a optimistic action here, this caused #46046

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.

10 participants