Expensify Card - Policy ID is displayed under the card's name for member
If you havenβt already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.30-9 Reproducible in staging?: Y Reproducible in production?: Y Issue reported by: Applause Internal Team
Action Performed:
Precondition:
- Admin and member are in the same workspace.
- Go to staging.new.expensify.com
- [Admin] Go to workspace settings > Expensify Card.
- [Admin] Click Issue card.
- [Admin] Issue a card to the member.
- [Member] Go to Account settings > Wallet.
Expected Result:
Policy ID will not be displayed under the card's name for member.
Actual Result:
Policy ID is displayed under the card's name for member.
Workaround:
Unknown
Platforms:
- [x] Android: Native
- [x] Android: mWeb Chrome
- [x] iOS: Native
- [x] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [x] MacOS: Desktop
Screenshots/Videos
https://github.com/user-attachments/assets/9367e3b2-56a1-4426-b733-8f8d7fe01369
Triggered auto assignment to @RachCHopkins (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
@RachCHopkins FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
Proposal
Please re-state the problem that we are trying to solve in this issue.
- Policy ID is displayed under the card's name for member.
What is the root cause of that problem?
- When displaying assigned card, we always display its domain name regardless the domain name contain the policyID or not:
https://github.com/Expensify/App/blob/a9dc59624ac6ad9896ef7c4fce46a18d696213bd/src/pages/settings/Wallet/PaymentMethodList.tsx#L248
What changes do you think we should make in order to solve the problem?
- We can use:
description: /policy([a-zA-Z0-9]+)\.exfy/.test(card.domainName) ? '' : card.domainName,
or
description: /policy([a-zA-Z0-9]+)\.exfy/.test(card.domainName) ? getDescriptionForPolicyDomain(card.domainName) : card.domainName,
- In above, I introduce a new function
getDescriptionForPolicyDomainwhich will return the policy name based on card domain:
const getDescriptionForPolicyDomain = (domainName: string) => {
const match = domainName.match(/policy([a-zA-Z0-9]+)\.exfy/);
const policyID = match ? match[1] : null;
const policy = getPolicy(policyID)
return policy?.name // Can be improved later
};
What alternative solutions did you explore? (Optional)
Proposal
Please re-state the problem that we are trying to solve in this issue.
Policy ID is displayed under the card's name for member
What is the root cause of that problem?
The PolicyID is included in the domainName for Expensify Cards. As a result, when displaying the domain name, the PolicyID will also be shown.
What changes do you think we should make in order to solve the problem?
Checking if this is the Expensify Card, we will customize the domain name to prevent the policyID from being displayed.
- To identify an Expensify Card, we can use the isExpensifyCard function or create a new function to identify it using the domainName field
https://github.com/Expensify/App/blob/7ebfaa0daaa43a20083250e0f263964ed5b647b2/src/libs/CardUtils.ts#L40
- We need to discuss with other stuffs which domain name to display in the subtitle of the Expensify Card, rather than showing the domain name from the backend. We will then update it to display the new subtitle.
What alternative solutions did you explore? (Optional)
What is the expectation here? If the card is issued from the workspace, I'd expect the workspace name, not just the domain name. I will check on this.
Job added to Upwork: https://www.upwork.com/jobs/~021833064845344667979
Current assignees @allgandalf and @DylanDylann are eligible for the External assigner, not assigning anyone new.
π£ @allgandalf π An offer has been automatically sent to your Upwork account for the Reviewer role π Thanks for contributing to the Expensify app!
π£ @DylanDylann π An offer has been automatically sent to your Upwork account for the Reviewer role π Thanks for contributing to the Expensify app!
π£ @dominictb π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
@dominictb yes, let's show the policy name there if the domain is workspace feed. Your proposal makes sense, can you create a PR? What is your ETA? Thanks!
With the automation borked, and this looking like it was on Prod a week ago, can you do the checklist please @DylanDylann?
The following checklist (instructions) will need to be completed before the issue can be closed:
- [ ] [@DylanDylann] The PR that introduced the bug has been identified. Link to the PR:
- [ ] [@DylanDylann] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
- [ ] [@DylanDylann] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
- [ ] [@DylanDylann] Determine if we should create a regression test for this bug.
- [ ] [@DylanDylann] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
- [ ] [@RachCHopkins] Link the GH issue for creating/updating the regression test once above steps have been agreed upon
@RachCHopkins This feature is still behind beta, I don't think we need to checklist here
I agree we will include tests in the test rail as we officially release this feature
Is this ready for me to pay people? I think that's the part I'm not understanding.
@RachCHopkins Yes. Let's pay $250 to @dominictb
cc @mountiny
What about you @DylanDylann? Do you also need to be paid?
No need payment to me. I will get paid on the project
Sounds good to me
Contributor has been paid, the contract has been completed, and the Upwork post has been closed.