-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[AWAITING CHECKLIST] [HOLD for payment 2025-02-06] [$125] Split expense should not be the first option in the create menu from a Workspace chat #55205
Comments
Triggered auto assignment to @garrettmknight ( |
🚨 Edited by proposal-police: This proposal was edited at 2025-01-20 17:00:20 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Split expense should not be the first option in the create menu from a Workspace chat What is the root cause of that problem?Lines 7285 to 7300 in 328ca8a
In getMoneyRequestOptions, we are putting the What changes do you think we should make in order to solve the problem?In Line 7285 in 328ca8a
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?We should move this block to an util function to get moneyRequestOptions
And then, need to write an unit test to make sure that the order of options is correct What alternative solutions did you explore? (Optional) |
@garrettmknight I think we should consider halving or quartering the price on this one, since it should be a very simple change. |
ProposalPlease re-state the problem that we are trying to solve in this issue.Split expense is shown above Submit expense What is the root cause of that problem?getMoneyRequestOptions returns the list of money request options and split expense is above submit expense in this. Lines 7149 to 7178 in 89a18c6
What changes do you think we should make in order to solve the problem?Update getMoneyRequestOptions to return submit exepnse first.
I think we should also replace What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?Add unit test to check submit expense is first when an applicable workspace chat is passed to getMoneyRequestOptions or temporary_getMoneyRequestOptions What alternative solutions did you explore? (Optional)Add sortOrder property here then sort using that property here Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job. |
@shawnborton just wanted to confirm if it is fine to have split expense below track expense because the logic for submit and track is kinda tied together for workspaces.
|
🚨 Edited by proposal-police: This proposal was edited at 2025-01-16 17:21:00 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Split expense should not be the first option in the create menu from a Workspace chat What is the root cause of that problem?Split Expense is above Submit Expense here: Lines 7272 to 7283 in 0e7af01
What changes do you think we should make in order to solve the problem?If we only want to move the Submit Expense to the first option we can do the following:
If we want to move Submit Expense, Request Expense, & Track Expense above Split Expense we can do the following:
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?Create new test to check if the Submit Expense is on the first option if the user can submit an expense It should be a unit test under this to check temporary_getMoneyRequestOptions function return a data with first value in the options data is submit expense if it is user's own policy expense chat or we can simply add expect(moneyRequestOptions[0]).toBe(CONST.IOU.TYPE.SUBMIT); here What alternative solutions did you explore? (Optional) |
📣 @misamikasa! 📣
|
This comment has been minimized.
This comment has been minimized.
✅ Contributor details stored successfully. Thank you for contributing to Expensify! |
🚨 Edited by proposal-police: This proposal was edited at 2025-01-14 14:18:06 UTC. 🚨 Edited by proposal-police: This proposal was edited at 2025-01-14 14:18:06 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Split expense should not be the first option in the create menu from a Workspace chat What is the root cause of that problem?Split expense alway on above submit/create/track expense by this code Line 7274 in 6f446da
What changes do you think we should make in order to solve the problem?To update this issue we will update return split expense option bellow submit/create/track expense Line 7235 in 6f446da
update to function getMoneyRequestOptions(report: OnyxEntry<Report>, policy: OnyxEntry<Policy>, reportParticipants: number[], filterDeprecatedTypes = false): IOUType[] {
// In any thread or task report, we do not allow any new expenses yet
if (isChatThread(report) || isTaskReport(report) || isInvoiceReport(report) || isSystemChat(report) || isArchivedReport(report)) {
return [];
}
if (isInvoiceRoom(report)) {
if (canSendInvoiceFromWorkspace(policy?.id) && isPolicyAdmin(report?.policyID, allPolicies)) {
return [CONST.IOU.TYPE.INVOICE];
}
return [];
}
// We don't allow IOU actions if an Expensify account is a participant of the report, unless the policy that the report is on is owned by an Expensify account
const doParticipantsIncludeExpensifyAccounts = lodashIntersection(reportParticipants, CONST.EXPENSIFY_ACCOUNT_IDS).length > 0;
const policyOwnerAccountID = getPolicy(report?.policyID)?.ownerAccountID;
const isPolicyOwnedByExpensifyAccounts = policyOwnerAccountID ? CONST.EXPENSIFY_ACCOUNT_IDS.includes(policyOwnerAccountID) : false;
if (doParticipantsIncludeExpensifyAccounts && !isPolicyOwnedByExpensifyAccounts) {
return [];
}
const otherParticipants = reportParticipants.filter((accountID) => currentUserPersonalDetails?.accountID !== accountID);
const hasSingleParticipantInReport = otherParticipants.length === 1;
let options: IOUType[] = [];
if (isSelfDM(report)) {
options = [CONST.IOU.TYPE.TRACK];
}
// Determine if the report supports SPLIT expense or should reset options
const hasOtherParticipants = otherParticipants.length > 0;
const isEligibleForSplitExpense =
(isChatRoom(report) && !isAnnounceRoom(report) && hasOtherParticipants) ||
(isDM(report) && hasOtherParticipants) ||
(isGroupChat(report) && hasOtherParticipants) ||
(isPolicyExpenseChat(report) && report?.isOwnPolicyExpenseChat);
if (isEligibleForSplitExpense) {
options = [];
}
if (canRequestMoney(report, policy, otherParticipants)) {
options.push(CONST.IOU.TYPE.SUBMIT);
if (!filterDeprecatedTypes) {
options.push(CONST.IOU.TYPE.REQUEST);
}
// Add TRACK option for workspace or expense reports
if (isPolicyExpenseChat(report) || isExpenseReport(report)) {
options.push(CONST.IOU.TYPE.TRACK);
}
}
// Add SPLIT option for eligible reports
if (isEligibleForSplitExpense) {
options.push(CONST.IOU.TYPE.SPLIT);
}
// Pay someone option should be visible only in 1:1 DMs
if (isDM(report) && hasSingleParticipantInReport) {
options = [...options, CONST.IOU.TYPE.PAY];
if (!filterDeprecatedTypes) {
options = [...options, CONST.IOU.TYPE.SEND];
}
}
return options;
} What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?we create test to check return options data of getMoneyRequestOptions What alternative solutions did you explore? (Optional)Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job. |
@huult Please check your "Restate the problem" section. Not sure how this damages expensify cards 😅 |
Yes I think that's totally fine. |
Job added to Upwork: https://www.upwork.com/jobs/~021879250726854737335 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh ( |
Thank you for making proposals everyone. |
@thelullabyy it seems your solution is incorrect. Could you check it again? |
@jaydamani can you elaborate on this propose? Why do we need to split an array? Thank you. |
@misamikasa your proposal looks good as a new contributor. Can you elaborate it is a unit test for a function or UI tests? |
@huult Please check your "re-state the problem" section, it looks incorrect. Also, can you elaborate why we need to reset options in this case? |
it's done
old Lines 7268 to 7275 in 6f446da
Resetting options with options = [] when isEligibleForSplitExpense ensures that previously added options are cleared. This avoids conflicts or incorrect options being displayed in reports eligible for SPLIT expenses. |
It was meant to be push, I have updated the proposal. This is mostly for code readability as |
@thelullabyy your proposal has correct RCA. But your solution has an issue, it should be |
@misamikasa your proposal has correct RCA and solution for me. But it seems it's almost the same approach as @jaydamani's proposal |
@jaydamani proposal looks good to me. He is first one who provided correct root cause, solution and automated tests. Link to proposal #55205 (comment) 🎀👀🎀 C+ reviewed |
Triggered auto assignment to @madmax330, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
📣 @jaydamani 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
Working on this, PR should be up in few hours |
created PR #55634 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.91-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2025-02-06. 🎊 For reference, here are some details about the assignees on this issue:
|
@hoangzinh @garrettmknight @hoangzinh The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button] |
Upwork job price has been updated to $125 |
@jaydamani can you fill out the checklist when you get a chance? |
@garrettmknight @hoangzinh is the C+ for this. I am the contributor. Is there a checklist for contributors? :D |
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.84-6
Reproducible in staging?: y
Reproducible in production?: y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
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: @shawnborton
Slack conversation (hyperlinked to channel name): convert
Action Performed:
Expected Result:
First option should be "Submit expense"
Actual Result:
First option is "Split expense"
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @garrettmknightThe text was updated successfully, but these errors were encountered: