-
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
Changes from 1 commit
0be9688
0c5d253
24e0a47
723b331
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -833,8 +833,36 @@ function hasAutomatedExpensifyAccountIDs(accountIDs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* @returns {Array} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function getReportRecipientAccountIDs(report, currentLoginAccountID) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const participantAccountIDs = isTaskReport(report) ? [report.managerID] : lodashGet(report, 'participantAccountIDs'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const reportParticipants = _.without(participantAccountIDs, currentLoginAccountID); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
let finalReport = report; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 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; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 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 commentThe 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 I believe the current behavior is good but curious as to what you think. cc: @ArekChr @roryabraham There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const reportParticipants = _.without(finalParticipantAccountIDs, currentLoginAccountID); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const participantsWithoutExpensifyAccountIDs = _.difference(reportParticipants, CONST.EXPENSIFY_ACCOUNT_IDS); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return participantsWithoutExpensifyAccountIDs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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