From 414b20f17e8b7a2baf0d20ee499709cbf8959d1d Mon Sep 17 00:00:00 2001 From: Dariusz Niemczyk <3636685+Palid@users.noreply.github.com> Date: Mon, 11 Oct 2021 11:26:05 +0200 Subject: [PATCH] Make thread button always visible (#6903) Fix https://github.com/vector-im/element-web/issues/18956 --- src/components/structures/FilePanel.tsx | 66 +++++++++++-------- .../structures/NotificationPanel.tsx | 13 +++- .../views/messages/MessageActionBar.tsx | 15 ++++- src/contexts/RoomContext.ts | 2 + 4 files changed, 64 insertions(+), 32 deletions(-) diff --git a/src/components/structures/FilePanel.tsx b/src/components/structures/FilePanel.tsx index 52cf5ae55b..77629839d9 100644 --- a/src/components/structures/FilePanel.tsx +++ b/src/components/structures/FilePanel.tsx @@ -37,6 +37,7 @@ import TimelinePanel from "./TimelinePanel"; import Spinner from "../views/elements/Spinner"; import { TileShape } from '../views/rooms/EventTile'; import { Layout } from "../../settings/Layout"; +import RoomContext, { TimelineRenderingType } from '../../contexts/RoomContext'; interface IProps { roomId: string; @@ -57,6 +58,7 @@ class FilePanel extends React.Component { // added to the timeline. private decryptingEvents = new Set(); public noRoom: boolean; + static contextType = RoomContext; state = { timelineSet: null, @@ -249,38 +251,46 @@ class FilePanel extends React.Component { const isRoomEncrypted = this.noRoom ? false : MatrixClientPeg.get().isRoomEncrypted(this.props.roomId); if (this.state.timelineSet) { - // console.log("rendering TimelinePanel for timelineSet " + this.state.timelineSet.room.roomId + " " + - // "(" + this.state.timelineSet._timelines.join(", ") + ")" + " with key " + this.props.roomId); return ( - - - - + + + + + + ); } else { return ( - - - + + + + + ); } } diff --git a/src/components/structures/NotificationPanel.tsx b/src/components/structures/NotificationPanel.tsx index f71c017c06..68c9049067 100644 --- a/src/components/structures/NotificationPanel.tsx +++ b/src/components/structures/NotificationPanel.tsx @@ -24,6 +24,7 @@ import TimelinePanel from "./TimelinePanel"; import Spinner from "../views/elements/Spinner"; import { TileShape } from "../views/rooms/EventTile"; import { Layout } from "../../settings/Layout"; +import RoomContext, { TimelineRenderingType } from "../../contexts/RoomContext"; interface IProps { onClose(): void; @@ -34,6 +35,7 @@ interface IProps { */ @replaceableComponent("structures.NotificationPanel") export default class NotificationPanel extends React.PureComponent { + static contextType = RoomContext; render() { const emptyState = (

{ _t('You’re all caught up') }

@@ -61,8 +63,13 @@ export default class NotificationPanel extends React.PureComponent { content = ; } - return - { content } - ; + return + + { content } + ; + ; } } diff --git a/src/components/views/messages/MessageActionBar.tsx b/src/components/views/messages/MessageActionBar.tsx index 7ee951a812..2246d2bacc 100644 --- a/src/components/views/messages/MessageActionBar.tsx +++ b/src/components/views/messages/MessageActionBar.tsx @@ -289,7 +289,7 @@ export default class MessageActionBar extends React.PureComponent ); } } + // Show thread icon even for deleted messages, but only within main timeline + if (this.context.timelineRenderingType === TimelineRenderingType.Room && + SettingsStore.getValue("feature_thread") && + this.props.mxEvent.getThread() && + !isContentActionable(this.props.mxEvent) + ) { + toolbarOpts.unshift(); + } if (allowCancel) { toolbarOpts.push(cancelSendingButton); diff --git a/src/contexts/RoomContext.ts b/src/contexts/RoomContext.ts index a57c14d90f..d3a4fadd19 100644 --- a/src/contexts/RoomContext.ts +++ b/src/contexts/RoomContext.ts @@ -21,6 +21,8 @@ import { Layout } from "../settings/Layout"; export enum TimelineRenderingType { Room, + File, + Notification, Thread }