Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrectly showing friend request as pending #593

Merged
merged 1 commit into from Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions _locales/en/messages.json
Expand Up @@ -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"
}
}
4 changes: 2 additions & 2 deletions js/views/conversation_view.js
Expand Up @@ -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(),
Expand Down
5 changes: 5 additions & 0 deletions stylesheets/_modules.scss
Expand Up @@ -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;
Expand Down
21 changes: 18 additions & 3 deletions ts/components/conversation/ConversationHeader.tsx
Expand Up @@ -37,7 +37,8 @@ interface Props {
hasNickname?: boolean;

isBlocked: boolean;
isKeysPending: boolean;
isFriend: boolean;
isFriendRequestPending: boolean;
isOnline?: boolean;

onSetDisappearingMessages: (seconds: number) => void;
Expand Down Expand Up @@ -102,7 +103,9 @@ export class ConversationHeader extends React.Component<Props> {
phoneNumber,
i18n,
profileName,
isKeysPending,
isFriend,
isGroup,
isFriendRequestPending,
isMe,
name,
} = this.props;
Expand All @@ -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
Expand All @@ -123,7 +138,7 @@ export class ConversationHeader extends React.Component<Props> {
name={name}
i18n={i18n}
/>
{isKeysPending ? '(pending)' : null}
{textEl}
</div>
);
}
Expand Down