mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-29 07:29:02 +01:00
[Glitch+Emoji reactions] Use modern React context for for identity for emoji reaction code
This commit is contained in:
parent
613d811b93
commit
ed68485e5c
2 changed files with 7 additions and 4 deletions
|
@ -12,6 +12,7 @@ import { HotKeys } from 'react-hotkeys';
|
||||||
import PictureInPicturePlaceholder from 'flavours/glitch/components/picture_in_picture_placeholder';
|
import PictureInPicturePlaceholder from 'flavours/glitch/components/picture_in_picture_placeholder';
|
||||||
import PollContainer from 'flavours/glitch/containers/poll_container';
|
import PollContainer from 'flavours/glitch/containers/poll_container';
|
||||||
import NotificationOverlayContainer from 'flavours/glitch/features/notifications/containers/overlay_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 { autoUnfoldCW } from 'flavours/glitch/utils/content_warning';
|
||||||
import { withOptionalRouter, WithOptionalRouterPropTypes } from 'flavours/glitch/utils/react_router';
|
import { withOptionalRouter, WithOptionalRouterPropTypes } from 'flavours/glitch/utils/react_router';
|
||||||
|
|
||||||
|
@ -77,6 +78,7 @@ class Status extends ImmutablePureComponent {
|
||||||
static contextType = SensitiveMediaContext;
|
static contextType = SensitiveMediaContext;
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
identity: identityContextPropShape,
|
||||||
containerId: PropTypes.string,
|
containerId: PropTypes.string,
|
||||||
id: PropTypes.string,
|
id: PropTypes.string,
|
||||||
status: ImmutablePropTypes.map,
|
status: ImmutablePropTypes.map,
|
||||||
|
@ -541,6 +543,7 @@ class Status extends ImmutablePureComponent {
|
||||||
onOpenMedia,
|
onOpenMedia,
|
||||||
notification,
|
notification,
|
||||||
history,
|
history,
|
||||||
|
identity,
|
||||||
...other
|
...other
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { isCollapsed } = this.state;
|
const { isCollapsed } = this.state;
|
||||||
|
@ -849,7 +852,7 @@ class Status extends ImmutablePureComponent {
|
||||||
numVisible={visibleReactions}
|
numVisible={visibleReactions}
|
||||||
addReaction={this.props.onReactionAdd}
|
addReaction={this.props.onReactionAdd}
|
||||||
removeReaction={this.props.onReactionRemove}
|
removeReaction={this.props.onReactionRemove}
|
||||||
canReact={this.context.identity.signedIn}
|
canReact={this.props.identity.signedIn}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{(!isCollapsed || !(muted || !settings.getIn(['collapsed', 'show_action_bar']))) && (
|
{(!isCollapsed || !(muted || !settings.getIn(['collapsed', 'show_action_bar']))) && (
|
||||||
|
@ -874,4 +877,4 @@ class Status extends ImmutablePureComponent {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withOptionalRouter(injectIntl(Status));
|
export default withOptionalRouter(injectIntl((withIdentity(Status))));
|
||||||
|
|
|
@ -282,8 +282,8 @@ class Status extends ImmutablePureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
handleReactionAdd = (statusId, name, url) => {
|
handleReactionAdd = (statusId, name, url) => {
|
||||||
const { dispatch } = this.props;
|
const { dispatch, identity } = this.props;
|
||||||
const { signedIn } = this.context.identity;
|
const { signedIn } = identity;
|
||||||
|
|
||||||
if (signedIn) {
|
if (signedIn) {
|
||||||
dispatch(addReaction(statusId, name, url));
|
dispatch(addReaction(statusId, name, url));
|
||||||
|
|
Loading…
Reference in a new issue