-
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
[Manual Requests] Create thread for Manual Request when opening IOUPreview #18760
Conversation
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.
Looking good. Just a few minor comments.
console.log({optimisticThreadReport}); | ||
Report.openReport( | ||
optimisticThreadReport.reportID, | ||
[_.reject(optimisticThreadReport.participants, (login) => login === lodashGet(props.session, 'email', ''))], |
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.
Should this be the same as props.chatReport.participants
?
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 wasn't 100% sure since the API param for participants says it shouldn't include the user making the request: https://github.com/Expensify/Web-Expensify/blob/335001f0f64bf449fc884456ef1911cd1e6f17d5/lib/ReportAPI.php#L4404-L4405
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.
okay asked about this here https://expensify.slack.com/archives/C02HWMSMZEC/p1683912289696679?thread_ts=1683911072.385549&cid=C02HWMSMZEC
And looks like it doesn't really matter if we include the user making the request here because in Auth here we make sure to include them and since set
doesn't allow duplicates we are fine https://github.com/Expensify/Auth/blob/dbd779f7c423a82d4871d6dc076ecb37406fb43c/auth/command/OpenReport.cpp#L77
…will do this for us
Okay I addressed all the comments but for some reason I'm still unsure why the optimistic report object that is being passed to OpenReport isn't leading to the data in the DB being set properly.
The thread does get created though which is our main goal here
when testing this I've had to manually delete the data from the DB and also out of the localDB by searching I have to sign off for now so if someone can take this over that would be great. I don't expect to be online Monday but if I am able to then I'll let people know. |
); | ||
console.log({optimisticThreadReport}); | ||
Report.openReport(optimisticThreadReport.reportID, optimisticThreadReport.participants, optimisticThreadReport); | ||
} | ||
if (hasMultipleParticipants) { | ||
Navigation.navigate(ROUTES.getReportParticipantsRoute(props.chatReportID)); |
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.
Note that I think in order to get the newly created thread to show up we'll need to have something like GetChats triggered OR navigate to the report here in this section.
@Julesssss and @luacmartins had mentioned that this might be in the works else where as well but I'm not sure of a GH or anything for it.
If nothing changes here with these routes then the modal will continue to open instead of going to the thread.
This comment was marked as resolved.
This comment was marked as resolved.
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.
Looking good! We'll also need to update the thread report to display the MoneyRequestHeader
component
const participants = _.uniq([props.session.email, props.action.actorEmail]); | ||
const formattedUserLogins = _.map(participants, (login) => OptionsListUtils.addSMSDomainIfPhoneNumber(login).toLowerCase()); | ||
const thread = ReportUtils.buildOptimisticChatReport( | ||
formattedUserLogins, | ||
props.translate('iou.threadReportName', { | ||
formattedAmount: CurrencyUtils.convertToDisplayString(lodashGet(props.action, 'originalMessage.amount', 0), lodashGet(props.action, 'originalMessage.currency', '')), | ||
comment: props.action.originalMessage.comment, | ||
}), | ||
'', | ||
CONST.POLICY.OWNER_EMAIL_FAKE, | ||
CONST.POLICY.OWNER_EMAIL_FAKE, | ||
false, | ||
'', | ||
undefined, | ||
CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, | ||
props.action.reportActionID, | ||
props.chatReportID, // Needs to be changed to iouReportID | ||
); |
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.
Yea, we should create an utils method. Seems ok to leave it for now given that this is blocking other issues
// If the childReportID is not present, we need to create a new thread | ||
const childReportID = lodashGet(props.action, 'childReportID', '0'); | ||
if (childReportID === '0') { | ||
const participants = _.uniq([props.session.email, props.action.actorEmail]); |
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.
Can we just filter those out?
@fedirjh can you try on a fresh account? with all these fast changes there might be something stale :/ |
@mountiny hmm on staging this is working well. Seems like using the staging server locally fix it. Updating the PR checklist shorlty |
Lovely, thanks! |
Wahoo, thanks a lot @fedirjh! ❤️ We're hoping to get this one merged today to unblock a couple of other PRs for EC3. 🙏 |
Reviewer Checklist
Screenshots/VideosWebDesktop.movMobile Web - ChromeScreen.Recording.2023-05-15.at.6.25.12.PM.movOfflineScreen.Recording.2023-05-15.at.6.58.45.PM.movDesktopScreen.Recording.2023-05-15.at.6.18.46.PM.mov |
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.
LGTM and tests well.
@fedirjh thank you! @luacmartins lets merge this and handle the rest in follow up PRs. |
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.
LGTM! As discussed, we need a followup to use the right report header for transaction threads
[Manual Requests] Create thread for Manual Request when opening IOUPreview (cherry picked from commit b744bd3)
…-18760 🍒 Cherry pick PR #18760 to staging 🍒
🚀 Cherry-picked to staging by https://github.com/luacmartins in version: 1.3.14-6 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.3.14-14 🚀
|
🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 1.3.28-2 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/AndrewGable in version: 1.3.28-5 🚀
|
comment: props.action.originalMessage.comment, | ||
}), | ||
'', | ||
CONST.POLICY.OWNER_EMAIL_FAKE, |
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.
Coming from IOU - Workspace avatar shows 'U' avatar before reverting to actual avatar in IOU view:
We could use real policyID from iouReport to avoid flickering in offline mode.
lodashGet(props.iouReport, 'policyID', CONST.POLICY.OWNER_EMAIL_FAKE)
Details
This will create a thread for a Manual Request if one does not exist yet when a user click to open a Manual Request.
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/278887
$ https://github.com/Expensify/Expensify/issues/270591
Tests
$10 request for lunch
Offline tests
QA Steps
Same as tests
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
web.mp4
Mobile Web - Chrome
Cant sign in on mWeb android locally for some reason, dont want to hold on this though tried to figure out but its happening on main too
Mobile Web - Safari
iosweb.mov
Desktop
web.mp4
iOS
ios.mp4
Android
android.mp4