Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.53k stars 2.88k forks source link

[HOLD for payment 2024-05-09] [$500] Currency - In WS default currency section searching for euro/rupee showing "no results found" #29618

Closed lanitochka17 closed 5 months ago

lanitochka17 commented 1 year ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.3.84-0

Reproducible in staging?: Yes

Reproducible in production?: Yes

If this was caught during regression testing, add the test name, ID and link from TestRail:

Email or phone of affected tester (no customers):

Logs: https://stackoverflow.com/c/expensify/questions/4856

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

Action Performed:

  1. Go to https://staging.new.expensify.com/

  2. Tap on announce room

  3. Tap plus icon----Split bill

  4. Tap currency

  5. Search euro/rupee and note search results displayed

  6. Navigate back to LHN

  7. Tap profile---Workspaces

  8. Tap on a Workspace

  9. Tap on Workspace name

  10. Tap on default currency

  11. Enter euro/ rupee in search field

Expected Result:

In WS default currency section searching for euro/rupee showing "no results found" but in announce room split bill currency drop down searching for euro/rupee showing results. The behavior must not be inconsistent within the site

Actual Result:

In WS default currency section searching for euro/rupee showing "no results found" but in announce room split bill currency drop down searching for euro/rupee showing results. The behaviour is inconsistent within the site

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

Screenshots/Videos

Android: Native
Android: mWeb Chrome https://github.com/Expensify/App/assets/78819774/3da92bde-b004-4e88-895f-7b56da0d049b
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01810f204b38ab0d0d
  • Upwork Job ID: 1714934578304249856
  • Last Price Increase: 2023-11-02
Issue OwnerCurrent Issue Owner: @laurenreidexpensify
melvin-bot[bot] commented 1 year ago

Triggered auto assignment to @laurenreidexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

melvin-bot[bot] commented 1 year ago

Bug0 Triage Checklist (Main S/O)

Pujan92 commented 1 year ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

In WS currency selection currency name search is not working correctly

What is the root cause of that problem?

We are not considering currency name in the filtration, it is only checks for code and symbol currently. https://github.com/Expensify/App/blob/fe282b45cb13e01519282ccc023e5bfbd7714158/src/pages/workspace/WorkspaceSettingsCurrencyPage.js#L44

What changes do you think we should make in order to solve the problem?

We need to add name field also for comparing the search text.

 || currency.name.toLowerCase().includes(trimmedText)

OR

Use the same approach with the regex which we have used in IOUCurrencySelection

https://github.com/Expensify/App/blob/fe282b45cb13e01519282ccc023e5bfbd7714158/src/pages/iou/IOUCurrencySelection.js#L107-L108

Result https://github.com/Expensify/App/assets/14358475/fb0806ad-c8f4-4249-a16f-ecde333d8f37
melvin-bot[bot] commented 1 year ago

Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

melvin-bot[bot] commented 1 year ago

Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (External)

parasharrajat commented 1 year ago

Let's use the same pattern as IOUCurrencySelection page as that is more updated. @Pujan92 's proposal looks good to me.

:ribbon: :eyes: :ribbon: C+ reviewed

melvin-bot[bot] commented 1 year ago

Triggered auto assignment to @cead22, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

laurenreidexpensify commented 1 year ago

@cead22 bump ^^

cead22 commented 1 year ago

@Pujan92 @parasharrajat is there a reason we're not using the same component here, or the same code to display the currencies? It seems like the main reason for this problem could be that we have code in 2 different places doing the same thing

melvin-bot[bot] commented 1 year ago

Job added to Upwork: https://www.upwork.com/jobs/~01810f204b38ab0d0d

melvin-bot[bot] commented 1 year ago

Current assignee @parasharrajat is eligible for the External assigner, not assigning anyone new.

laurenreidexpensify commented 1 year ago

Readded external label to get the job on Upwork as looks like the API call failed the first time

Pujan92 commented 1 year ago

@Pujan92 @parasharrajat is there a reason we're not using the same component here, or the same code to display the currencies? It seems like the main reason for this problem could be that we have code in 2 different places doing the same thing

The functionality looks the same for both components, I am not sure but tagging @thiagobrez for their input as the workspace currency push page added recently in https://github.com/Expensify/App/pull/27861

thiagobrez commented 1 year ago

@Pujan92 I believe it's because when I worked on this, the IOUCurrencySelection page was still using the old list, OptionsSelector, and in #27861 we're using the new implementation SelectionList. Other differences might come because previously, WS currency selector was using the old pattern with native HTML select, so it didn't need search

laurenreidexpensify commented 1 year ago

@cead22 are you fine to assign now with the additional context?

cead22 commented 1 year ago

@thiagobrez @Pujan92 I imagine auto complete in a currency selector is always going to work by looking at the currency, code, and symbol. If that's a safe assumption, would it make sense to design a solution such that all currency selectors moving forward share this functionality?

cead22 commented 1 year ago

Not yet @laurenreidexpensify :)

melvin-bot[bot] commented 1 year ago

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

cead22 commented 1 year ago

Waiting for proposals that are more future-proof

melvin-bot[bot] commented 1 year ago

