Fix incorrectly showing friend request as pending

pull/593/head
Maxim Shishmarev 6 years ago
parent 5d2c15fd24
commit 9e6f6d5a01

@ -2067,5 +2067,13 @@
"friendsTab": { "friendsTab": {
"message": "Friends", "message": "Friends",
"description": "friend tab title" "description": "friend tab title"
},
"pending": {
"message": "pending",
"description": "Indicates that a friend request is pending"
},
"notFriends": {
"message": "not friends",
"description": "Indicates that a conversation is not friends with us"
} }
} }

@ -203,9 +203,9 @@
profileName: this.model.getProfileName(), profileName: this.model.getProfileName(),
color: this.model.getColor(), color: this.model.getColor(),
avatarPath: this.model.getAvatarPath(), avatarPath: this.model.getAvatarPath(),
isVerified: this.model.isVerified(), isVerified: this.model.isVerified(),
isKeysPending: !this.model.isFriend(), isFriendRequestPending: this.model.isPendingFriendRequest(),
isFriend: this.model.isFriend(),
isMe: this.model.isMe(), isMe: this.model.isMe(),
isClosable: this.model.isClosable(), isClosable: this.model.isClosable(),
isBlocked: this.model.isBlocked(), isBlocked: this.model.isBlocked(),

@ -1432,6 +1432,11 @@
height: 48px; height: 48px;
} }
.module-conversation-header__title-text {
color: darkgrey;
margin-left: 1em;
}
.module-conversation-header__title-flex { .module-conversation-header__title-flex {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;

@ -37,7 +37,8 @@ interface Props {
hasNickname?: boolean; hasNickname?: boolean;
isBlocked: boolean; isBlocked: boolean;
isKeysPending: boolean; isFriend: boolean;
isFriendRequestPending: boolean;
isOnline?: boolean; isOnline?: boolean;
onSetDisappearingMessages: (seconds: number) => void; onSetDisappearingMessages: (seconds: number) => void;
@ -102,7 +103,9 @@ export class ConversationHeader extends React.Component<Props> {
phoneNumber, phoneNumber,
i18n, i18n,
profileName, profileName,
isKeysPending, isFriend,
isGroup,
isFriendRequestPending,
isMe, isMe,
name, name,
} = this.props; } = this.props;
@ -115,6 +118,18 @@ export class ConversationHeader extends React.Component<Props> {
); );
} }
let text = '';
if (isFriendRequestPending) {
text = `(${i18n('pending')})`;
} else if (!isFriend && !isGroup) {
text = `(${i18n('notFriends')})`;
}
const textEl =
text === '' ? null : (
<span className="module-conversation-header__title-text">{text}</span>
);
return ( return (
<div className="module-conversation-header__title"> <div className="module-conversation-header__title">
<ContactName <ContactName
@ -123,7 +138,7 @@ export class ConversationHeader extends React.Component<Props> {
name={name} name={name}
i18n={i18n} i18n={i18n}
/> />
{isKeysPending ? '(pending)' : null} {textEl}
</div> </div>
); );
} }

Loading…
Cancel
Save