-
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
Show local time in money request and 1:1 chat threads #26845
Show local time in money request and 1:1 chat threads #26845
Conversation
src/libs/ReportUtils.js
Outdated
// Task reports `managerID` will change when assignee is changed, in that case the old `managerID` is still present in `participantAccountIDs` | ||
// array along with the new one. We only need the `managerID` as a participant here. | ||
if (isTaskReport(report)) { | ||
finalParticipantAccountIDs = [report.managerID]; | ||
} |
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 haven't changed how local time calculation for task reports works. This is because there was some work done in #25534 a few days ago that added this behavior. But for reference, I did include the task report behavior in test videos.
Just for a recap, I originally suggested that we show User A's local time to User B and User B's local time to User A for task reports (along with other suggestions) but #25534 added the behavior that will always show the current task assignee's local time to all users who open the task report. If the assigned user themselves opens the task report they won't see the local time message.
It looks like, for showing local time in Task reports we are giving preference to assigned user
instead of share destination
. So if a User assigns a task to another User, and then opens the task report, they should be able to see the assigned User's local time, regardless of where they share the task.
I believe the current behavior is good but curious as to what you think.
cc: @ArekChr @roryabraham
// In 1:1 chat threads, the participants will be the same as parent report. If a report is specifically a 1:1 chat thread then we will | ||
// get parent report and use its participants array. | ||
if (isThread(report) && !(isTaskReport(report) || isMoneyRequestReport(report))) { | ||
const parentReport = lodashGet(allReports, [`${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID}`]); | ||
if (hasSingleParticipant(parentReport)) { | ||
finalReport = parentReport; | ||
} | ||
} |
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.
Recap: For 1:1 chat threads, we are not showing the local time of User B to User A, until User B replies in User A's thread.
The logic here will show the local time of User B to User A, even if they don't reply in User A's thread. Again this is in case of 1:1 chat b/w User A and User B
Bump @ArekChr |
Bump for review @ArekChr |
Hey @huzaifa-99 I'm ooo since Monday |
Ah Sry, I didn't know. |
I am unsure if Arkadiusz (not tagging intentionally) is back from OOO? I will tag in a day to confirm from them. |
Hey, I'm back, reviewing |
src/libs/ReportUtils.js
Outdated
// Most report types will have the same initial participants | ||
const initialParticipantAccountIDs = lodashGet(finalReport, 'participantAccountIDs'); | ||
|
||
// Most reports like the money request and task reports don't add the `ownerAccountId` in `participantAccountIDs`, for those types of | ||
// reports we will include `ownerAccountId` in the `finalParticipantAccountIDs` array. | ||
let finalParticipantAccountIDs = initialParticipantAccountIDs; | ||
|
||
// For money requests i.e the IOU (1:1 person) and Expense (1:* person) reports, use the full `initialParticipantAccountIDs` array | ||
// and add the `ownerAccountId`. | ||
if (isMoneyRequestReport(report)) { | ||
finalParticipantAccountIDs = _.union(initialParticipantAccountIDs, [report.ownerAccountID]); | ||
} | ||
|
||
// Task reports `managerID` will change when assignee is changed, in that case the old `managerID` is still present in `participantAccountIDs` | ||
// array along with the new one. We only need the `managerID` as a participant here. | ||
if (isTaskReport(report)) { | ||
finalParticipantAccountIDs = [report.managerID]; | ||
} |
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.
For me it works, I think we could simplify this code like this.
// Most report types will have the same initial participants | |
const initialParticipantAccountIDs = lodashGet(finalReport, 'participantAccountIDs'); | |
// Most reports like the money request and task reports don't add the `ownerAccountId` in `participantAccountIDs`, for those types of | |
// reports we will include `ownerAccountId` in the `finalParticipantAccountIDs` array. | |
let finalParticipantAccountIDs = initialParticipantAccountIDs; | |
// For money requests i.e the IOU (1:1 person) and Expense (1:* person) reports, use the full `initialParticipantAccountIDs` array | |
// and add the `ownerAccountId`. | |
if (isMoneyRequestReport(report)) { | |
finalParticipantAccountIDs = _.union(initialParticipantAccountIDs, [report.ownerAccountID]); | |
} | |
// Task reports `managerID` will change when assignee is changed, in that case the old `managerID` is still present in `participantAccountIDs` | |
// array along with the new one. We only need the `managerID` as a participant here. | |
if (isTaskReport(report)) { | |
finalParticipantAccountIDs = [report.managerID]; | |
} | |
let finalParticipantAccountIDs = []; | |
if (isMoneyRequestReport(report)) { | |
// For money requests i.e the IOU (1:1 person) and Expense (1:* person) reports, use the full `initialParticipantAccountIDs` array | |
// and add the `ownerAccountId`. | |
finalParticipantAccountIDs = _.union(lodashGet(finalReport, 'participantAccountIDs'), [report.ownerAccountID]); | |
} else if (isTaskReport(report)) { | |
// Task reports `managerID` will change when assignee is changed, in that case the old `managerID` is still present in `participantAccountIDs` | |
// array along with the new one. We only need the `managerID` as a participant here. | |
finalParticipantAccountIDs = [report.managerID]; | |
} else { | |
// Most reports like the money request and task reports don't add the `ownerAccountId` in `participantAccountIDs`, for those types of | |
// reports we will include `ownerAccountId` in the `finalParticipantAccountIDs` array. | |
finalParticipantAccountIDs = lodashGet(finalReport, 'participantAccountIDs'); | |
} |
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.
Bump @ArekChr |
Reviewer Checklist
Screenshots/VideosMobile Web - Safari |
@huzaifa-99 There are some cases in task thread replies, I don't see the local time of one user. Could you fix that as well? |
@huzaifa-99 Thanks for the recap, it works for me, continuing testing |
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.
Thanks for PR! All works
Bump for review @roryabraham |
Gentle bump for review @roryabraham. |
1 similar comment
Gentle bump for review @roryabraham. |
Bump for review @roryabraham |
|
||
let finalParticipantAccountIDs = []; | ||
if (isMoneyRequestReport(report)) { | ||
// For money requests i.e the IOU (1:1 person) and Expense (1:* person) reports, use the full `initialParticipantAccountIDs` array |
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.
NAB but this is not quite correct as the distinction between IOUs and Expense reports. IOUs are person-to-person while Expense reports are person-to-business.
Also, there are other types of money requests that we haven't added to NewDot yet:
- invoice: business-to-business or business-to-person
- bill: what the recipient sees when they receive an invoice
// For money requests i.e the IOU (1:1 person) and Expense (1:* person) reports, use the full `initialParticipantAccountIDs` array | |
// For money requests, use the full `initialParticipantAccountIDs` array |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/roryabraham in version: 1.3.72-0 🚀
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.3.72-11 🚀
|
Details
Fixed Issues
$ #24228
PROPOSAL: #24228 (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
Chrome:
Web.Chrome.mp4
Safari:
Web.Safari.mp4
Mobile Web - Chrome
mWeb.Chrome.mp4
Mobile Web - Safari
mWeb.Safari.mp4
Desktop
Desktop.Native.mp4
iOS
IOS.Native.mp4
Android
Android.Native.mp4