@cead22 @parasharrajat @laurenreidexpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

parasharrajat commented 1 year ago

Waiting for proposals.

tsa321 commented 1 year ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

Default currency selection of Workspace has different behavior with IOU currency selection

What is the root cause of that problem?

We are using different two different currency selection list component for the IOU request and workspace default currency setting

What changes do you think we should make in order to solve the problem?

We could make a new component: CurrencySelectionList based on the currency selection list of the IOU Request and use it in IOU request and in the workspace default currency setting.

The CurrencySelectionList could be something like this :

CurrencySelectionList Code: ```javascript import React, {useState, useMemo} from 'react'; import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import Str from 'expensify-common/lib/str'; import ONYXKEYS from '@src/ONYXKEYS'; import compose from '@libs/compose'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import withLocalize, {withLocalizePropTypes} from './withLocalize'; import SelectionList from './SelectionList'; const propTypes = { textInputLabel: PropTypes.string.isRequired, onSelect: PropTypes.func.isRequired, initiallySelectedCurrencyCode: PropTypes.string.isRequired, // The curency list constant object from Onyx currencyList: PropTypes.objectOf( PropTypes.shape({ // Symbol for the currency symbol: PropTypes.string, // Name of the currency name: PropTypes.string, // ISO4217 Code for the currency ISO4217: PropTypes.string, }), ), ...withLocalizePropTypes, }; const defaultProps = { currencyList: {}, }; function CurrencySelectionList(props) { const [searchValue, setSearchValue] = useState(''); const {translate, currencyList} = props; const {sections, headerMessage} = useMemo(() => { const currencyOptions = _.map(currencyList, (currencyInfo, currencyCode) => { const isSelectedCurrency = currencyCode === props.initiallySelectedCurrencyCode ; return { currencyName: currencyInfo.name, text: `${currencyCode} - ${CurrencyUtils.getLocalizedCurrencySymbol(currencyCode)}`, currencyCode, keyForList: currencyCode, isSelected: isSelectedCurrency, }; }); const searchRegex = new RegExp(Str.escapeForRegExp(searchValue.trim()), 'i'); const filteredCurrencies = _.filter(currencyOptions, (currencyOption) => searchRegex.test(currencyOption.text) || searchRegex.test(currencyOption.currencyName)); const isEmpty = searchValue.trim() && !filteredCurrencies.length; return { sections: isEmpty ? [] : [ { data: filteredCurrencies, indexOffset: 0, }, ], headerMessage: isEmpty ? translate('common.noResultsFound') : '', }; }, [currencyList, searchValue, translate, props.initiallySelectedCurrencyCode]); return ( ); } CurrencySelectionList.displayName = 'CurrencySelectionList'; CurrencySelectionList.propTypes = propTypes; CurrencySelectionList.defaultProps = defaultProps; export default compose( withLocalize, withOnyx({ currencyList: {key: ONYXKEYS.CURRENCY_LIST}, }), )(CurrencySelectionList); ```

and use it in workspace and iou, for worskapce change the selectionlist section into something like this:

<CurrencySelectionList
    textInputLabel={translate('workspace.editor.currencyInputLabel')}
    onSelect={onSelectCurrency}
    initiallySelectedCurrencyCode={initiallySelectedCurrencyCode}
/>


This is still in progress, so to give a global idea of the component.

Result of the workspace default currency setting: https://github.com/Expensify/App/assets/114975543/affef9d0-c11a-4d71-9610-3e6fdc073461
parasharrajat commented 1 year ago

Edit:

I will check the differences between the pages and review the proposal accordingly.

parasharrajat commented 1 year ago

Reviewing...

Pujan92 commented 1 year ago

I am about to post the same proposal which @tsa321 has proposed, only change that differs from my idea is to pass selectedCurrencyCode instead of initiallyFocusedOptionKey from a parent.

<CurrencySelection 
    textInputLabel={translate('workspace.editor.currencyInputLabel')}
    selectedCurrencyCode={policy.outputCurrency} 
    onSelectCurrency={confirmCurrencySelection} 
