Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 93529d3

Browse files
committed
fix: don't add link when non-existent user invited
ref issue #135
1 parent eaf780b commit 93529d3

File tree

4 files changed

+28
-18
lines changed

4 files changed

+28
-18
lines changed

src/components/User/index.jsx

+22-15
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,32 @@ import { TOPCODER_COMMUNITY_WEBSITE_URL } from "../../../config";
1212
import IconDirectArrow from "../../assets/images/icon-direct-arrow.svg";
1313
import { Link } from "@reach/router";
1414

15-
const User = ({ showArrow, user, hideFullName = false, handleLinkTo }) => {
15+
const User = ({ showArrow, user, hideFullName = false, handleLinkTo, noLink }) => {
16+
let link = <strong>{user.handle}</strong>
17+
18+
// if we set flag for no-link, then don't add link
19+
if (!noLink) {
20+
/* if "handleLinkTo" is provided, use it as internal link, otherwise as external profile link */
21+
link = handleLinkTo ? (
22+
<Link to={handleLinkTo}>
23+
<strong>{user.handle}</strong>
24+
</Link>
25+
) : (
26+
<a
27+
href={`${TOPCODER_COMMUNITY_WEBSITE_URL}/members/${user.handle}`}
28+
target="_blank"
29+
>
30+
<strong>{user.handle}</strong>
31+
</a>
32+
)
33+
}
34+
1635
return (
1736
<div styleName="user">
1837
<Avatar {...user} />
1938
{showArrow ? <IconDirectArrow styleName="direct-arrow" /> : null}
2039
<div styleName="user-details">
21-
{/* if "handleLinkTo" is provided, use it as internal link, otherwise as external profile link */}
22-
{handleLinkTo ? (
23-
<Link to={handleLinkTo}>
24-
<strong>{user.handle}</strong>
25-
</Link>
26-
) : (
27-
<a
28-
href={`${TOPCODER_COMMUNITY_WEBSITE_URL}/members/${user.handle}`}
29-
target="_blank"
30-
>
31-
<strong>{user.handle}</strong>
32-
</a>
33-
)}
34-
40+
{link}
3541
{!hideFullName && (
3642
<div>{formatFullName(user.firstName, user.lastName)}</div>
3743
)}
@@ -50,6 +56,7 @@ User.propTypes = {
5056
hideFullName: PT.bool,
5157
handleLinkTo: PT.string,
5258
showArrow: PT.bool,
59+
noLink: PT.bool,
5360
};
5461

5562
export default User;

src/components/User/styles.module.scss

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
align-items: center;
55
display: flex;
66
position: relative;
7+
8+
strong {
9+
font-weight: bold;
10+
}
711
}
812

913
.direct-arrow {

src/routes/TeamAccess/components/MemberList/index.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ const MemberList = ({ teamId, members, invitees }) => {
7373
photoUrl: invitee.photoURL,
7474
handle: invitee.handle || invitee.email,
7575
}}
76+
// if we don't know the handle of invited user, then don't add link
77+
noLink={!invitee.handle}
7678
showArrow
7779
hideFullName
7880
/>

src/routes/TeamAccess/components/MemberList/styles.module.scss

-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@
4242
.table-cell {
4343
@include table-cell;
4444
flex: initial;
45-
a {
46-
font-weight: bold;
47-
}
4845
}
4946

5047
.delete {

0 commit comments

Comments
 (0)