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

[CP Staging] Fix same name policy rooms and policy room title and mobile app crashing when creating policy room #6724

Merged
merged 6 commits into from
Dec 13, 2021

Conversation

mountiny
Copy link
Contributor

@mountiny mountiny commented Dec 12, 2021

cc @TomatoToaster asking you for a review as you have worked on the original PR.

Adding CP Staging label as it fixes two deploy blockers.

Details

For the new Create room page, we are fixing parsing the reportName. Currently, we have been turning the reportName into an empty string, therefore we have not recognized that the value is same (if nothing is typed, the value is #).

At the same time, on mobile as the reportName is an empty string, this line is false and nothing is shown in the View component, which causes the app to fail. By making sure the reportName wont be an empty string, this should not happen.

This also fixes the policy room title not showing.

Fixed Issues

$ #6709
$ #6712
$ #6731

Tests

  1. Click "New Room" in the global create menu. Verify it takes you to <baseURL>/workspace/new-room.
  2. Verify the Room Name input functions correctly:
    • Type spaces, verify that they appear as underscores.
    • Try to type non-alphanumeric characters (besides underscores) into the room name input, verify nothing shows up.
    • Turn your caps-lock and type in the room name input, verify everything appears as lowercase.
  3. Click the dropdown. Verify that all the workspaces (policies) shown match up to the "Free Plan" policies shown for the same account in OldDot (Settings > Policies)
  4. Type test_room_name into the room name input and select a workspace. Click "Create Room". Verify that the room is created and that you navigate to the room (<baseURL>/r/<reportID>).
    • NOTE: The room name in the header, the room's entry in the LHN, and the default text won't show up correctly yet. Just verify that you are navigated to a new report. I will open up a separate PR for this, since it'll make this one too cluttered.
  5. Navigate back to <baseURL>/workspace/new-room. Select the same workspace you used in [4]. Then, type test_room_name into the Room Name input. Verify that the A room with this name already exists error message displays (in real-time as you finish typing test_room_name).
  6. Change the workspace in the workspace dropdown. Verify the error disappears. Reselect the same workspace, and verify the error appears again.
  7. Delete the last e off of the room name. Verify the error disappears. Add the last e back, and verify the error appears again.

QA Steps

Same as the above tests with account which has appropriate betas accessible.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

web.mp4

With the policy room title:
image

@mountiny mountiny self-assigned this Dec 12, 2021
@mountiny mountiny requested a review from a team as a code owner December 12, 2021 20:20
@github-actions
Copy link
Contributor

⚠️ ⚠️ Heads up! This pull request has the CP Staging label. ⚠️ ⚠️
Merging it will cause it to be immediately deployed to staging, even if the open StagingDeployCash deploy checklist is locked.

@MelvinBot MelvinBot requested review from aldo-expensify and removed request for a team December 12, 2021 20:21
@mountiny mountiny mentioned this pull request Dec 12, 2021
5 tasks
@mountiny mountiny changed the title [CP Staging] Fix being able to create rooms with the same name [CP Staging] Fix same name policy rooms and policy room title and mobile app crashing when creating policy room Dec 13, 2021
Copy link
Contributor Author

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

Thank you for your review.

Comment on lines +145 to +148
// For a basic policy room, return its original name
if (ReportUtils.isPolicyRoom({chatType})) {
return fullReport.reportName;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The isDefaultPolicy does not check for basic policy room, so we need to add this check here too.

const isDefaultChatRoom = ReportUtils.isDefaultRoom(props.report);
const title = isDefaultChatRoom
const title = isDefaultChatRoom || isPolicyRoom
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to show similar style of title for both, default and policy rooms. I need to keep them separate though as the default dooms have subtitle and avatar, which is a different behaviour and design than policy room.

Copy link
Contributor

@TomatoToaster TomatoToaster left a comment

Choose a reason for hiding this comment

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

Aha! I should've known there would be consequences for the UI being incomplete on mobile. Good work @mountiny. Good thing this is behind a beta.

@TomatoToaster
Copy link
Contributor

Since there is fixing a deploy blocker, I'm going to merge this rn.

@TomatoToaster TomatoToaster merged commit ab6b887 into main Dec 13, 2021
@TomatoToaster TomatoToaster deleted the vit-fixRoomName branch December 13, 2021 15:46
@botify
Copy link

botify commented Dec 13, 2021

@TomatoToaster looks like this was merged without passing tests. Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

OSBotify pushed a commit that referenced this pull request Dec 13, 2021
[CP Staging] Fix same name policy rooms and policy room title and mobile app crashing when creating policy room

(cherry picked from commit ab6b887)
@TomatoToaster
Copy link
Contributor

Hmmm weird note because it definitely passed the checks on commit: 9bbd555 - Use isPolicyRoom. I guess except the Explain Cherry-Pick label via OSBotify comment didn't but I'm not sure what more is needed for that. Both @mountiny and I commented on this PR.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @TomatoToaster in version: 1.1.20-3 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @Julesssss in version: 1.1.21-1 🚀

platform result
🤖 android 🤖 failure ❌
🖥 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.

4 participants