From 811454462d4a8e8d3e41cb0d7dbb59aaf597d3d5 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 28 Nov 2019 20:38:58 +0000 Subject: [PATCH] fix Stickerpicker and MessageContextMenu Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../views/context_menus/MessageContextMenu.js | 71 +++++++++---------- src/components/views/rooms/Stickerpicker.js | 42 +++++------ 2 files changed, 56 insertions(+), 57 deletions(-) diff --git a/src/components/views/context_menus/MessageContextMenu.js b/src/components/views/context_menus/MessageContextMenu.js index a832b2fbb2..adfd394b75 100644 --- a/src/components/views/context_menus/MessageContextMenu.js +++ b/src/components/views/context_menus/MessageContextMenu.js @@ -31,6 +31,7 @@ import Resend from '../../../Resend'; import SettingsStore from '../../../settings/SettingsStore'; import { isUrlPermitted } from '../../../HtmlUtils'; import { isContentActionable } from '../../../utils/EventUtils'; +import {MenuItem} from "../../structures/ContextualMenu"; function canCancel(eventStatus) { return eventStatus === EventStatus.QUEUED || eventStatus === EventStatus.NOT_SENT; @@ -289,8 +290,6 @@ module.exports = createReactClass({ }, render: function() { - const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); - const cli = MatrixClientPeg.get(); const me = cli.getUserId(); const mxEvent = this.props.mxEvent; @@ -322,89 +321,89 @@ module.exports = createReactClass({ if (!mxEvent.isRedacted()) { if (eventStatus === EventStatus.NOT_SENT) { resendButton = ( - + { _t('Resend') } - + ); } if (editStatus === EventStatus.NOT_SENT) { resendEditButton = ( - + { _t('Resend edit') } - + ); } if (unsentReactionsCount !== 0) { resendReactionsButton = ( - + { _t('Resend %(unsentCount)s reaction(s)', {unsentCount: unsentReactionsCount}) } - + ); } } if (redactStatus === EventStatus.NOT_SENT) { resendRedactionButton = ( - + { _t('Resend removal') } - + ); } if (isSent && this.state.canRedact) { redactButton = ( - + { _t('Remove') } - + ); } if (allowCancel) { cancelButton = ( - + { _t('Cancel Sending') } - + ); } if (isContentActionable(mxEvent)) { forwardButton = ( - + { _t('Forward Message') } - + ); if (this.state.canPin) { pinButton = ( - + { this._isPinned() ? _t('Unpin Message') : _t('Pin Message') } - + ); } } const viewSourceButton = ( - + { _t('View Source') } - + ); if (mxEvent.getType() !== mxEvent.getWireType()) { viewClearSourceButton = ( - + { _t('View Decrypted Source') } - + ); } if (this.props.eventTileOps) { if (this.props.eventTileOps.isWidgetHidden()) { unhidePreviewButton = ( - + { _t('Unhide Preview') } - + ); } } @@ -415,19 +414,19 @@ module.exports = createReactClass({ } // XXX: if we use room ID, we should also include a server where the event can be found (other than in the domain of the event ID) const permalinkButton = ( - + { mxEvent.isRedacted() || mxEvent.getType() !== 'm.room.message' ? _t('Share Permalink') : _t('Share Message') } - + ); if (this.props.eventTileOps && this.props.eventTileOps.getInnerText) { quoteButton = ( - + { _t('Quote') } - + ); } @@ -437,7 +436,7 @@ module.exports = createReactClass({ isUrlPermitted(mxEvent.event.content.external_url) ) { externalURLButton = ( - + { _t('Source URL') } - + ); } if (this.props.collapseReplyThread) { collapseReplyThread = ( - + { _t('Collapse Reply Thread') } - + ); } let e2eInfo; if (this.props.e2eInfoCallback) { e2eInfo = ( - + { _t('End-to-end encryption information') } - + ); } let reportEventButton; if (mxEvent.getSender() !== me) { reportEventButton = ( - + { _t('Report Content') } - + ); } diff --git a/src/components/views/rooms/Stickerpicker.js b/src/components/views/rooms/Stickerpicker.js index 7eabf27528..eb3a35bb01 100644 --- a/src/components/views/rooms/Stickerpicker.js +++ b/src/components/views/rooms/Stickerpicker.js @@ -25,6 +25,7 @@ import ActiveWidgetStore from '../../../stores/ActiveWidgetStore'; import PersistedElement from "../elements/PersistedElement"; import {IntegrationManagers} from "../../../integrations/IntegrationManagers"; import SettingsStore from "../../../settings/SettingsStore"; +import {ContextMenu} from "../../structures/ContextualMenu"; const widgetType = 'm.stickerpicker'; @@ -371,26 +372,8 @@ export default class Stickerpicker extends React.Component { } render() { - const ContextualMenu = sdk.getComponent('structures.ContextualMenu'); - const GenericElementContextMenu = sdk.getComponent('context_menus.GenericElementContextMenu'); + let stickerPicker; let stickersButton; - - const stickerPicker = ; - if (this.state.showStickers) { // Show hide-stickers button stickersButton = @@ -402,6 +385,23 @@ export default class Stickerpicker extends React.Component { title={_t("Hide Stickers")} > ; + + const GenericElementContextMenu = sdk.getComponent('context_menus.GenericElementContextMenu'); + stickerPicker = + + ; } else { // Show show-stickers button stickersButton = @@ -415,8 +415,8 @@ export default class Stickerpicker extends React.Component { ; } return - {stickersButton} - {this.state.showStickers && stickerPicker} + { stickersButton } + { stickerPicker } ; } }