/>
CurrencySelection ```js import React, { useMemo, useState } from 'react'; import PropTypes from 'prop-types'; import compose from "@libs/compose"; import { withOnyx } from "react-native-onyx"; import withLocalize from "./withLocalize"; import ONYXKEYS from "@src/ONYXKEYS"; import SelectionList from './SelectionList'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import Str from 'expensify-common/lib/str'; const propTypes = { /** Constant, list of available currencies */ currencyList: PropTypes.objectOf( PropTypes.shape({ /** Symbol of the currency */ symbol: PropTypes.string.isRequired, }), ), }; const defaultProps = { currencyList: {}, }; function CurrencySelection({currencyList, textInputLabel, selectedCurrencyCode, translate, onSelectCurrency}) { const [searchValue, setSearchValue] = useState(''); const {sections, headerMessage, initiallyFocusedOptionKey} = useMemo(() => { const currencyOptions = _.map(currencyList, (currencyInfo, currencyCode) => { const isSelectedCurrency = currencyCode === selectedCurrencyCode; return { currencyName: currencyInfo.name, text: `${currencyCode} - ${CurrencyUtils.getLocalizedCurrencySymbol(currencyCode)}`, currencyCode, keyForList: currencyCode, isSelected: isSelectedCurrency, }; }); const searchRegex = new RegExp(Str.escapeForRegExp(searchValue.trim()), 'i'); const filteredCurrencies = _.filter(currencyOptions, (currencyOption) => searchRegex.test(currencyOption.text) || searchRegex.test(currencyOption.currencyName)); const isEmpty = searchValue.trim() && !filteredCurrencies.length; return { initiallyFocusedOptionKey: _.get( _.find(filteredCurrencies, (currency) => currency.currencyCode === selectedCurrencyCode), 'keyForList', ), sections: isEmpty ? [] : [ { data: filteredCurrencies, indexOffset: 0, }, ], headerMessage: isEmpty ? translate('common.noResultsFound') : '', }; }, [currencyList, searchValue, selectedCurrencyCode, translate]); return ( ) } CurrencySelection.propTypes = propTypes; CurrencySelection.defaultProps = defaultProps; export default compose( withLocalize, withOnyx({ currencyList: {key: ONYXKEYS.CURRENCY_LIST}, }), )(CurrencySelection); ```
parasharrajat commented 1 year ago

Given that both posted proposals are quite the same, let's go with the first one posted by @tsa321 . Also, both proposals differ from our standard pattern.

We should be using CountrySelection pattern for such pages. These should be URL navigatable.

@tsa321 If you don't have any challenges, let's go with it.

:ribbon: :eyes: :ribbon: C+ reviewed

melvin-bot[bot] commented 1 year ago

Current assignee @cead22 is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

melvin-bot[bot] commented 1 year ago

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] commented 1 year ago

📣 @parasharrajat Please request via NewDot manual requests for the Reviewer role ($500)

melvin-bot[bot] commented 1 year ago

❌ There was an error making the offer to @tsa321 for the Contributor role. The BZ member will need to manually hire the contributor.

tsa321 commented 1 year ago

Thank you, my plan is to submit a PR within 3 working days.

melvin-bot[bot] commented 1 year ago

@cead22 @parasharrajat @laurenreidexpensify @tsa321 this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!

melvin-bot[bot] commented 11 months ago

This issue has not been updated in over 15 days. @cead22, @parasharrajat, @laurenreidexpensify, @tsa321 eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

tsa321 commented 11 months ago

Update: The PR is waiting for a review.

parasharrajat commented 11 months ago

Update: On it.

laurenreidexpensify commented 10 months ago

PR is still in review

melvin-bot[bot] commented 8 months ago

@cead22, @parasharrajat, @laurenreidexpensify, @tsa321, this Monthly task hasn't been acted upon in 6 weeks; closing.

If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.

parasharrajat commented 8 months ago

This issue is not yet completed. We were on a long hold.

@tsa321 What is your plan for next steps?

tsa321 commented 8 months ago

@parasharrajat because there are changes in IOU request flow, here is a suggestion from internal engineer : https://github.com/Expensify/App/pull/30889#issuecomment-1915004958 :

Yes, I agree that we should only move forward with IOURequestStepCurrency. I don't think it needs to be held on the old component being removed though.

So I am really not sure what is the best next step here...

@parasharrajat What do you think the best next step here? I am agree with whatever the best action here...

parasharrajat commented 8 months ago

@tsa321 let's move forward with https://github.com/Expensify/App/pull/30889#issuecomment-1910679325 steps. Let me know if you have some questions.

tsa321 commented 8 months ago

@parasharrajat Ok, I am working on it...

parasharrajat commented 8 months ago

@laurenreidexpensify please reopen this issue.

melvin-bot[bot] commented 6 months ago

Reviewing label has been removed, please complete the "BugZero Checklist".

melvin-bot[bot] commented 6 months ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 1.4.69-2 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-05-09. :confetti_ball:

For reference, here are some details about the assignees on this issue:

melvin-bot[bot] commented 6 months ago

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

laurenreidexpensify commented 6 months ago

Payment Summary:

C+ @parasharrajat requires payment through NewDot Manual Requests $500 Contributor: @tsa321 $500 - offer sent in Upwork, please accept

parasharrajat commented 6 months ago

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

Regression Test Steps

  1. Go to workspace settings and select default currency
  2. The currency selection list will appears and type "euro"
  3. The euro currency must be available in the list
  4. Select the euro currency, then notice the default currency is changed into euro
  5. Repeat step 2-4 for other search text like "rupee", "pound", "Australia" then notice the Indian rupee , England pounds, Australia dollar is available in the list for the respected search text.

Do you agree 👍 or 👎 ?

melvin-bot[bot] commented 6 months ago

Payment Summary

Upwork Job

BugZero Checklist (@laurenreidexpensify)

tsa321 commented 6 months ago

@laurenreidexpensify I have accepted the job interview in the upwork. Link: https://www.upwork.com/jobs/~0143fc0e3c3d547cfc

laurenreidexpensify commented 6 months ago

@tsa321 pls accept next step in upwork and i will issue payment thanks