-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[HOLD for payment 2023-09-07] [$1000] Web - Requested money - "Delete" button does not work when attempting to delete requested money after adding a PDF attachment to an IOU. #25589
Comments
ProposalPlease re-state the problem that we are trying to solve in this issue."Delete" button does not work when attempting to delete requested money after adding a PDF attachment to an IOU. What is the root cause of that problem?
In Line 1072 in 03cf0b1
Finally, we cannot delete request money What changes do you think we should make in order to solve the problem?
What alternative solutions did you explore? (Optional)N/A ResultScreencast.from.19-08-2023.14.08.39.webm |
ProposalPlease re-state the problem that we are trying to solve in this issue.What is the root cause of that problem?We check should delete the IOU report here Lines 1077 to 1079 in 4a7558c
In the function getLastVisibleMessage we have a case if the last message is an attachment will return lastMessageTranslationKey App/src/libs/ReportActionsUtils.js Lines 393 to 397 in 03cf0b1
So we missed checking the last message is an attachment In addition, the error also appears here, In case we delete the request money but in the thread of this request money the last message is attachment, and the same error occurs. Lines 1052 to 1053 in 4a7558c
And here we haven't updated Line 1161 in 4a7558c
What changes do you think we should make in order to solve the problem?We should add the conditions if the last message is an attachment:
const lastMessageThead = ReportActionsUtils.getLastVisibleMessage(transactionThreadID);
const iouThreadLastMessageText = lastMessageThead.lastMessageText || lastMessageThead.lastMessageTranslationKey;
const shouldDeleteTransactionThread = transactionThreadID ? iouThreadLastMessageText.length === 0 : false;
const { lastMessageText = '', lastMessageTranslationKey = '' } = ReportActionsUtils.getLastVisibleMessage(iouReport.reportID, updatedReportAction);
const iouReportLastMessageText = lastMessageText || lastMessageTranslationKey;
What alternative solutions did you explore? (Optional)N/A |
ProposalPlease re-state the problem that we are trying to solve in this issue.Cannot delete IOUs which have attachment as last message in their thread What is the root cause of that problem?Here we are finding Line 1045 in 03cf0b1
But if the last message is an attachment getLastVisibleMessage of ReportActionsUtils this hereApp/src/libs/ReportActionsUtils.js Lines 393 to 397 in 03cf0b1
returns only an object containing lastMessageTranslationKey only, so the lastMessageText being non-existent in this object, it is undefined and finding its length throws console error.
What changes do you think we should make in order to solve the problem?We can replace the above line const lastVisibleMessage = ReportActionsUtils.getLastVisibleMessage(transactionThreadID);
const shouldDeleteTransactionThread = transactionThreadID ? !lastVisibleMessage.lastMessageTranslationKey && !lastVisibleMessage.lastMessageText : false; or simply const shouldDeleteTransactionThread = transactionThreadID && !lastVisibleMessage.lastMessageTranslationKey && !lastVisibleMessage.lastMessageText; What alternative solutions did you explore? (Optional)ResultdeleteMoneyRequestWithAnAttachmentAsLastMessage.mov |
ProposalPlease re-state the problem that we are trying to solve in this issue.Money request cannot be deleted when an attachment is sent after it in the transaction report. This occurs not only for PDFs, but for all attachments as well. What is the root cause of that problem?While deleting the IOU, we are checking if there are any other messages in the IOU report and if there are none, we delete the IOU report as well. This can be seen here: Lines 836 to 839 in d53bbf0
But while getting the value of iouReportLastMessageText , we get undefined and then we try to access it's length which causes this error.
We are getting Now, this property is So, in this case, since a pdf is an attachment, there is no What changes do you think we should make in order to solve the problem?Instead of just checking that App/src/libs/actions/Report.js Line 300 in 39ae317
const {lastMessageText = '', lastMessageTranslationKey = ''} = ReportActionsUtils.getLastVisibleMessage(iouReport.reportID, updatedReportAction);
const shouldDeleteIOUReport =
(lastMessageTranslationKey.length === 0 && lastMessageText.length === 0) && !ReportActionsUtils.isDeletedParentAction(lastVisibleAction) && (!transactionThreadID || shouldDeleteTransactionThread);
updatedIOUReport.lastMessageText = lastMessageText; Additional SuggestionThis solution may also be applied to the logic checking Line 812 in 39ae317
Since here too, we are just accessing the What alternative solutions did you explore? (Optional)We can also refactor the function |
Triggered auto assignment to @dylanexpensify ( |
Bug0 Triage Checklist (Main S/O)
|
Hello@izarutskaya, could you kindly update my GitHub username? My username is not @Tewodros Girma, it is @tewodrosGirmaA |
reviewing tomorrow! Got caught up with higher priorities today! |
actioning today! |
Job added to Upwork: https://www.upwork.com/jobs/~011b0f4ca743a481a4 |
Current assignee @dylanexpensify is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @burczu ( |
@burczu, @dylanexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
not overdue - reviewing it now |
I think we should go with the proposal from @namhihi237, because it fixes the issue, and additionally fixes the same problem in the thread. However, the proposal from @DylanDylann also fixes the issue (but without fixing the same in threads) and was posted before @namhihi237's one (the @namhihi237 proposal actually contains @DylanDylann's proposal). So I think we could consider splitting the prize for this issue. The proposal from @c3024 is pretty much the same as the one from @DylanDylann, and the proposal from @esh-g is actually the same as the one from @namhihi237. 🎀 👀 🎀 C+ reviewed |
Triggered auto assignment to @flodnv, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
@DylanDylann and @namhihi237 initially only dealt with messaging in the IOU report only. My solution dealt with messaging inside the thread of transaction only. @namhihi237 edited their proposal later to include the case of transaction thread. |
Hmmm... it's hard to say who was first - it seems like the proposal from @c3024 and the update from @namhihi237 was at same time: |
Their initial proposal did not contain the |
@flodnv What do you think about it? |
Thank you for your proposal @dukenv0307. Indeed, after discussing it, @burczu and I agree that it is the most thoughtful approach, and might very well avoid similar bugs in the future. We will be assigning you to submit a PR. @namhihi237 @DylanDylann @c3024 Even though when proposals aren't accepted, compensation is not issued and remains at the sole discretion of Expensify, we do appreciate your efforts here that ultimately led to the best solution. As such, we will be issuing a $100 payment to each of you to thank you for your time. Please note that this is a one-off recognition and does not set a precedent for such situations in future (or past) issues. |
📣 @dukenv0307 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
@dukenv0307 proposal appears to be a work around. Notwithstanding the backend reply or what is returned here in the Anywhere we use Also the backend returns a simple [Attachment] for th lastMessageText and the proposal is using the key and translating it to local language. So for Spanish, backend returning lastMessageText in English differs from the lastMessageText used here. I think implementing this solution can cause more inconsistencies. Just adding a lastMessageText field to the returning object from the check of attachment in getLastVisibleMessage function instead of fixing the correct use of lastMessageTranslation key in IOU appears to be a bad idea. |
@c3024 Thanks for your comment. I just checked all the places where we use the getLastVisibleMessage function and I see that it is safe to return lastMessageText. Besides, we have another method to get the correct last message text so don't worry about localization |
With this change I think there would be little (or no) purpose left for |
@c3024 Oh no, lastMessageTranslationKey is used for many purposes. You can search lastMessageTranslationKey in the code base and see how we just used it before |
@DylanDylann @c3024 @namhihi237 please apply here for payout! |
Applied. Thanks for the gesture @flodnv @dylanexpensify |
🎯 ⚡️ Woah @burczu / @dukenv0307, great job pushing this forwards! ⚡️ The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉
On to the next one 🚀 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.60-3 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 2023-09-07. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
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:
|
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:
|
paying out now! |
@dukenv0307 @tewodrosGirmaA payments sent! |
done! |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
After adding a PDF attachment to an IOU, the requested money should be deletable as usual.
Actual Result:
Adding a PDF attachment to an IOU causes the "Delete" button to malfunction when attempting to delete requested money.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: v1.3.55-7
Reproducible in staging?: Y
Reproducible in production?: Y
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
Notes/Photos/Videos: Any additional supporting documentation
screen-capture.-.2023-08-11T043711.755.mp4
20230821_201856.mp4
Expensify/Expensify Issue URL:
Issue reported by: @tewodrosGirmaA
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1691753680174959
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: