Skip to content

Commit

Permalink
Merge pull request #20774 from Expensify/AndrewGable-cherry-pick-stag…
Browse files Browse the repository at this point in the history
…ing-20713

🍒 Cherry pick PR #20713 to staging 🍒
  • Loading branch information
OSBotify authored Jun 14, 2023
2 parents ab83f9d + ddf2e1d commit db671b7
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 32 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 1001032706
versionName "1.3.27-6"
versionCode 1001032707
versionName "1.3.27-7"
}

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.27.6</string>
<string>1.3.27.7</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.27.6</string>
<string>1.3.27.7</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.27-6",
"version": "1.3.27-7",
"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
3 changes: 2 additions & 1 deletion src/components/UserDetailsTooltip/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Tooltip from '../Tooltip';
import {propTypes, defaultProps} from './userDetailsTooltipPropTypes';
import styles from '../../styles/styles';
import ONYXKEYS from '../../ONYXKEYS';
import * as UserUtils from '../../libs/UserUtils';

function UserDetailsTooltip(props) {
const userDetails = lodashGet(props.personalDetailsList, props.accountID, props.fallbackUserDetails);
Expand All @@ -18,7 +19,7 @@ function UserDetailsTooltip(props) {
<View style={styles.emptyAvatar}>
<Avatar
containerStyles={[styles.actionAvatar]}
source={userDetails.avatar}
source={UserUtils.getAvatar(userDetails.avatar, userDetails.login)}
/>
</View>

Expand Down
108 changes: 84 additions & 24 deletions src/libs/actions/PersonalDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,48 @@ function updateAvatar(file) {
},
];

const accountID = lodashGet(personalDetails, [currentUserEmail, 'accountID'], '');
if (accountID) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
value: {
[accountID]: {
avatar: file.uri,
errorFields: {
avatar: null,
},
pendingFields: {
avatar: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
},
},
},
});
successData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
value: {
[accountID]: {
pendingFields: {
avatar: null,
},
},
},
});
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
value: {
[accountID]: {
avatar: personalDetails[currentUserEmail].avatar,
pendingFields: {
avatar: null,
},
},
},
});
}

API.write('UpdateUserAvatar', {file}, {optimisticData, successData, failureData});
}

Expand All @@ -418,34 +460,52 @@ function deleteAvatar() {
// We want to use the old dot avatar here as this affects both platforms.
const defaultAvatar = UserUtils.getDefaultAvatarURL(currentUserEmail);

API.write(
'DeleteUserAvatar',
{},
const optimisticData = [
{
optimisticData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PERSONAL_DETAILS,
value: {
[currentUserEmail]: {
avatar: defaultAvatar,
},
},
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PERSONAL_DETAILS,
value: {
[currentUserEmail]: {
avatar: defaultAvatar,
},
],
failureData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PERSONAL_DETAILS,
value: {
[currentUserEmail]: {
avatar: personalDetails[currentUserEmail].avatar,
},
},
},
},
];
const failureData = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PERSONAL_DETAILS,
value: {
[currentUserEmail]: {
avatar: personalDetails[currentUserEmail].avatar,
},
],
},
},
);
];

const accountID = lodashGet(personalDetails, [currentUserEmail, 'accountID'], '');
if (accountID) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
value: {
[personalDetails[currentUserEmail].accountID]: {
avatar: defaultAvatar,
},
},
});
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
value: {
[personalDetails[currentUserEmail].accountID]: {
avatar: personalDetails[currentUserEmail].avatar,
},
},
});
}

API.write('DeleteUserAvatar', {}, {optimisticData, failureData});
}

/**
Expand Down

0 comments on commit db671b7

Please sign in to comment.