diff --git a/app/javascript/flavours/glitch/components/status.jsx b/app/javascript/flavours/glitch/components/status.jsx index 0faa6d1dbd..d6205b1fcd 100644 --- a/app/javascript/flavours/glitch/components/status.jsx +++ b/app/javascript/flavours/glitch/components/status.jsx @@ -12,6 +12,7 @@ import { HotKeys } from 'react-hotkeys'; import PictureInPicturePlaceholder from 'flavours/glitch/components/picture_in_picture_placeholder'; import PollContainer from 'flavours/glitch/containers/poll_container'; import NotificationOverlayContainer from 'flavours/glitch/features/notifications/containers/overlay_container'; +import { identityContextPropShape, withIdentity } from 'flavours/glitch/identity_context'; import { autoUnfoldCW } from 'flavours/glitch/utils/content_warning'; import { withOptionalRouter, WithOptionalRouterPropTypes } from 'flavours/glitch/utils/react_router'; @@ -20,7 +21,6 @@ import Card from '../features/status/components/card'; // to use the progress bar to show download progress import Bundle from '../features/ui/components/bundle'; import { MediaGallery, Video, Audio } from '../features/ui/util/async-components'; -import { IdentityConsumer } from '../features/ui/util/identity_consumer'; import { SensitiveMediaContext } from '../features/ui/util/sensitive_media_context'; import { displayMedia, visibleReactions } from '../initial_state'; @@ -78,6 +78,7 @@ class Status extends ImmutablePureComponent { static contextType = SensitiveMediaContext; static propTypes = { + identity: identityContextPropShape, containerId: PropTypes.string, id: PropTypes.string, status: ImmutablePropTypes.map, @@ -545,6 +546,7 @@ class Status extends ImmutablePureComponent { nextInReplyToId, rootId, history, + identity, ...other } = this.props; const { isCollapsed } = this.state; @@ -846,18 +848,14 @@ class Status extends ImmutablePureComponent { {...statusContentProps} /> - - {identity => ( - - )} - + {(!isCollapsed || !(muted || !settings.getIn(['collapsed', 'show_action_bar']))) && (
@@ -348,4 +345,4 @@ class DetailedStatus extends ImmutablePureComponent { } -export default withRouter(DetailedStatus); +export default withRouter(withIdentity(DetailedStatus)); diff --git a/app/javascript/flavours/glitch/features/status/index.jsx b/app/javascript/flavours/glitch/features/status/index.jsx index 95d33f2afb..4719689a8b 100644 --- a/app/javascript/flavours/glitch/features/status/index.jsx +++ b/app/javascript/flavours/glitch/features/status/index.jsx @@ -307,8 +307,8 @@ class Status extends ImmutablePureComponent { }; handleReactionAdd = (statusId, name, url) => { - const { dispatch } = this.props; - const { signedIn } = this.context.identity; + const { dispatch, identity } = this.props; + const { signedIn } = identity; if (signedIn) { dispatch(addReaction(statusId, name, url)); diff --git a/app/javascript/flavours/glitch/features/ui/util/identity_consumer.jsx b/app/javascript/flavours/glitch/features/ui/util/identity_consumer.jsx deleted file mode 100644 index bf7c7e70f9..0000000000 --- a/app/javascript/flavours/glitch/features/ui/util/identity_consumer.jsx +++ /dev/null @@ -1,16 +0,0 @@ -import PropTypes from 'prop-types'; -import { PureComponent } from 'react'; - -export class IdentityConsumer extends PureComponent { - static contextTypes = { - identity: PropTypes.object - }; - - static propTypes = { - children: PropTypes.func.isRequired - }; - - render() { - return this.props.children(this.context.identity); - } -}