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 domain all rooms' subtitle #3845

Merged
merged 6 commits into from
Jul 7, 2021
Merged

Conversation

TomatoToaster
Copy link
Contributor

@TomatoToaster TomatoToaster commented Jul 1, 2021

@sketchydroide, please review when you have the chance
CC: @yuwenmemon

Details

Shows domain name instead of Unknown Policy for rooms like expensify.com

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/169049

Tests

Did the QA locally to verify this works.

QA Steps

  1. This needs to be verified internally. If you catch this in the checklist before I've checked it off, ping @TomatoToaster, so I can test it.
  2. Verify that domainAll rooms (i.e. #expensify.com) have subtitles on them that say their domain name instead of Unknown Policy.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

image

@TomatoToaster TomatoToaster self-assigned this Jul 1, 2021
@TomatoToaster TomatoToaster requested a review from a team as a code owner July 1, 2021 01:03
@MelvinBot MelvinBot requested review from sketchydroide and removed request for a team July 1, 2021 01:04
if (policy && policy.id) {
policies[policy.id] = policy;
callback: (policy, key) => {
if (policy && key && policy.name) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a note for why I needed to be specific about policy.name here being included because otherwise when this function is called from here:
https://github.com/Expensify/Expensify.cash/blob/8a221022b633404eb84960b23b64ca884dc51fc4/src/libs/Navigation/AppNavigator/AuthScreens.js#L143

we end up calling the Onyx callback here and overwriting the policies with just their employeesList. It'll overwrite all the policy objects in policies with just their employeeList. I believe a race condition is causing this. By checking for policy.name, here we won't overwrite and delete the policy names here.

To see this in effect, you can take out && policy.name and see that the search bar will always show Unknown Policy when you open it:
image

return '';
}
if (report.chatType === CONST.REPORT.CHAT_TYPE.DOMAIN_ALL) {
return report.reportName.substring(1);
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 the substring(1) call? Isn't report.reportName sufficient?

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 reportName has the # in it so this just gets rid of that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Solid, sounds good!

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds good, but I think a comment refering that would be nice, just like us whom ever is reading this code might not know and get a bit confused on to the why. Also if at any point we don't have the # before it might make it easier to search for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point, I'll leave one in!

yuwenmemon
yuwenmemon previously approved these changes Jul 2, 2021
@yuwenmemon
Copy link
Contributor

@sketchydroide all yours!

Copy link
Contributor

@sketchydroide sketchydroide left a comment

Choose a reason for hiding this comment

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

Just a tiny request, looks good other wise :)

@TomatoToaster
Copy link
Contributor Author

Updated!

@sketchydroide
Copy link
Contributor

Ok happy to aprove once conflicts are taken care of

@TomatoToaster
Copy link
Contributor Author

Lol I have caused my own merge conflicts 😅 . They are resolved now!

@yuwenmemon
Copy link
Contributor

@sketchydroide bump!

Copy link
Contributor

@sketchydroide sketchydroide left a comment

Choose a reason for hiding this comment

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

LGTM

@sketchydroide sketchydroide merged commit b992f45 into main Jul 7, 2021
@sketchydroide sketchydroide deleted the amal-domain-chatroom-name branch July 7, 2021 17:31
@OSBotify
Copy link
Contributor

OSBotify commented Jul 7, 2021

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

@isagoico
Copy link

isagoico commented Jul 8, 2021

@TomatoToaster Caught this in the checklist before it's checked off 😄 Bumping as instructed

@TomatoToaster
Copy link
Contributor Author

Oh both of these got merged, yep this one is good too!

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.

5 participants