diff --git a/packages/react/src/views/AttachmentHandler/AudioAttachment.js b/packages/react/src/views/AttachmentHandler/AudioAttachment.js index 5caf16e760..6825784601 100644 --- a/packages/react/src/views/AttachmentHandler/AudioAttachment.js +++ b/packages/react/src/views/AttachmentHandler/AudioAttachment.js @@ -13,7 +13,8 @@ const AudioAttachment = ({ variantStyles, msg, }) => { - const { RCInstance } = useContext(RCContext); + const { RCInstance, ECOptions } = useContext(RCContext); + const hideAvatar = ECOptions?.showAvatar === false; const { theme } = useTheme(); const getUserAvatarUrl = (icon) => { const instanceHost = RCInstance.getHost(); @@ -56,12 +57,20 @@ const AudioAttachment = ({ variantStyles.textUserInfo, ]} > - - @{authorName} + {!hideAvatar && ( + + )} + + @{authorName} + ) : ( @@ -115,11 +124,13 @@ const AudioAttachment = ({ variantStyles.textUserInfo, ]} > - + {!hideAvatar && ( + + )} @{nestedAttachment.author_name} diff --git a/packages/react/src/views/AttachmentHandler/ImageAttachment.js b/packages/react/src/views/AttachmentHandler/ImageAttachment.js index 5f95829df0..abccc6a0f0 100644 --- a/packages/react/src/views/AttachmentHandler/ImageAttachment.js +++ b/packages/react/src/views/AttachmentHandler/ImageAttachment.js @@ -14,7 +14,8 @@ const ImageAttachment = ({ variantStyles = {}, msg, }) => { - const { RCInstance } = useContext(RCContext); + const { RCInstance, ECOptions } = useContext(RCContext); + const hideAvatar = ECOptions?.showAvatar === false; const [showGallery, setShowGallery] = useState(false); const getUserAvatarUrl = (icon) => { const instanceHost = RCInstance.getHost(); @@ -65,12 +66,22 @@ const ImageAttachment = ({ variantStyles.textUserInfo, ]} > - - @{authorName} + <> + {!hideAvatar && ( + + )} + + + @{authorName} + ) : ( @@ -131,11 +142,13 @@ const ImageAttachment = ({ variantStyles.textUserInfo, ]} > - + {!hideAvatar && ( + + )} @{nestedAttachment.author_name} diff --git a/packages/react/src/views/AttachmentHandler/TextAttachment.js b/packages/react/src/views/AttachmentHandler/TextAttachment.js index b8477cd8bb..aca388dc05 100644 --- a/packages/react/src/views/AttachmentHandler/TextAttachment.js +++ b/packages/react/src/views/AttachmentHandler/TextAttachment.js @@ -6,7 +6,8 @@ import RCContext from '../../context/RCInstance'; import { Markdown } from '../Markdown'; const TextAttachment = ({ attachment, type, variantStyles = {} }) => { - const { RCInstance } = useContext(RCContext); + const { RCInstance, ECOptions } = useContext(RCContext); + const hideAvatar = ECOptions?.showAvatar === false; const getUserAvatarUrl = (authorIcon) => { const host = RCInstance.getHost(); const URL = `${host}${authorIcon}`; @@ -48,11 +49,13 @@ const TextAttachment = ({ attachment, type, variantStyles = {} }) => { > {attachment?.author_name && ( <> - + {!hideAvatar && ( + + )} @{attachment?.author_name} )} @@ -119,11 +122,13 @@ const TextAttachment = ({ attachment, type, variantStyles = {} }) => { > {nestedAttachment?.author_name && ( <> - + {!hideAvatar && ( + + )} @{nestedAttachment?.author_name} )} diff --git a/packages/react/src/views/AttachmentHandler/VideoAttachment.js b/packages/react/src/views/AttachmentHandler/VideoAttachment.js index 5c29bc507b..e08bcaefe2 100644 --- a/packages/react/src/views/AttachmentHandler/VideoAttachment.js +++ b/packages/react/src/views/AttachmentHandler/VideoAttachment.js @@ -23,7 +23,8 @@ const VideoAttachment = ({ variantStyles = {}, msg, }) => { - const { RCInstance } = useContext(RCContext); + const { RCInstance, ECOptions } = useContext(RCContext); + const hideAvatar = ECOptions?.showAvatar === false; const { theme } = useTheme(); const getUserAvatarUrl = (icon) => { const instanceHost = RCInstance.getHost(); @@ -66,12 +67,20 @@ const VideoAttachment = ({ variantStyles.textUserInfo, ]} > - - @{authorName} + {!hideAvatar && ( + + )} + + @{authorName} + ) : ( @@ -133,11 +142,13 @@ const VideoAttachment = ({ variantStyles.textUserInfo, ]} > - + {!hideAvatar && ( + + )} @{authorName}