mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-26 17:16:11 -05:00
show autocensored message if API indicates project was autocensored
This commit is contained in:
parent
0d17d9cee1
commit
902367ef05
3 changed files with 32 additions and 14 deletions
|
@ -15,29 +15,42 @@ const communityGuidelinesLink = (
|
|||
</a>
|
||||
);
|
||||
|
||||
const CensoredMessage = ({messageHTML, reshareable}) => (
|
||||
const CensoredMessage = ({censoredByCommunity, messageHTML, reshareable}) => (
|
||||
<React.Fragment>
|
||||
{/* if message HTML is provided, set innerHTML with it */}
|
||||
{messageHTML ? embedCensorMessage(messageHTML) : (
|
||||
// if message is blank or missing, use default
|
||||
<React.Fragment>
|
||||
<FormattedMessage id="project.defaultCensoredMessage" />
|
||||
<br />
|
||||
<br />
|
||||
{reshareable ? (
|
||||
{messageHTML ? embedCensorMessage(messageHTML) :
|
||||
(censoredByCommunity ? (
|
||||
<React.Fragment>
|
||||
<FormattedMessage id="project.communityCensoredMessage" />
|
||||
<br />
|
||||
<br />
|
||||
<FormattedMessage
|
||||
id="project.tempCensoredMessage"
|
||||
id="project.willReviewCensoredMessage"
|
||||
values={{communityGuidelinesLink: communityGuidelinesLink}}
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage id="project.permCensoredMessage" />
|
||||
)}
|
||||
</React.Fragment>
|
||||
)}
|
||||
</React.Fragment>
|
||||
) : (
|
||||
// if message is blank or missing, use default
|
||||
<React.Fragment>
|
||||
<FormattedMessage id="project.defaultCensoredMessage" />
|
||||
<br />
|
||||
<br />
|
||||
{reshareable ? (
|
||||
<FormattedMessage
|
||||
id="project.tempCensoredMessage"
|
||||
values={{communityGuidelinesLink: communityGuidelinesLink}}
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage id="project.permCensoredMessage" />
|
||||
)}
|
||||
</React.Fragment>
|
||||
))
|
||||
}
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
CensoredMessage.propTypes = {
|
||||
censoredByCommunity: PropTypes.bool,
|
||||
messageHTML: PropTypes.string,
|
||||
reshareable: PropTypes.bool
|
||||
};
|
||||
|
|
|
@ -144,6 +144,7 @@ const PreviewPresentation = ({
|
|||
} else if (visibilityInfo.censored) {
|
||||
const censoredMessage = (
|
||||
<CensoredMessage
|
||||
censoredByCommunity={visibilityInfo.censoredByCommunity}
|
||||
messageHTML={visibilityInfo.message}
|
||||
reshareable={visibilityInfo.reshareable}
|
||||
/>
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue