Web: Removed the link if the user does not have rights.
This commit is contained in:
parent
be6530c8ff
commit
1b0a46303e
@ -26,6 +26,7 @@ const StyledUserNameLink = styled.span`
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
${(props) => props.isVisitor && "cursor: default"};
|
||||||
}
|
}
|
||||||
|
|
||||||
.link {
|
.link {
|
||||||
|
@ -4,7 +4,7 @@ import { useHistory } from "react-router-dom";
|
|||||||
import Link from "@docspace/components/link";
|
import Link from "@docspace/components/link";
|
||||||
import { StyledUserNameLink } from "../../styles/history";
|
import { StyledUserNameLink } from "../../styles/history";
|
||||||
|
|
||||||
const HistoryBlockUser = ({ user, withComma, openUser }) => {
|
const HistoryBlockUser = ({ user, withComma, openUser, isVisitor }) => {
|
||||||
const username = user.displayName;
|
const username = user.displayName;
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
@ -12,9 +12,11 @@ const HistoryBlockUser = ({ user, withComma, openUser }) => {
|
|||||||
openUser(user, history);
|
openUser(user, history);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onClickProp = isVisitor ? {} : { onClick: onUserClick };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledUserNameLink key={user.id} className="user">
|
<StyledUserNameLink key={user.id} className="user" isVisitor={isVisitor}>
|
||||||
<Link className="username link" onClick={onUserClick}>
|
<Link className="username link" {...onClickProp}>
|
||||||
{username}
|
{username}
|
||||||
</Link>
|
</Link>
|
||||||
{withComma ? "," : ""}
|
{withComma ? "," : ""}
|
||||||
|
@ -29,6 +29,7 @@ const History = ({
|
|||||||
getHistory,
|
getHistory,
|
||||||
checkAndOpenLocationAction,
|
checkAndOpenLocationAction,
|
||||||
openUser,
|
openUser,
|
||||||
|
isVisitor,
|
||||||
}) => {
|
}) => {
|
||||||
const [history, setHistory] = useState(null);
|
const [history, setHistory] = useState(null);
|
||||||
const [showLoader, setShowLoader] = useState(false);
|
const [showLoader, setShowLoader] = useState(false);
|
||||||
@ -149,6 +150,7 @@ const History = ({
|
|||||||
feed.target &&
|
feed.target &&
|
||||||
[feed.target, ...feed.groupedFeeds].map((user, i) => (
|
[feed.target, ...feed.groupedFeeds].map((user, i) => (
|
||||||
<HistoryBlockUser
|
<HistoryBlockUser
|
||||||
|
isVisitor={isVisitor}
|
||||||
key={user.id}
|
key={user.id}
|
||||||
user={user}
|
user={user}
|
||||||
withComma={i !== feed.groupedFeeds.length}
|
withComma={i !== feed.groupedFeeds.length}
|
||||||
@ -164,6 +166,7 @@ const History = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ auth, filesStore, filesActionsStore }) => {
|
export default inject(({ auth, filesStore, filesActionsStore }) => {
|
||||||
|
const { userStore } = auth;
|
||||||
const {
|
const {
|
||||||
selection,
|
selection,
|
||||||
selectionParentRoom,
|
selectionParentRoom,
|
||||||
@ -176,6 +179,9 @@ export default inject(({ auth, filesStore, filesActionsStore }) => {
|
|||||||
const { getHistory } = filesStore;
|
const { getHistory } = filesStore;
|
||||||
const { checkAndOpenLocationAction } = filesActionsStore;
|
const { checkAndOpenLocationAction } = filesActionsStore;
|
||||||
|
|
||||||
|
const { user } = userStore;
|
||||||
|
const isVisitor = user.isVisitor;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
personal,
|
personal,
|
||||||
culture,
|
culture,
|
||||||
@ -186,5 +192,6 @@ export default inject(({ auth, filesStore, filesActionsStore }) => {
|
|||||||
getHistory,
|
getHistory,
|
||||||
checkAndOpenLocationAction,
|
checkAndOpenLocationAction,
|
||||||
openUser,
|
openUser,
|
||||||
|
isVisitor,
|
||||||
};
|
};
|
||||||
})(withTranslation(["InfoPanel", "Common", "Translations"])(observer(History)));
|
})(withTranslation(["InfoPanel", "Common", "Translations"])(observer(History)));
|
||||||
|
Loading…
Reference in New Issue
Block a user