Skip to content

Commit

Permalink
Merge pull request #20691 from BeeMargarida/personalDetailsList-migra…
Browse files Browse the repository at this point in the history
…tion-thread-fix

Personal details list migration: fix Thread related bugs
  • Loading branch information
Beamanator authored Jun 13, 2023
2 parents dd3bfd7 + b1add93 commit 3397b76
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,11 +645,11 @@ function hasAutomatedExpensifyAccountIDs(accountIDs) {
* Whether the time row should be shown for a report.
* @param {Array<Object>} personalDetails
* @param {Object} report
* @param {String} login
* @param {Number} accountID
* @return {Boolean}
*/
function canShowReportRecipientLocalTime(personalDetails, report, login) {
const reportParticipants = _.without(lodashGet(report, 'participantAccountIDs', []), login);
function canShowReportRecipientLocalTime(personalDetails, report, accountID) {
const reportParticipants = _.without(lodashGet(report, 'participantAccountIDs', []), accountID);
const participantsWithoutExpensifyAccountIDs = _.difference(reportParticipants, CONST.EXPENSIFY_ACCOUNT_IDS);
const hasMultipleParticipants = participantsWithoutExpensifyAccountIDs.length > 1;
const reportRecipient = personalDetails[participantsWithoutExpensifyAccountIDs[0]];
Expand Down
2 changes: 1 addition & 1 deletion src/libs/UserUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ function getSmallSizeAvatar(avatarURL, accountID) {
* @returns {Number}
*/
function generateAccountID() {
return (Math.floor(Math.random() * 2 ** 21) * 2 ** 32 + Math.floor(Math.random() * 2 ** 32));
return Math.floor(Math.random() * 2 ** 21) * 2 ** 32 + Math.floor(Math.random() * 2 ** 32);
}

export {
Expand Down
7 changes: 5 additions & 2 deletions src/libs/actions/Task.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,11 @@ function reopenTask(taskReportID, taskTitle) {
* @param {object} report
* @param {string} ownerEmail
* @param {Number} ownerAccountID
* @param {{title?: string, description?: string, assignee?:string, assigneeAccountID?:number}} editedTask
* @returns {object} action
* @param {Object} editedTask
* @param {String} editedTask.title
* @param {String} editedTask.description
* @param {String} editedTask.assignee
* @param {Number} editedTask.assigneeAccountID
*/
function editTaskAndNavigate(report, ownerEmail, ownerAccountID, {title, description, assignee, assigneeAccountID = 0}) {
// Create the EditedReportAction on the task
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ class ReportActionCompose extends React.Component {
const participantsWithoutExpensifyAccountIDs = _.difference(reportParticipants, CONST.EXPENSIFY_ACCOUNT_IDS);
const reportRecipient = this.props.personalDetails[participantsWithoutExpensifyAccountIDs[0]];
const shouldShowReportRecipientLocalTime =
ReportUtils.canShowReportRecipientLocalTime(this.props.personalDetails, this.props.report, this.props.currentUserPersonalDetails.login) && !this.props.isComposerFullSize;
ReportUtils.canShowReportRecipientLocalTime(this.props.personalDetails, this.props.report, this.props.currentUserPersonalDetails.accountID) && !this.props.isComposerFullSize;

// Prevents focusing and showing the keyboard while the drawer is covering the chat.
const isBlockedFromConcierge = ReportUtils.chatIncludesConcierge(this.props.report) && User.isBlockedFromConcierge(this.props.blockedFromConcierge);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const ReportActionsList = (props) => {
// Native mobile does not render updates flatlist the changes even though component did update called.
// To notify there something changes we can use extraData prop to flatlist
const extraData = [props.isSmallScreenWidth ? props.newMarkerReportActionID : undefined, ReportUtils.isArchivedRoom(props.report)];
const shouldShowReportRecipientLocalTime = ReportUtils.canShowReportRecipientLocalTime(props.personalDetailsList, props.report, props.currentUserPersonalDetails.login);
const shouldShowReportRecipientLocalTime = ReportUtils.canShowReportRecipientLocalTime(props.personalDetailsList, props.report, props.currentUserPersonalDetails.accountID);
return (
<Animated.View style={[animatedStyles, styles.flex1]}>
<InvertedFlatList
Expand Down

0 comments on commit 3397b76

Please sign in to comment.