From 347897cd9d2aa13623497fe6b64a567811ce3789 Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 22 Aug 2022 13:23:37 -0400 Subject: [PATCH] Add custom support link --- app/soapbox/components/media_gallery.js | 55 +++++++++++++++---------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/app/soapbox/components/media_gallery.js b/app/soapbox/components/media_gallery.js index 90c2f2f5d..2b4a5b02e 100644 --- a/app/soapbox/components/media_gallery.js +++ b/app/soapbox/components/media_gallery.js @@ -7,6 +7,7 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import { getSettings } from 'soapbox/actions/settings'; +import { getSoapboxConfig } from 'soapbox/actions/soapbox'; import Blurhash from 'soapbox/components/blurhash'; import Icon from 'soapbox/components/icon'; import StillImage from 'soapbox/components/still_image'; @@ -263,9 +264,14 @@ class Item extends React.PureComponent { } -const mapStateToMediaGalleryProps = state => ({ - displayMedia: getSettings(state).get('displayMedia'), -}); +const mapStateToMediaGalleryProps = state => { + const { links } = getSoapboxConfig(state); + + return { + displayMedia: getSettings(state).get('displayMedia'), + links, + }; +}; export default @connect(mapStateToMediaGalleryProps) @injectIntl @@ -285,6 +291,7 @@ class MediaGallery extends React.PureComponent { onToggleVisibility: PropTypes.func, displayMedia: PropTypes.string, compact: PropTypes.bool, + links: ImmutablePropTypes.map, }; static defaultProps = { @@ -568,7 +575,7 @@ class MediaGallery extends React.PureComponent { } render() { - const { media, intl, sensitive, compact, inReview } = this.props; + const { media, intl, sensitive, compact, inReview, links } = this.props; const { visible } = this.state; const sizeData = this.getSizeData(media.size); @@ -638,24 +645,28 @@ class MediaGallery extends React.PureComponent { {summary} - {' '} - - - - ), - }} - /> + {links.get('support') && ( + <> + {' '} + + + + ), + }} + /> + + )}