From 902367ef050287f02e5412fd4942779278ee69d1 Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Mon, 11 Feb 2019 13:00:35 -0500 Subject: [PATCH] show autocensored message if API indicates project was autocensored --- src/views/preview/censored-message.jsx | 41 +++++++++++++++++--------- src/views/preview/presentation.jsx | 3 ++ src/views/preview/project-view.jsx | 2 ++ 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/views/preview/censored-message.jsx b/src/views/preview/censored-message.jsx index b8eb01f0e..c6d35b585 100644 --- a/src/views/preview/censored-message.jsx +++ b/src/views/preview/censored-message.jsx @@ -15,29 +15,42 @@ const communityGuidelinesLink = ( ); -const CensoredMessage = ({messageHTML, reshareable}) => ( +const CensoredMessage = ({censoredByCommunity, messageHTML, reshareable}) => ( {/* if message HTML is provided, set innerHTML with it */} - {messageHTML ? embedCensorMessage(messageHTML) : ( - // if message is blank or missing, use default - - -
-
- {reshareable ? ( + {messageHTML ? embedCensorMessage(messageHTML) : + (censoredByCommunity ? ( + + +
+
- ) : ( - - )} -
- )} +
+ ) : ( + // if message is blank or missing, use default + + +
+
+ {reshareable ? ( + + ) : ( + + )} +
+ )) + }
); CensoredMessage.propTypes = { + censoredByCommunity: PropTypes.bool, messageHTML: PropTypes.string, reshareable: PropTypes.bool }; diff --git a/src/views/preview/presentation.jsx b/src/views/preview/presentation.jsx index 92f20cc42..d6cae775a 100644 --- a/src/views/preview/presentation.jsx +++ b/src/views/preview/presentation.jsx @@ -144,6 +144,7 @@ const PreviewPresentation = ({ } else if (visibilityInfo.censored) { const censoredMessage = ( @@ -730,6 +731,8 @@ PreviewPresentation.propTypes = { userOwnsProject: PropTypes.bool, visibilityInfo: PropTypes.shape({ censored: PropTypes.bool, + censoredByAdmin: PropTypes.bool, + censoredByCommunity: PropTypes.bool, message: PropTypes.string, deleted: PropTypes.bool, reshareable: PropTypes.bool diff --git a/src/views/preview/project-view.jsx b/src/views/preview/project-view.jsx index d09e735cd..ba1202354 100644 --- a/src/views/preview/project-view.jsx +++ b/src/views/preview/project-view.jsx @@ -829,6 +829,8 @@ Preview.propTypes = { userPresent: PropTypes.bool, visibilityInfo: PropTypes.shape({ censored: PropTypes.bool, + censoredByAdmin: PropTypes.bool, + censoredByCommunity: PropTypes.bool, message: PropTypes.string, deleted: PropTypes.bool, reshareable: PropTypes.bool