From 6ea3493d19664dfc619cf112b27331f82c7199ef Mon Sep 17 00:00:00 2001 From: Eugene Dyudyunov Date: Wed, 31 May 2023 11:57:50 +0300 Subject: [PATCH] fix: post sharing URL (#519) --- src/discussions/posts/post/Post.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/discussions/posts/post/Post.jsx b/src/discussions/posts/post/Post.jsx index d9a166dba..69a73e432 100644 --- a/src/discussions/posts/post/Post.jsx +++ b/src/discussions/posts/post/Post.jsx @@ -93,6 +93,11 @@ const Post = ({ handleAddResponseButton }) => { } }, [abuseFlagged, postId, showReportConfirmation]); + const handlePostCopyLink = useCallback(() => { + const postURL = new URL(`${getConfig().PUBLIC_PATH}${courseId}/posts/${post.id}`, window.location.origin); + navigator.clipboard.writeText(postURL.href); + }, [window.location.origin, post.id, courseId]); + const actionHandlers = useMemo(() => ({ [ContentActions.EDIT_CONTENT]: handlePostContentEdit, [ContentActions.DELETE]: showDeleteConfirmation,