From 1334840ee05a9ab7a163dad6c8a407f11ddc8bbc Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Wed, 25 May 2022 16:47:08 -0600 Subject: [PATCH] Fix comment links from /activity & add to emails (#320) --- functions/src/emails.ts | 2 +- web/components/feed/copy-link-date-time.tsx | 11 ++++------- web/components/feed/feed-comments.tsx | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/functions/src/emails.ts b/functions/src/emails.ts index 8aba4fb5..b5838968 100644 --- a/functions/src/emails.ts +++ b/functions/src/emails.ts @@ -262,7 +262,7 @@ export const sendNewCommentEmail = async ( return const { question, creatorUsername, slug } = contract - const marketUrl = `https://${DOMAIN}/${creatorUsername}/${slug}` + const marketUrl = `https://${DOMAIN}/${creatorUsername}/${slug}#${comment.id}` const unsubscribeUrl = `https://us-central1-${PROJECT_ID}.cloudfunctions.net/unsubscribe?id=${userId}&type=market-comment` diff --git a/web/components/feed/copy-link-date-time.tsx b/web/components/feed/copy-link-date-time.tsx index 3bd6d21a..354996a4 100644 --- a/web/components/feed/copy-link-date-time.tsx +++ b/web/components/feed/copy-link-date-time.tsx @@ -21,14 +21,11 @@ export function CopyLinkDateTimeComponent(props: { event: React.MouseEvent ) { event.preventDefault() + let elementLocation = `https://${ENV_CONFIG.domain}${contractPath( + contract + )}#${elementId}` - let currentLocation = window.location.href.includes('/home') - ? `https://${ENV_CONFIG.domain}${contractPath(contract)}#${elementId}` - : window.location.href - if (currentLocation.includes('#')) { - currentLocation = currentLocation.split('#')[0] - } - copyToClipboard(`${currentLocation}#${elementId}`) + copyToClipboard(elementLocation) setShowToast(true) setTimeout(() => setShowToast(false), 2000) } diff --git a/web/components/feed/feed-comments.tsx b/web/components/feed/feed-comments.tsx index 55bfe0f6..db55e890 100644 --- a/web/components/feed/feed-comments.tsx +++ b/web/components/feed/feed-comments.tsx @@ -156,7 +156,7 @@ export function FeedComment(props: {