Merge pull request #593 from msgmaxim/not-friends

Fix incorrectly showing friend request as pending
This commit is contained in:
Maxim Shishmarev 2019-11-01 10:17:31 +11:00 committed by GitHub
commit 6c08852118
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 5 deletions

View file

@ -2067,5 +2067,13 @@
"friendsTab": {
"message": "Friends",
"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"
}
}

View file

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

View file

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

View file

@ -37,7 +37,8 @@ interface Props {
hasNickname?: boolean;
isBlocked: boolean;
isKeysPending: boolean;
isFriend: boolean;
isFriendRequestPending: boolean;
isOnline?: boolean;
onSetDisappearingMessages: (seconds: number) => void;
@ -102,7 +103,9 @@ export class ConversationHeader extends React.Component<Props> {
phoneNumber,
i18n,
profileName,
isKeysPending,
isFriend,
isGroup,
isFriendRequestPending,
isMe,
name,
} = 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 (
<div className="module-conversation-header__title">
<ContactName
@ -123,7 +138,7 @@ export class ConversationHeader extends React.Component<Props> {
name={name}
i18n={i18n}
/>
{isKeysPending ? '(pending)' : null}
{textEl}
</div>
);
}