Skip to content

Commit

Permalink
Merge pull request #21033 from Expensify/OSBotify-cherry-pick-staging…
Browse files Browse the repository at this point in the history
…-21026

🍒 Cherry pick PR #21026 to staging 🍒
  • Loading branch information
OSBotify authored Jun 19, 2023
2 parents c6de102 + b158557 commit 4b765fc
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 33 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001032901
versionName "1.3.29-1"
versionCode 1001032902
versionName "1.3.29-2"
}

splits {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.3.29.1</string>
<string>1.3.29.2</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.3.29.1</string>
<string>1.3.29.2</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.3.29-1",
"version": "1.3.29-2",
"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.",
Expand Down
5 changes: 2 additions & 3 deletions src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import MenuItemWithTopDescription from './MenuItemWithTopDescription';
import Navigation from '../libs/Navigation/Navigation';
import optionPropTypes from './optionPropTypes';
import * as CurrencyUtils from '../libs/CurrencyUtils';
import * as ReportUtils from '../libs/ReportUtils';

const propTypes = {
/** Callback to inform parent modal of success */
Expand Down Expand Up @@ -234,10 +233,10 @@ function MoneyRequestConfirmationList(props) {
* @param {Object} option
*/
const navigateToUserDetail = (option) => {
if (!option.login) {
if (!option.accountID) {
return;
}
Navigation.navigate(ROUTES.getProfileRoute(ReportUtils.getAccountIDForLogin(option.login)));
Navigation.navigate(ROUTES.getProfileRoute(option.accountID));
};

/**
Expand Down
8 changes: 4 additions & 4 deletions src/components/MultipleAvatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function MultipleAvatars(props) {
if (props.icons.length === 1 && !props.shouldStackHorizontally) {
return (
<UserDetailsTooltip
accountID={ReportUtils.getAccountIDForLogin(props.icons[0].name)}
accountID={props.icons[0].id}
fallbackUserDetails={{
displayName: ReportUtils.getDisplayNameForParticipant(props.icons[0].name),
login: lodashGet(props.icons[0], 'name', tooltipTexts[0]),
Expand Down Expand Up @@ -124,7 +124,7 @@ function MultipleAvatars(props) {
{_.map([...props.icons].splice(0, 4), (icon, index) => (
<UserDetailsTooltip
key={`stackedAvatars-${index}`}
accountID={ReportUtils.getAccountIDForLogin(icon.name)}
accountID={icon.id}
>
<View
style={[
Expand Down Expand Up @@ -183,7 +183,7 @@ function MultipleAvatars(props) {
</>
) : (
<View style={singleAvatarStyles}>
<UserDetailsTooltip accountID={ReportUtils.getAccountIDForLogin(props.icons[0].name)}>
<UserDetailsTooltip accountID={props.icons[0].id}>
{/* View is necessary for tooltip to show for multiple avatars in LHN */}
<View>
<Avatar
Expand All @@ -198,7 +198,7 @@ function MultipleAvatars(props) {
</UserDetailsTooltip>
<View style={secondAvatarStyles}>
{props.icons.length === 2 ? (
<UserDetailsTooltip accountID={ReportUtils.getAccountIDForLogin(props.icons[1].name)}>
<UserDetailsTooltip accountID={props.icons[1].id}>
<View>
<Avatar
source={props.icons[1].source || props.fallbackIcon}
Expand Down
1 change: 1 addition & 0 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ function getAvatarsForAccountIDs(accountIDs, personalDetails) {
return _.map(accountIDs, (accountID) => {
const userPersonalDetail = lodashGet(personalDetails, accountID, {login: '', accountID, avatar: ''});
return {
id: accountID,
source: UserUtils.getAvatar(userPersonalDetail.avatar, userPersonalDetail.accountID),
type: CONST.ICON_TYPE_AVATAR,
name: userPersonalDetail.login,
Expand Down
28 changes: 9 additions & 19 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,22 +684,24 @@ function getIconsForParticipants(participants, personalDetails) {
const accountID = participantsList[i];
const avatarSource = UserUtils.getAvatar(lodashGet(personalDetails, [accountID, 'avatar'], ''), accountID);
participantDetails.push([
accountID,
lodashGet(personalDetails, [accountID, 'login'], lodashGet(personalDetails, [accountID, 'displayName'], '')),
lodashGet(personalDetails, [accountID, 'firstName'], ''),
avatarSource,
]);
}

// Sort all logins by first name (which is the second element in the array)
const sortedParticipantDetails = participantDetails.sort((a, b) => a[1] - b[1]);
const sortedParticipantDetails = participantDetails.sort((a, b) => a[2] - b[2]);

// Now that things are sorted, gather only the avatars (third element in the array) and return those
const avatars = [];
for (let i = 0; i < sortedParticipantDetails.length; i++) {
const userIcon = {
source: sortedParticipantDetails[i][2],
id: sortedParticipantDetails[i][0],
source: sortedParticipantDetails[i][3],
type: CONST.ICON_TYPE_AVATAR,
name: sortedParticipantDetails[i][0],
name: sortedParticipantDetails[i][1],
};
avatars.push(userIcon);
}
Expand Down Expand Up @@ -728,11 +730,6 @@ function getIcons(report, personalDetails, defaultIcon = null, isPayer = false)
result.source = defaultIcon || Expensicons.FallbackAvatar;
return [result];
}
if (isConciergeChatReport(report)) {
result.source = CONST.CONCIERGE_ICON_URL;
result.name = CONST.EMAIL.CONCIERGE;
return [result];
}
if (isArchivedRoom(report)) {
result.source = Expensicons.DeletedRoomAvatar;
return [result];
Expand All @@ -743,6 +740,7 @@ function getIcons(report, personalDetails, defaultIcon = null, isPayer = false)
const actorEmail = lodashGet(parentReportAction, 'actorEmail', '');
const actorAccountID = lodashGet(parentReportAction, 'actorAccountID', '');
const actorIcon = {
id: actorAccountID,
source: UserUtils.getAvatar(lodashGet(personalDetails, [actorAccountID, 'avatar']), actorAccountID),
name: actorEmail,
type: CONST.ICON_TYPE_AVATAR,
Expand All @@ -753,6 +751,7 @@ function getIcons(report, personalDetails, defaultIcon = null, isPayer = false)
if (isTaskReport(report)) {
const ownerEmail = report.ownerEmail || '';
const ownerIcon = {
id: report.ownerAccountID,
source: UserUtils.getAvatar(lodashGet(personalDetails, [report.ownerAccountID, 'avatar']), report.ownerAccountID),
name: ownerEmail,
type: CONST.ICON_TYPE_AVATAR,
Expand Down Expand Up @@ -790,6 +789,7 @@ function getIcons(report, personalDetails, defaultIcon = null, isPayer = false)
}

const adminIcon = {
id: report.ownerAccountID,
source: UserUtils.getAvatar(lodashGet(personalDetails, [report.ownerAccountID, 'avatar']), report.ownerAccountID),
name: report.ownerEmail,
type: CONST.ICON_TYPE_AVATAR,
Expand All @@ -810,6 +810,7 @@ function getIcons(report, personalDetails, defaultIcon = null, isPayer = false)
const accountID = isPayer ? report.managerID : report.ownerAccountID;
return [
{
id: accountID,
source: UserUtils.getAvatar(lodashGet(personalDetails, [accountID, 'avatar']), accountID),
name: email,
type: CONST.ICON_TYPE_AVATAR,
Expand Down Expand Up @@ -845,16 +846,6 @@ function getPersonalDetailsForAccountID(accountID) {
);
}

/**
* Gets the accountID for a login by looking in the ONYXKEYS.PERSONAL_DETAILS Onyx key (stored in the local variable, allPersonalDetails). If it doesn't exist in Onyx,
* then an empty string is returned.
* @param {String} login
* @returns {String}
*/
function getAccountIDForLogin(login) {
return lodashGet(allPersonalDetails, [login, 'accountID'], '');
}

/**
* Get the displayName for a single report participant.
*
Expand Down Expand Up @@ -2252,7 +2243,6 @@ function getParentReport(report) {
}

export {
getAccountIDForLogin,
getReportParticipantsTitle,
isReportMessageAttachment,
findLastAccessedReport,
Expand Down
1 change: 1 addition & 0 deletions src/pages/ReportParticipantsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const getAllParticipants = (report, personalDetails) => {
accountID: userPersonalDetail.accountID,
icons: [
{
id: accountID,
source: UserUtils.getAvatar(userPersonalDetail.avatar, accountID),
name: userLogin,
type: CONST.ICON_TYPE_AVATAR,
Expand Down

0 comments on commit 4b765fc

Please sign in to comment.