Skip to content

Commit

Permalink
fix: missing link for post moderation external share (#3855)
Browse files Browse the repository at this point in the history
  • Loading branch information
sshanzel authored Nov 20, 2024
1 parent 2ca2282 commit 60dcacc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement } from 'react';
import Link from 'next/link';
import { Modal, ModalProps } from '../common/Modal';
import {
Typography,
Expand All @@ -23,6 +24,8 @@ import { ModalClose } from '../common/ModalClose';
import { SquadModerationItemContextMenu } from '../../squads/moderation/SquadModerationItemContextMenu';
import { useSourceModerationList } from '../../../hooks/squads/useSourceModerationList';
import { ProfileImageSize } from '../../ProfilePicture';
import ConditionalWrapper from '../../ConditionalWrapper';
import { anchorDefaultRel } from '../../../lib/strings';

type ActionHandler = (ids: string[], sourceId: string) => void;

Expand Down Expand Up @@ -52,6 +55,7 @@ function PostModerationModal({
contentHtml,
sharedPost,
source,
externalLink,
} = data;
const onReadArticle = useReadArticle({
origin: Origin.ArticleModal,
Expand Down Expand Up @@ -103,7 +107,16 @@ function PostModerationModal({
titleHtml={titleHtml || editPost?.titleHtml}
/>
{!sharedPost && (image || editPost?.image) && (
<MarkdownPostImage imgSrc={image || editPost?.image} />
<ConditionalWrapper
condition={!!externalLink}
wrapper={(component) => (
<Link href={externalLink} target="_blank" rel={anchorDefaultRel}>
{component}
</Link>
)}
>
<MarkdownPostImage imgSrc={image || editPost?.image} />
</ConditionalWrapper>
)}
{!!contentHtml?.length && (
<Markdown className="!mt-0" content={contentHtml} />
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/graphql/squads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ const SOURCE_POST_MODERATION_FRAGMENT = gql`
contentHtml
image
createdAt
externalLink
source {
...SourceBaseInfo
}
Expand Down

0 comments on commit 60dcacc

Please sign in to comment.