Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3000531
D9273.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9273.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D9273: [native] factor out UserProfileRelationshipButton condtionals
Attached
Detach File
Event Timeline
Log In to Comment