Skip to content

Commit

Permalink
Don't highlight based on user in profile
Browse files Browse the repository at this point in the history
  • Loading branch information
rsammelson committed Jul 16, 2023
1 parent 8e18c5f commit 6b97b4b
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/features/comment/Comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ interface CommentProps {
className?: string;

rootIndex?: number;

noUserHighlight?: boolean;
}

export default function Comment({
Expand All @@ -193,6 +195,7 @@ export default function Comment({
routerLink,
className,
rootIndex,
noUserHighlight,
}: CommentProps) {
const commentById = useAppSelector((state) => state.comment.commentById);
// eslint-disable-next-line no-undef
Expand Down Expand Up @@ -237,6 +240,7 @@ export default function Comment({
person={commentView.creator}
opId={commentView.post.creator_id}
distinguished={comment.distinguished}
noUserHighlight={noUserHighlight}
/>
<Vote item={commentView} />
<Edited item={commentView} />
Expand Down
8 changes: 7 additions & 1 deletion src/features/comment/inFeed/FeedComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ import { getHandle } from "../../../helpers/lemmy";
interface FeedCommentProps {
comment: CommentView;
className?: string;
noUserHighlight?: boolean;
}

export default function FeedComment({ comment, className }: FeedCommentProps) {
export default function FeedComment({
comment,
className,
noUserHighlight,
}: FeedCommentProps) {
const buildGeneralBrowseLink = useBuildGeneralBrowseLink();
const router = useIonRouter();

Expand All @@ -21,6 +26,7 @@ export default function FeedComment({ comment, className }: FeedCommentProps) {
<PostContext post={comment.post} community={comment.community} />
}
className={className}
noUserHighlight={noUserHighlight}
onClick={() =>
router.push(
buildGeneralBrowseLink(
Expand Down
19 changes: 16 additions & 3 deletions src/features/feed/PostCommentFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ interface PostCommentFeed
extends Omit<FeedProps<PostCommentItem>, "renderItemContent"> {
communityName?: string;
filterHiddenPosts?: boolean;
noUserHighlight?: boolean;
}

export default function PostCommentFeed({
communityName,
fetchFn: _fetchFn,
filterHiddenPosts = true,
noUserHighlight,
...rest
}: PostCommentFeed) {
const dispatch = useAppDispatch();
Expand All @@ -54,12 +56,23 @@ export default function PostCommentFeed({
(item: PostCommentItem) => {
if (isPost(item))
return (
<Post post={item} communityMode={!!communityName} css={borderCss} />
<Post
post={item}
communityMode={!!communityName}
css={borderCss}
noUserHighlight={noUserHighlight}
/>
);

return <FeedComment comment={item} css={borderCss} />;
return (
<FeedComment
comment={item}
css={borderCss}
noUserHighlight={noUserHighlight}
/>
);
},
[communityName, borderCss]
[communityName, borderCss, noUserHighlight]
);

const renderItemContent = useCallback(
Expand Down
2 changes: 2 additions & 0 deletions src/features/post/inFeed/Post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export interface PostProps {
communityMode?: boolean;

className?: string;

noUserHighlight?: boolean;
}

export default function Post(props: PostProps) {
Expand Down
7 changes: 6 additions & 1 deletion src/features/post/inFeed/compact/CompactPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ const EndDetails = styled.div`
margin-left: auto;
`;

export default function CompactPost({ post, communityMode }: PostProps) {
export default function CompactPost({
post,
communityMode,
noUserHighlight,
}: PostProps) {
const compactThumbnailPositionType = useAppSelector(
(state) => state.settings.appearance.compact.thumbnailsPosition
);
Expand Down Expand Up @@ -125,6 +129,7 @@ export default function CompactPost({ post, communityMode }: PostProps) {
person={post.creator}
showInstanceWhenRemote
prefix="by"
noUserHighlight={noUserHighlight}
/>
) : (
<CommunityLink community={post.community} />
Expand Down
7 changes: 6 additions & 1 deletion src/features/post/inFeed/large/LargePost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ const ImageContainer = styled.div`
margin: 0 -1rem;
`;

export default function LargePost({ post, communityMode }: PostProps) {
export default function LargePost({
post,
communityMode,
noUserHighlight,
}: PostProps) {
const hasBeenRead: boolean =
useAppSelector((state) => state.post.postReadById[post.post.id]) ||
post.read;
Expand Down Expand Up @@ -195,6 +199,7 @@ export default function LargePost({ post, communityMode }: PostProps) {
person={post.creator}
showInstanceWhenRemote
prefix="by"
noUserHighlight={noUserHighlight}
/>
) : (
<CommunityLink
Expand Down
1 change: 1 addition & 0 deletions src/features/user/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export default function Profile({ person }: ProfileProps) {
fetchFn={fetchFn}
header={header}
filterHiddenPosts={false}
noUserHighlight={isSelf}
/>
);
}
Expand Down

0 comments on commit 6b97b4b

Please sign in to comment.