diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-09-29 06:21:51 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-11-30 13:53:38 +0100 |
commit | 5e143db13aeffc5f0353ed7226b8f0df13763868 (patch) | |
tree | dd841b78c3e9503e2131487671ddbfd9cadbab94 | |
parent | b5ee275ed978d307b87ced8a0b98f7efcaf5a070 (diff) |
[Glitch] Don't show translate button to logged-out users
Port part of e623c302d5d4dfc05689eb8fb8e051e30fc38ec8 to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
-rw-r--r-- | app/javascript/flavours/glitch/components/status_content.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/components/status_content.js b/app/javascript/flavours/glitch/components/status_content.js index a4ad5d1c8..cadcf5c11 100644 --- a/app/javascript/flavours/glitch/components/status_content.js +++ b/app/javascript/flavours/glitch/components/status_content.js @@ -65,6 +65,10 @@ const isLinkMisleading = (link) => { export default @injectIntl class StatusContent extends React.PureComponent { + static contextTypes = { + identity: PropTypes.object, + }; + static propTypes = { status: ImmutablePropTypes.map.isRequired, expanded: PropTypes.bool, @@ -274,7 +278,7 @@ class StatusContent extends React.PureComponent { } = this.props; const hidden = this.props.onExpandedToggle ? !this.props.expanded : this.state.hidden; - const renderTranslate = this.props.onTranslate && ['public', 'unlisted'].includes(status.get('visibility')) && status.get('contentHtml').length > 0 && intl.locale !== status.get('language'); + const renderTranslate = this.context.identity.signedIn && this.props.onTranslate && ['public', 'unlisted'].includes(status.get('visibility')) && status.get('contentHtml').length > 0 && intl.locale !== status.get('language'); const language = preloadedLanguages.find(lang => lang[0] === status.get('language')); const languageName = language ? language[2] : status.get('language'); |