-
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
Fix the iou request for "unknown" users #24348
Conversation
@thesahindia Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
I think it's already working for split which for some reasons still has the email in the logins, buildOptimisticIOUReport is also used for sendMoney but if I am not mistaken this functionality is disabled. |
PR ready for review |
@parasharrajat Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewed the issue. Reviewing PR now. |
src/libs/actions/IOU.js
Outdated
@@ -315,7 +315,7 @@ function buildOnyxDataForMoneyRequest( | |||
* | |||
*/ | |||
function requestMoney(report, amount, currency, payeeEmail, payeeAccountID, participant, comment, receipt = undefined) { | |||
const payerEmail = OptionsListUtils.addSMSDomainIfPhoneNumber(participant.login); | |||
const payerEmail = OptionsListUtils.addSMSDomainIfPhoneNumber(participant.login || participant.text); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not 100% into this solution. Although it solves this issue it does not solve the root cause. There will be more cases where the same root cause can become another issue.
IMO, we should set the login to the default email for optimistic accounts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you, I had sent this on slack for another issue: https://expensify.slack.com/archives/C01GTK53T8Q/p1690214768266839
I was saying if we create the chat with another user, we know his login already so there is no point in hiding it. It looks like this weird behaviour was intended so I don't know...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the default email that you are referring to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The one that we invited.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what do we decide ? Or who could help deciding ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to see an analysis of alternatives if any. I will give it a thought over weekend and then share update on Monday.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I don't see any alternative if we keep the privacy change as it is
src/libs/ReportUtils.js
Outdated
const formattedTotal = CurrencyUtils.convertToDisplayString(total, currency); | ||
const personalDetails = getPersonalDetailsForAccountID(payerAccountID); | ||
const payerEmail = personalDetails.login; | ||
const payerEmail = personalDetails.login || unknownPayerEmail; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, the concept of unknownPayerEmail does not make sense. You are building an iou and the payer is unknown....
Yeah I can see why this does not look ideal, I think we however need to make a change like this right now and document it better to make it clear why we are doing this. It might be temporary but worth it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ShogunFire @parasharrajat we also need the same fix for Split bill right?
src/libs/ReportUtils.js
Outdated
* @returns {Object} | ||
*/ | ||
function buildOptimisticIOUReport(payeeAccountID, payerAccountID, total, chatReportID, currency, isSendingMoney = false) { | ||
function buildOptimisticIOUReport(payeeAccountID, payerAccountID, total, chatReportID, currency, isSendingMoney = false, unknownPayerEmail = '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets just call it payerEmail, but in the docs explain the situation
function buildOptimisticIOUReport(payeeAccountID, payerAccountID, total, chatReportID, currency, isSendingMoney = false, unknownPayerEmail = '') { | |
function buildOptimisticIOUReport(payeeAccountID, payerAccountID, total, chatReportID, currency, isSendingMoney = false, payerEmail = '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already a payerEmail variable in the function, checking if we need it now
̶I̶ ̶t̶h̶i̶n̶k̶ ̶y̶e̶s̶.̶ ̶A̶c̶t̶u̶a̶l̶l̶y̶ ̶I̶ ̶w̶a̶n̶t̶e̶d̶ ̶t̶o̶ ̶r̶e̶v̶e̶r̶i̶f̶y̶ ̶t̶h̶i̶s̶ ̶b̶u̶t̶ ̶t̶h̶e̶r̶e̶ ̶s̶e̶e̶m̶s̶ ̶t̶o̶ ̶b̶e̶ ̶a̶n̶o̶t̶h̶e̶r̶ ̶e̶r̶r̶o̶r̶ ̶r̶i̶g̶h̶t̶ ̶n̶o̶w̶ ̶w̶h̶e̶n̶ ̶w̶e̶ ̶s̶p̶l̶i̶t̶ ̶b̶i̶l̶l̶ ̶w̶i̶t̶h̶ ̶u̶n̶k̶n̶o̶w̶n̶ ̶u̶s̶e̶r̶s̶ ̶d̶u̶e̶ ̶t̶o̶ ̶f̶o̶r̶m̶a̶t̶i̶n̶g̶ ̶"̶u̶s̶e̶r̶1̶ ̶a̶n̶d̶ ̶u̶s̶e̶r̶ ̶2̶"̶ ̶w̶h̶e̶n̶ ̶t̶h̶e̶y̶ ̶d̶o̶n̶'̶t̶ ̶h̶a̶v̶e̶ ̶l̶o̶g̶i̶n̶ ̶h̶e̶r̶e̶:̶ ̶h̶t̶t̶p̶s̶:̶/̶/̶g̶i̶t̶h̶u̶b̶.̶c̶o̶m̶/̶E̶x̶p̶e̶n̶s̶i̶f̶y̶/̶A̶p̶p̶/̶b̶l̶o̶b̶/̶e̶3̶0̶7̶4̶c̶4̶9̶a̶7̶9̶3̶8̶b̶9̶d̶9̶7̶8̶b̶4̶8̶7̶2̶1̶f̶d̶b̶a̶d̶d̶8̶9̶8̶0̶b̶f̶6̶4̶4̶/̶s̶r̶c̶/̶l̶i̶b̶s̶/̶a̶c̶t̶i̶o̶n̶s̶/̶I̶O̶U̶.̶j̶s̶#̶L̶6̶1̶5̶-̶L̶6̶1̶7̶ ̶ EDIT: I was looking at prod but this has already been fixed in main Anyways I will Make the change because yes I think it's necessary |
Yep I think thats highly possible and we should try to make it safely accessed so it looks fine at the same time |
Ok I made some changes, I made payerEmail required parameter and removed the one that was in the function, tell me what you think. Also I am not sure why this PR still thinks there is conflict, I think I resolved them already |
@dukenv0307 has a good point here: #23038 (comment) That method doesn't work if the user changed his display name. I have another sketchy method that seem to work for all users, Lines 1789 to 1794 in 5a373bf
If we don't want to put it in the login field (to not have to display it) we will have to create another field |
Otherwise I recommend this but it would take way more effort and time: "I have a proposition about the privacy change that is causing so many issues. Why don't we create another field email or privateLogin that we will never display and if needed we can even encrypted it so that it doesn't appear in the network. And use that field to do all the things that we are currently doing with the login field" |
Argh I hate this thing, I think we discussed this couple of times but it was deprioritized. could we maybe just Blcok requesting money from chat with user where we dont have email, ie you can request from Global create from anyone but you cannot keep requesting until that perosn responds to you within the chat |
…ave login because we would not be able to send payerEmail easily Signed-off-by: Pierre Michel <[email protected]>
441b829
to
b657c8c
Compare
I made the change |
There seems to have an issue, when we create a chat with a unknown user the money request option is showing for a few seconds (probably until the server response) I will try to fix that |
:( so in getOptions we add the login to the userToInviteOption, I don't think it is safe to remove that App/src/libs/OptionsListUtils.js Line 833 in 9a0dd42
So maybe we can also prevent money request if the report is optimistic, is there a reason we don't add isOptimisticReport: true in this method: Line 2199 in 9a0dd42
|
@ShogunFire thanks for trying I think we can hold on this one until we have a clearer plan as it does not seem as ultimately the best direction to head into. |
Can I try one last thing ? I can start implementing this
I don't think I need back end changes, I can just fill the new field optimistically with the login here: App/src/libs/actions/Report.js Lines 496 to 502 in 867d61e
Then for the payerEmail I can use that field instead of login or text here: Line 308 in 40f354b
|
That would not work if you change platforms though but I think that's a good beginning |
the best solution so far is to update those flows to work with |
The accountIDs created optimistically and returned by the backend can be different right ? Then I don't know how making iou request offline based on something that can change would work. Anyways, seems like there is not much I can do right now if we go with that option |
@ShogunFire you are right, that is one of the challenges there |
This is the issue #22480 |
I think we would have to use both email and accountID. AccountID would be a fallback, when you are creating this offline you know the email so you can use that, then once you sign out and sign back in you had to be online and you had to get the correct accountID |
Honestly it doesn't seem like a pretty solution. I feel like the privacy change should have just been a display issue. Not displaying the login, but still using it. I would personally prefer to have an email field that we would never display or a boolean shouldDisplayLogin field. It would require way less changes and seems like an easier solution. |
this would not prevent people from just scraping the contact details from the public chat rooms, we cannot return this data from BE |
Even if we encrypt it ? |
I think that was one of the options when the project was planned but it was not chosen for reasons I am not familiar with |
Lets close this PR for now @ShogunFire thanks for your work, we can discuss a partial reward in the issue |
Details
Due to the privacy changes, the login is null for users that haven't sent message to us so when we made an iou request the payerEmail sent to the api was null which was creating an error. Since we are actively creating a request or creating a chat with this user using his email/phone, we can use that as the payerEmail when there is no login
Fixed Issues
$ #22884
PROPOSAL: #22884 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
2023-08-09.19-14-26.mp4
Mobile Web - Chrome
2023-08-09.19-23-44.mp4
Mobile Web - Safari
2023-08-09.21-07-38.mp4
Desktop
2023-08-09.21-02-32.mp4
iOS
2023-08-09.20-57-26.mp4
Android
2023-08-10.11-05-47.mp4