Page MenuHomePhabricator

D9273.diff
No OneTemporary

D9273.diff

diff --git a/native/user-profile/user-profile-relationship-button.react.js b/native/user-profile/user-profile-relationship-button.react.js
--- a/native/user-profile/user-profile-relationship-button.react.js
+++ b/native/user-profile/user-profile-relationship-button.react.js
@@ -33,21 +33,26 @@
pendingPersonalThreadUserInfo,
);
+ const otherUserIsFriend =
+ !otherUserInfo ||
+ !otherUserInfo.username ||
+ otherUserInfo.relationshipStatus === userRelationshipStatus.FRIEND;
+
+ const otherUserSentFriendRequest =
+ otherUserInfo?.relationshipStatus ===
+ userRelationshipStatus.REQUEST_RECEIVED;
+
+ const viewerSentFriendRequest =
+ otherUserInfo?.relationshipStatus === userRelationshipStatus.REQUEST_SENT;
+
const styles = useStyles(unboundStyles);
const userProfileRelationshipButton = React.useMemo(() => {
- if (
- !otherUserInfo ||
- !otherUserInfo.username ||
- otherUserInfo.relationshipStatus === userRelationshipStatus.FRIEND
- ) {
+ if (otherUserIsFriend) {
return null;
}
- if (
- otherUserInfo.relationshipStatus ===
- userRelationshipStatus.REQUEST_RECEIVED
- ) {
+ if (otherUserSentFriendRequest) {
return (
<View style={styles.incomingFriendRequestContainer}>
<Text style={styles.incomingFriendRequestLabel}>
@@ -65,9 +70,7 @@
);
}
- if (
- otherUserInfo.relationshipStatus === userRelationshipStatus.REQUEST_SENT
- ) {
+ if (viewerSentFriendRequest) {
return (
<View style={styles.singleButtonContainer}>
<RelationshipButton type="withdraw" onPress={unfriendUser} />
@@ -81,14 +84,16 @@
</View>
);
}, [
- friendUser,
- otherUserInfo,
- styles.acceptFriendRequestButtonContainer,
- styles.incomingFriendRequestButtonsContainer,
+ otherUserIsFriend,
+ otherUserSentFriendRequest,
+ viewerSentFriendRequest,
+ styles.singleButtonContainer,
styles.incomingFriendRequestContainer,
styles.incomingFriendRequestLabel,
+ styles.incomingFriendRequestButtonsContainer,
+ styles.acceptFriendRequestButtonContainer,
styles.rejectFriendRequestButtonContainer,
- styles.singleButtonContainer,
+ friendUser,
unfriendUser,
]);

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 19, 2:16 AM (21 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2320741
Default Alt Text
D9273.diff (2 KB)

Event Timeline