diff --git a/android/app/build.gradle b/android/app/build.gradle index 37a687a3b525..f1434aef4763 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -152,8 +152,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001013302 - versionName "1.1.33-2" + versionCode 1001013303 + versionName "1.1.33-3" } splits { abi { diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index ea6489b9be3a..77901e778c74 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -31,7 +31,7 @@ CFBundleVersion - 1.1.33.2 + 1.1.33.3 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index 4b4b6e142453..66dc85f77cb3 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.1.33.2 + 1.1.33.3 diff --git a/package-lock.json b/package-lock.json index 5ad93e8fd0d6..03b5860e3660 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.1.33-2", + "version": "1.1.33-3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1bb1d71a3b1f..f5b9c0ff0e32 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.1.33-2", + "version": "1.1.33-3", "author": "Expensify, Inc.", "homepage": "https://new.expensify.com", "description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.", diff --git a/src/libs/actions/PersonalDetails.js b/src/libs/actions/PersonalDetails.js index aaeb85f953d9..22453fcd4ee9 100644 --- a/src/libs/actions/PersonalDetails.js +++ b/src/libs/actions/PersonalDetails.js @@ -8,6 +8,7 @@ import CONST from '../../CONST'; import NetworkConnection from '../NetworkConnection'; import * as API from '../API'; import NameValuePair from './NameValuePair'; +import * as ReportUtils from '../reportUtils'; import * as OptionsListUtils from '../OptionsListUtils'; import Growl from '../Growl'; import * as Localize from '../Localize'; @@ -145,7 +146,6 @@ function fetchPersonalDetails() { * Get personal details from report participants. * * @param {Object} reports - * @returns {Promise} */ function getFromReportParticipants(reports) { const participantEmails = _.chain(reports) @@ -155,10 +155,10 @@ function getFromReportParticipants(reports) { .value(); if (participantEmails.length === 0) { - return Promise.resolve({}); + return; } - return API.PersonalDetails_GetForEmails({emailList: participantEmails.join(',')}) + API.PersonalDetails_GetForEmails({emailList: participantEmails.join(',')}) .then((data) => { const existingDetails = _.pick(data, participantEmails); @@ -173,7 +173,36 @@ function getFromReportParticipants(reports) { const formattedPersonalDetails = formatPersonalDetails(details); Onyx.merge(ONYXKEYS.PERSONAL_DETAILS, formattedPersonalDetails); - return details; + + // The personalDetails of the participants contain their avatar images. Here we'll go over each + // report and based on the participants we'll link up their avatars to report icons. This will + // skip over default rooms which aren't named by participants. + const reportsToUpdate = {}; + _.each(reports, (report) => { + if (report.participants.length <= 0 && !ReportUtils.isChatRoom(report)) { + return; + } + + const avatars = OptionsListUtils.getReportIcons(report, details); + const reportName = ReportUtils.isChatRoom(report) + ? report.reportName + : _.chain(report.participants) + .filter(participant => participant !== currentUserEmail) + .map(participant => lodashGet( + formattedPersonalDetails, + [participant, 'displayName'], + participant, + )) + .value() + .join(', '); + + reportsToUpdate[`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`] = {icons: avatars, reportName}; + }); + + // We use mergeCollection such that it updates ONYXKEYS.COLLECTION.REPORT in one go. + // Any withOnyx subscribers to this key will also receive the complete updated props just once + // than updating props for each report and re-rendering had merge been used. + Onyx.mergeCollection(ONYXKEYS.COLLECTION.REPORT, reportsToUpdate); }); } diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index c59451bb78aa..aff30887392d 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -320,39 +320,6 @@ function fetchIOUReportID(debtorEmail) { }); } -function configureReportNameAndIcon(reports, details) { - // The personalDetails of the participants contain their avatar images. Here we'll go over each - // report and based on the participants we'll link up their avatars to report icons. This will - // skip over default rooms which aren't named by participants. - - const reportsToUpdate = {}; - _.each(reports, (report) => { - if (report.participants.length <= 0 && !ReportUtils.isChatRoom(report)) { - return; - } - - const avatars = ReportUtils.isChatRoom(report) ? (['']) : OptionsListUtils.getReportIcons(report, details); - const reportName = ReportUtils.isChatRoom(report) - ? report.reportName - : _.chain(report.participants) - .filter(participant => participant !== currentUserEmail) - .map(participant => lodashGet( - details, - [participant, 'displayName'], - participant, - )) - .value() - .join(', '); - - reportsToUpdate[`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`] = {icons: avatars, reportName}; - }); - - // We use mergeCollection such that it updates ONYXKEYS.COLLECTION.REPORT in one go. - // Any withOnyx subscribers to this key will also receive the complete updated props just once - // than updating props for each report and re-rendering had merge been used. - Onyx.mergeCollection(ONYXKEYS.COLLECTION.REPORT, reportsToUpdate); -} - /** * Fetches chat reports when provided a list of chat report IDs. * If the shouldRedirectIfInaccessible flag is set, we redirect to the Concierge chat @@ -433,12 +400,8 @@ function fetchChatReportsByIDs(chatList, shouldRedirectIfInaccessible = false) { Onyx.mergeCollection(ONYXKEYS.COLLECTION.REPORT_IOUS, reportIOUData); Onyx.mergeCollection(ONYXKEYS.COLLECTION.REPORT, simplifiedReports); - const simplifiedReportsList = _.values(simplifiedReports); - // Fetch the personal details if there are any - PersonalDetails.getFromReportParticipants(simplifiedReportsList) - .then(details => configureReportNameAndIcon(simplifiedReportsList, details)); - + PersonalDetails.getFromReportParticipants(_.values(simplifiedReports)); return fetchedReports; }) .catch((err) => {