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 = (
-
+
+
);
}
if (editStatus === EventStatus.NOT_SENT) {
resendEditButton = (
-
+
+
);
}
if (unsentReactionsCount !== 0) {
resendReactionsButton = (
-
+
+
);
}
}
if (redactStatus === EventStatus.NOT_SENT) {
resendRedactionButton = (
-
+
+
);
}
if (isSent && this.state.canRedact) {
redactButton = (
-
+
+
);
}
if (allowCancel) {
cancelButton = (
-
+
+
);
}
if (isContentActionable(mxEvent)) {
forwardButton = (
-
+
+
);
if (this.state.canPin) {
pinButton = (
-
+
+
);
}
}
const viewSourceButton = (
-
+
+
);
if (mxEvent.getType() !== mxEvent.getWireType()) {
viewClearSourceButton = (
-
+
+
);
}
if (this.props.eventTileOps) {
if (this.props.eventTileOps.isWidgetHidden()) {
unhidePreviewButton = (
-
+
+
);
}
}
@@ -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 = (
-
+
+
);
if (this.props.eventTileOps && this.props.eventTileOps.getInnerText) {
quoteButton = (
-
+
+
);
}
@@ -437,7 +436,7 @@ module.exports = createReactClass({
isUrlPermitted(mxEvent.event.content.external_url)
) {
externalURLButton = (
-
+
+
);
}
if (this.props.collapseReplyThread) {
collapseReplyThread = (
-
+
+
);
}
let e2eInfo;
if (this.props.e2eInfoCallback) {
e2eInfo = (
-
+
+
);
}
let reportEventButton;
if (mxEvent.getSender() !== me) {
reportEventButton = (
-
+
+
);
}
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 }
;
}
}