fix: Comment resolution control visible to non-editors

This commit is contained in:
Tom Moor
2024-07-02 07:52:21 -04:00
parent 117c4f5009
commit f9dadf5548
3 changed files with 10 additions and 10 deletions

View File

@@ -12,7 +12,6 @@ import Empty from "~/components/Empty";
import Flex from "~/components/Flex";
import Scrollable from "~/components/Scrollable";
import Tooltip from "~/components/Tooltip";
import useCurrentUser from "~/hooks/useCurrentUser";
import useFocusedComment from "~/hooks/useFocusedComment";
import useKeyDown from "~/hooks/useKeyDown";
import usePersistedState from "~/hooks/usePersistedState";
@@ -27,7 +26,6 @@ import Sidebar from "./SidebarLayout";
function Comments() {
const { ui, comments, documents } = useStores();
const { t } = useTranslation();
const user = useCurrentUser();
const location = useLocation();
const history = useHistory();
const match = useRouteMatch<{ documentSlug: string }>();
@@ -64,11 +62,9 @@ function Comments() {
return null;
}
const threads = (
viewingResolved
? resolvedThreads
: comments.unresolvedThreadsInDocument(document.id)
).filter((thread) => thread.createdById === user.id);
const threads = viewingResolved
? resolvedThreads
: comments.unresolvedThreadsInDocument(document.id);
const hasComments = threads.length > 0;
const toggleViewingResolved = () => {