2015-11-30 17:15:57 +00:00
|
|
|
/*
|
2016-01-07 04:06:39 +00:00
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
2017-02-17 11:44:56 +00:00
|
|
|
Copyright 2017 Vector Creations Ltd
|
2019-01-09 16:27:41 +00:00
|
|
|
Copyright 2018, 2019 New Vector Ltd
|
2019-06-10 10:24:06 +01:00
|
|
|
Copyright 2019 The Matrix.org Foundation C.I.C.
|
2015-11-30 17:15:57 +00:00
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// TODO: This component is enormous! There's several things which could stand-alone:
|
|
|
|
|
// - Search results component
|
|
|
|
|
// - Drag and drop
|
|
|
|
|
|
2021-01-22 16:58:47 -07:00
|
|
|
import React, { createRef } from 'react';
|
2019-04-02 10:50:17 +01:00
|
|
|
import classNames from 'classnames';
|
2021-06-18 16:18:42 +01:00
|
|
|
import { IRecommendedVersion, NotificationCountType, Room } from "matrix-js-sdk/src/models/room";
|
2021-01-22 16:58:47 -07:00
|
|
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
|
|
|
|
import { EventSubscription } from "fbemitter";
|
2021-07-10 15:43:46 +01:00
|
|
|
import { ISearchResults } from 'matrix-js-sdk/src/@types/search';
|
2021-12-06 09:25:05 +00:00
|
|
|
import { logger } from "matrix-js-sdk/src/logger";
|
|
|
|
|
import { EventTimeline } from 'matrix-js-sdk/src/models/event-timeline';
|
|
|
|
|
import { EventType } from 'matrix-js-sdk/src/@types/event';
|
|
|
|
|
import { RoomState } from 'matrix-js-sdk/src/models/room-state';
|
2021-12-09 09:10:23 +00:00
|
|
|
import { CallState, CallType, MatrixCall } from "matrix-js-sdk/src/webrtc/call";
|
|
|
|
|
import { throttle } from "lodash";
|
2021-12-14 15:34:54 +00:00
|
|
|
import { MatrixError } from 'matrix-js-sdk/src/http-api';
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
import shouldHideEvent from '../../shouldHideEvent';
|
2021-01-22 16:58:47 -07:00
|
|
|
import { _t } from '../../languageHandler';
|
|
|
|
|
import { RoomPermalinkCreator } from '../../utils/permalinks/Permalinks';
|
2020-09-07 17:32:03 +01:00
|
|
|
import ResizeNotifier from '../../utils/ResizeNotifier';
|
2019-04-01 16:42:41 +01:00
|
|
|
import ContentMessages from '../../ContentMessages';
|
2019-04-02 10:50:17 +01:00
|
|
|
import Modal from '../../Modal';
|
2021-11-30 19:09:13 +01:00
|
|
|
import CallHandler, { CallHandlerEvent } from '../../CallHandler';
|
2020-05-13 20:41:41 -06:00
|
|
|
import dis from '../../dispatcher/dispatcher';
|
2019-05-09 16:17:54 +02:00
|
|
|
import * as Rooms from '../../Rooms';
|
2021-01-22 16:58:47 -07:00
|
|
|
import eventSearch, { searchPagination } from '../../Searching';
|
2018-10-30 18:13:17 +01:00
|
|
|
import MainSplit from './MainSplit';
|
|
|
|
|
import RightPanel from './RightPanel';
|
2019-01-17 10:29:37 +01:00
|
|
|
import RoomViewStore from '../../stores/RoomViewStore';
|
2021-07-03 12:17:38 +01:00
|
|
|
import RoomScrollStateStore, { ScrollState } from '../../stores/RoomScrollStateStore';
|
2018-07-03 11:16:44 +01:00
|
|
|
import WidgetEchoStore from '../../stores/WidgetEchoStore';
|
2020-07-28 11:53:43 -06:00
|
|
|
import SettingsStore from "../../settings/SettingsStore";
|
2021-11-17 08:19:30 -07:00
|
|
|
import { Layout } from "../../settings/enums/Layout";
|
2019-03-27 13:14:31 -06:00
|
|
|
import AccessibleButton from "../views/elements/AccessibleButton";
|
2022-01-05 16:14:44 +01:00
|
|
|
import RightPanelStore from "../../stores/right-panel/RightPanelStore";
|
2021-01-22 16:58:47 -07:00
|
|
|
import { haveTileForEvent } from "../views/rooms/EventTile";
|
2021-10-01 15:35:54 +02:00
|
|
|
import RoomContext, { TimelineRenderingType } from "../../contexts/RoomContext";
|
|
|
|
|
import MatrixClientContext, { withMatrixClientHOC, MatrixClientProps } from "../../contexts/MatrixClientContext";
|
2021-01-22 16:58:47 -07:00
|
|
|
import { E2EStatus, shieldStatusForRoom } from '../../utils/ShieldUtils';
|
|
|
|
|
import { Action } from "../../dispatcher/actions";
|
|
|
|
|
import { IMatrixClientCreds } from "../../MatrixClientPeg";
|
2020-09-07 17:32:03 +01:00
|
|
|
import ScrollPanel from "./ScrollPanel";
|
|
|
|
|
import TimelinePanel from "./TimelinePanel";
|
|
|
|
|
import ErrorBoundary from "../views/elements/ErrorBoundary";
|
|
|
|
|
import RoomPreviewBar from "../views/rooms/RoomPreviewBar";
|
2021-06-21 14:50:21 +01:00
|
|
|
import SearchBar, { SearchScope } from "../views/rooms/SearchBar";
|
2020-09-07 17:32:03 +01:00
|
|
|
import RoomUpgradeWarningBar from "../views/rooms/RoomUpgradeWarningBar";
|
|
|
|
|
import AuxPanel from "../views/rooms/AuxPanel";
|
|
|
|
|
import RoomHeader from "../views/rooms/RoomHeader";
|
2021-01-22 16:58:47 -07:00
|
|
|
import { XOR } from "../../@types/common";
|
2021-07-01 19:54:05 +01:00
|
|
|
import { IOOBData, IThreepidInvite } from "../../stores/ThreepidInviteStore";
|
2020-11-27 14:54:21 +01:00
|
|
|
import EffectsOverlay from "../views/elements/EffectsOverlay";
|
2021-01-22 16:58:47 -07:00
|
|
|
import { containsEmoji } from '../../effects/utils';
|
|
|
|
|
import { CHAT_EFFECTS } from '../../effects';
|
2020-10-09 08:42:21 +01:00
|
|
|
import WidgetStore from "../../stores/WidgetStore";
|
2021-01-22 16:58:47 -07:00
|
|
|
import { UPDATE_EVENT } from "../../stores/AsyncStore";
|
2020-11-02 17:25:48 +00:00
|
|
|
import Notifier from "../../Notifier";
|
2021-01-22 16:58:47 -07:00
|
|
|
import { showToast as showNotificationsToast } from "../../toasts/DesktopNotificationsToast";
|
2020-12-07 16:54:09 -07:00
|
|
|
import { RoomNotificationStateStore } from "../../stores/notifications/RoomNotificationStateStore";
|
2021-01-18 20:26:47 -07:00
|
|
|
import { Container, WidgetLayoutStore } from "../../stores/widgets/WidgetLayoutStore";
|
2021-03-01 21:43:00 +13:00
|
|
|
import { getKeyBindingsManager, RoomAction } from '../../KeyBindingsManager';
|
2021-02-19 00:00:10 +00:00
|
|
|
import { objectHasDiff } from "../../utils/objects";
|
2021-03-01 17:54:53 +00:00
|
|
|
import SpaceRoomView from "./SpaceRoomView";
|
|
|
|
|
import { IOpts } from "../../createRoom";
|
2021-06-03 19:37:26 +01:00
|
|
|
import { replaceableComponent } from "../../utils/replaceableComponent";
|
2021-06-28 16:02:34 +01:00
|
|
|
import EditorStateTransfer from "../../utils/EditorStateTransfer";
|
2021-07-03 11:51:23 +02:00
|
|
|
import ErrorDialog from '../views/dialogs/ErrorDialog';
|
|
|
|
|
import SearchResultTile from '../views/rooms/SearchResultTile';
|
|
|
|
|
import Spinner from "../views/elements/Spinner";
|
|
|
|
|
import UploadBar from './UploadBar';
|
|
|
|
|
import RoomStatusBar from "./RoomStatusBar";
|
|
|
|
|
import MessageComposer from '../views/rooms/MessageComposer';
|
|
|
|
|
import JumpToBottomButton from "../views/rooms/JumpToBottomButton";
|
|
|
|
|
import TopUnreadMessagesBar from "../views/rooms/TopUnreadMessagesBar";
|
2021-11-11 13:07:41 +00:00
|
|
|
import SpaceStore from "../../stores/spaces/SpaceStore";
|
2022-01-05 17:25:41 +01:00
|
|
|
import { showThread } from '../../dispatcher/dispatch-actions/threads';
|
2021-10-22 09:30:36 +01:00
|
|
|
import { fetchInitialEvent } from "../../utils/EventUtils";
|
2021-10-25 13:43:54 +02:00
|
|
|
import { ComposerType } from "../../dispatcher/payloads/ComposerInsertPayload";
|
2021-11-16 15:43:18 +01:00
|
|
|
import AppsDrawer from '../views/rooms/AppsDrawer';
|
2022-01-05 16:14:44 +01:00
|
|
|
import { RightPanelPhases } from '../../stores/right-panel/RightPanelStorePhases';
|
2022-01-05 15:59:19 +00:00
|
|
|
import { ActionPayload } from "../../dispatcher/payloads";
|
2021-09-21 17:48:09 +02:00
|
|
|
|
2017-10-11 17:56:17 +01:00
|
|
|
const DEBUG = false;
|
2020-09-07 17:32:03 +01:00
|
|
|
let debuglog = function(msg: string) {};
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2017-07-12 10:21:43 +01:00
|
|
|
const BROWSER_SUPPORTS_SANDBOX = 'sandbox' in document.createElement('iframe');
|
|
|
|
|
|
2016-02-10 18:27:40 +00:00
|
|
|
if (DEBUG) {
|
2016-01-04 16:28:32 +00:00
|
|
|
// using bind means that we get to keep useful line numbers in the console
|
2021-09-21 17:48:09 +02:00
|
|
|
debuglog = logger.log.bind(console);
|
2016-01-04 16:28:32 +00:00
|
|
|
}
|
2020-08-24 14:04:20 +02:00
|
|
|
|
2021-10-01 15:35:54 +02:00
|
|
|
interface IRoomProps extends MatrixClientProps {
|
2021-07-01 23:23:03 +01:00
|
|
|
threepidInvite: IThreepidInvite;
|
2021-07-01 19:54:05 +01:00
|
|
|
oobData?: IOOBData;
|
2016-06-14 12:56:37 +01:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
resizeNotifier: ResizeNotifier;
|
2021-03-01 17:54:53 +00:00
|
|
|
justCreatedOpts?: IOpts;
|
2016-03-01 18:23:57 +00:00
|
|
|
|
2021-10-20 06:55:22 -06:00
|
|
|
forceTimeline?: boolean; // should we force access to the timeline, overriding (for eg) spaces
|
|
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
// Called with the credentials of a registered user (if they were a ROU that transitioned to PWLU)
|
|
|
|
|
onRegistered?(credentials: IMatrixClientCreds): void;
|
|
|
|
|
}
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2021-11-16 15:43:18 +01:00
|
|
|
// This defines the content of the mainSplit.
|
|
|
|
|
// If the mainSplit does not contain the Timeline, the chat is shown in the right panel.
|
|
|
|
|
enum MainSplitContentType {
|
|
|
|
|
Timeline,
|
|
|
|
|
MaximisedWidget,
|
|
|
|
|
// Video
|
|
|
|
|
}
|
2021-10-01 15:35:54 +02:00
|
|
|
export interface IRoomState {
|
2020-09-07 17:32:03 +01:00
|
|
|
room?: Room;
|
|
|
|
|
roomId?: string;
|
|
|
|
|
roomAlias?: string;
|
|
|
|
|
roomLoading: boolean;
|
|
|
|
|
peekLoading: boolean;
|
|
|
|
|
shouldPeek: boolean;
|
|
|
|
|
// used to trigger a rerender in TimelinePanel once the members are loaded,
|
|
|
|
|
// so RR are rendered again (now with the members available), ...
|
|
|
|
|
membersLoaded: boolean;
|
|
|
|
|
// The event to be scrolled to initially
|
|
|
|
|
initialEventId?: string;
|
|
|
|
|
// The offset in pixels from the event with which to scroll vertically
|
|
|
|
|
initialEventPixelOffset?: number;
|
|
|
|
|
// Whether to highlight the event scrolled to
|
|
|
|
|
isInitialEventHighlighted?: boolean;
|
2020-10-28 12:47:59 +00:00
|
|
|
replyToEvent?: MatrixEvent;
|
2020-09-07 17:32:03 +01:00
|
|
|
numUnreadMessages: number;
|
|
|
|
|
draggingFile: boolean;
|
|
|
|
|
searching: boolean;
|
|
|
|
|
searchTerm?: string;
|
2021-06-21 14:50:21 +01:00
|
|
|
searchScope?: SearchScope;
|
2021-07-10 15:43:46 +01:00
|
|
|
searchResults?: XOR<{}, ISearchResults>;
|
2020-09-07 17:32:03 +01:00
|
|
|
searchHighlights?: string[];
|
|
|
|
|
searchInProgress?: boolean;
|
2020-10-09 18:56:07 +01:00
|
|
|
callState?: CallState;
|
2020-09-07 17:32:03 +01:00
|
|
|
guestsCanJoin: boolean;
|
|
|
|
|
canPeek: boolean;
|
|
|
|
|
showApps: boolean;
|
|
|
|
|
isPeeking: boolean;
|
|
|
|
|
showRightPanel: boolean;
|
|
|
|
|
// error object, as from the matrix client/server API
|
|
|
|
|
// If we failed to load information about the room,
|
|
|
|
|
// store the error here.
|
2021-12-14 15:34:54 +00:00
|
|
|
roomLoadError?: MatrixError;
|
2020-09-07 17:32:03 +01:00
|
|
|
// Have we sent a request to join the room that we're waiting to complete?
|
|
|
|
|
joining: boolean;
|
|
|
|
|
// this is true if we are fully scrolled-down, and are looking at
|
|
|
|
|
// the end of the live timeline. It has the effect of hiding the
|
|
|
|
|
// 'scroll to bottom' knob, among a couple of other things.
|
|
|
|
|
atEndOfLiveTimeline: boolean;
|
|
|
|
|
// used by componentDidUpdate to avoid unnecessary checks
|
|
|
|
|
atEndOfLiveTimelineInit: boolean;
|
|
|
|
|
showTopUnreadMessagesBar: boolean;
|
|
|
|
|
statusBarVisible: boolean;
|
|
|
|
|
// We load this later by asking the js-sdk to suggest a version for us.
|
|
|
|
|
// This object is the result of Room#getRecommendedVersion()
|
2021-05-19 14:32:49 +01:00
|
|
|
|
2021-06-18 15:31:12 +01:00
|
|
|
upgradeRecommendation?: IRecommendedVersion;
|
2020-09-07 17:32:03 +01:00
|
|
|
canReact: boolean;
|
|
|
|
|
canReply: boolean;
|
2021-01-22 13:44:45 +01:00
|
|
|
layout: Layout;
|
2021-06-06 23:08:47 -04:00
|
|
|
lowBandwidth: boolean;
|
2021-06-24 11:28:16 -04:00
|
|
|
alwaysShowTimestamps: boolean;
|
|
|
|
|
showTwelveHourTimestamps: boolean;
|
|
|
|
|
readMarkerInViewThresholdMs: number;
|
|
|
|
|
readMarkerOutOfViewThresholdMs: number;
|
2021-06-16 20:40:47 -04:00
|
|
|
showHiddenEventsInTimeline: boolean;
|
2021-06-05 01:23:51 -04:00
|
|
|
showReadReceipts: boolean;
|
|
|
|
|
showRedactions: boolean;
|
|
|
|
|
showJoinLeaves: boolean;
|
|
|
|
|
showAvatarChanges: boolean;
|
|
|
|
|
showDisplaynameChanges: boolean;
|
2020-09-07 17:32:03 +01:00
|
|
|
matrixClientIsReady: boolean;
|
|
|
|
|
showUrlPreview?: boolean;
|
|
|
|
|
e2eStatus?: E2EStatus;
|
|
|
|
|
rejecting?: boolean;
|
|
|
|
|
rejectError?: Error;
|
2020-10-09 08:52:34 +01:00
|
|
|
hasPinnedWidgets?: boolean;
|
2021-11-16 15:43:18 +01:00
|
|
|
mainSplitContentType?: MainSplitContentType;
|
2020-12-17 19:50:59 +01:00
|
|
|
dragCounter: number;
|
2021-04-29 09:37:21 +01:00
|
|
|
// whether or not a spaces context switch brought us here,
|
|
|
|
|
// if it did we don't want the room to be marked as read as soon as it is loaded.
|
|
|
|
|
wasContextSwitch?: boolean;
|
2021-06-28 16:02:34 +01:00
|
|
|
editState?: EditorStateTransfer;
|
2021-10-01 15:35:54 +02:00
|
|
|
timelineRenderingType: TimelineRenderingType;
|
|
|
|
|
liveTimeline?: EventTimeline;
|
2020-09-07 17:32:03 +01:00
|
|
|
}
|
|
|
|
|
|
2021-03-08 19:35:10 -07:00
|
|
|
@replaceableComponent("structures.RoomView")
|
2021-10-01 15:35:54 +02:00
|
|
|
export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
2020-09-07 17:32:03 +01:00
|
|
|
private readonly dispatcherRef: string;
|
|
|
|
|
private readonly roomStoreToken: EventSubscription;
|
2021-06-05 01:23:51 -04:00
|
|
|
private settingWatchers: string[];
|
2020-09-07 17:32:03 +01:00
|
|
|
|
|
|
|
|
private unmounted = false;
|
|
|
|
|
private permalinkCreators: Record<string, RoomPermalinkCreator> = {};
|
|
|
|
|
private searchId: number;
|
|
|
|
|
|
|
|
|
|
private roomView = createRef<HTMLElement>();
|
|
|
|
|
private searchResultsPanel = createRef<ScrollPanel>();
|
|
|
|
|
private messagePanel: TimelinePanel;
|
|
|
|
|
|
2020-08-29 12:14:16 +01:00
|
|
|
static contextType = MatrixClientContext;
|
|
|
|
|
|
2020-08-29 12:51:37 +01:00
|
|
|
constructor(props, context) {
|
|
|
|
|
super(props, context);
|
2020-03-22 09:41:14 +00:00
|
|
|
|
|
|
|
|
const llMembers = this.context.hasLazyLoadMembersEnabled();
|
2020-08-29 12:14:16 +01:00
|
|
|
this.state = {
|
2016-06-14 14:38:45 +01:00
|
|
|
roomId: null,
|
|
|
|
|
roomLoading: true,
|
2017-06-05 09:52:39 +01:00
|
|
|
peekLoading: false,
|
2017-06-16 18:24:07 +01:00
|
|
|
shouldPeek: true,
|
2018-09-17 19:27:25 +02:00
|
|
|
membersLoaded: !llMembers,
|
2015-11-30 17:15:57 +00:00
|
|
|
numUnreadMessages: 0,
|
|
|
|
|
draggingFile: false,
|
|
|
|
|
searching: false,
|
|
|
|
|
searchResults: null,
|
2015-12-14 23:37:34 +00:00
|
|
|
callState: null,
|
2016-01-13 13:22:58 +00:00
|
|
|
guestsCanJoin: false,
|
2016-01-18 17:39:23 +00:00
|
|
|
canPeek: false,
|
2017-05-17 21:15:57 +01:00
|
|
|
showApps: false,
|
2017-10-11 18:43:24 -06:00
|
|
|
isPeeking: false,
|
2022-01-05 16:14:44 +01:00
|
|
|
showRightPanel: RightPanelStore.instance.isOpenForRoom,
|
2017-09-15 15:07:09 +01:00
|
|
|
joining: false,
|
2016-02-03 08:03:10 +00:00
|
|
|
atEndOfLiveTimeline: true,
|
2020-09-07 17:32:03 +01:00
|
|
|
atEndOfLiveTimelineInit: false,
|
2016-02-24 17:26:34 +00:00
|
|
|
showTopUnreadMessagesBar: false,
|
2017-01-23 16:01:39 +01:00
|
|
|
statusBarVisible: false,
|
2019-07-31 00:46:21 +01:00
|
|
|
canReact: false,
|
|
|
|
|
canReply: false,
|
2021-01-22 13:44:45 +01:00
|
|
|
layout: SettingsStore.getValue("layout"),
|
2021-06-06 23:08:47 -04:00
|
|
|
lowBandwidth: SettingsStore.getValue("lowBandwidth"),
|
2021-06-24 11:28:16 -04:00
|
|
|
alwaysShowTimestamps: SettingsStore.getValue("alwaysShowTimestamps"),
|
|
|
|
|
showTwelveHourTimestamps: SettingsStore.getValue("showTwelveHourTimestamps"),
|
|
|
|
|
readMarkerInViewThresholdMs: SettingsStore.getValue("readMarkerInViewThresholdMs"),
|
|
|
|
|
readMarkerOutOfViewThresholdMs: SettingsStore.getValue("readMarkerOutOfViewThresholdMs"),
|
2021-06-16 20:40:47 -04:00
|
|
|
showHiddenEventsInTimeline: SettingsStore.getValue("showHiddenEventsInTimeline"),
|
2021-06-05 01:23:51 -04:00
|
|
|
showReadReceipts: true,
|
|
|
|
|
showRedactions: true,
|
|
|
|
|
showJoinLeaves: true,
|
|
|
|
|
showAvatarChanges: true,
|
|
|
|
|
showDisplaynameChanges: true,
|
2020-05-19 13:17:34 +01:00
|
|
|
matrixClientIsReady: this.context && this.context.isInitialSyncComplete(),
|
2021-11-16 15:43:18 +01:00
|
|
|
mainSplitContentType: MainSplitContentType.Timeline,
|
2020-12-17 19:50:59 +01:00
|
|
|
dragCounter: 0,
|
2021-10-01 15:35:54 +02:00
|
|
|
timelineRenderingType: TimelineRenderingType.Room,
|
|
|
|
|
liveTimeline: undefined,
|
2019-07-31 00:46:21 +01:00
|
|
|
};
|
|
|
|
|
|
2019-01-17 10:29:37 +01:00
|
|
|
this.dispatcherRef = dis.register(this.onAction);
|
2020-03-22 09:41:14 +00:00
|
|
|
this.context.on("Room", this.onRoom);
|
|
|
|
|
this.context.on("Room.timeline", this.onRoomTimeline);
|
|
|
|
|
this.context.on("Room.name", this.onRoomName);
|
|
|
|
|
this.context.on("Room.accountData", this.onRoomAccountData);
|
|
|
|
|
this.context.on("RoomState.events", this.onRoomStateEvents);
|
|
|
|
|
this.context.on("RoomState.members", this.onRoomStateMember);
|
|
|
|
|
this.context.on("Room.myMembership", this.onMyMembership);
|
|
|
|
|
this.context.on("accountData", this.onAccountData);
|
|
|
|
|
this.context.on("crypto.keyBackupStatus", this.onKeyBackupStatus);
|
|
|
|
|
this.context.on("deviceVerificationChanged", this.onDeviceVerificationChanged);
|
|
|
|
|
this.context.on("userTrustStatusChanged", this.onUserVerificationChanged);
|
2020-04-09 13:43:30 +02:00
|
|
|
this.context.on("crossSigning.keysChanged", this.onCrossSigningKeysChanged);
|
2020-10-19 23:10:43 +02:00
|
|
|
this.context.on("Event.decrypted", this.onEventDecrypted);
|
2017-05-24 16:56:13 +01:00
|
|
|
// Start listening for RoomViewStore updates
|
2020-09-07 17:32:03 +01:00
|
|
|
this.roomStoreToken = RoomViewStore.addListener(this.onRoomViewStoreUpdate);
|
2022-01-05 16:14:44 +01:00
|
|
|
|
|
|
|
|
RightPanelStore.instance.on(UPDATE_EVENT, this.onRightPanelStoreUpdate);
|
2018-07-03 11:16:44 +01:00
|
|
|
|
2020-10-09 08:42:21 +01:00
|
|
|
WidgetEchoStore.on(UPDATE_EVENT, this.onWidgetEchoStoreUpdate);
|
|
|
|
|
WidgetStore.instance.on(UPDATE_EVENT, this.onWidgetStoreUpdate);
|
|
|
|
|
|
2021-06-05 01:23:51 -04:00
|
|
|
this.settingWatchers = [
|
2021-06-24 11:28:16 -04:00
|
|
|
SettingsStore.watchSetting("layout", null, (...[,,, value]) =>
|
|
|
|
|
this.setState({ layout: value as Layout }),
|
2021-06-05 01:23:51 -04:00
|
|
|
),
|
2021-06-24 11:28:16 -04:00
|
|
|
SettingsStore.watchSetting("lowBandwidth", null, (...[,,, value]) =>
|
|
|
|
|
this.setState({ lowBandwidth: value as boolean }),
|
2021-06-06 23:08:47 -04:00
|
|
|
),
|
2021-06-24 11:28:16 -04:00
|
|
|
SettingsStore.watchSetting("alwaysShowTimestamps", null, (...[,,, value]) =>
|
|
|
|
|
this.setState({ alwaysShowTimestamps: value as boolean }),
|
|
|
|
|
),
|
|
|
|
|
SettingsStore.watchSetting("showTwelveHourTimestamps", null, (...[,,, value]) =>
|
|
|
|
|
this.setState({ showTwelveHourTimestamps: value as boolean }),
|
|
|
|
|
),
|
|
|
|
|
SettingsStore.watchSetting("readMarkerInViewThresholdMs", null, (...[,,, value]) =>
|
|
|
|
|
this.setState({ readMarkerInViewThresholdMs: value as number }),
|
|
|
|
|
),
|
|
|
|
|
SettingsStore.watchSetting("readMarkerOutOfViewThresholdMs", null, (...[,,, value]) =>
|
|
|
|
|
this.setState({ readMarkerOutOfViewThresholdMs: value as number }),
|
2021-06-06 23:08:47 -04:00
|
|
|
),
|
2021-07-18 11:45:33 -04:00
|
|
|
SettingsStore.watchSetting("showHiddenEventsInTimeline", null, (...[,,, value]) =>
|
|
|
|
|
this.setState({ showHiddenEventsInTimeline: value as boolean }),
|
2021-06-16 20:40:47 -04:00
|
|
|
),
|
2021-06-05 01:23:51 -04:00
|
|
|
];
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2019-10-03 23:20:00 -06:00
|
|
|
|
2020-10-09 08:42:21 +01:00
|
|
|
private onWidgetStoreUpdate = () => {
|
2021-11-16 15:43:18 +01:00
|
|
|
if (!this.state.room) return;
|
|
|
|
|
this.checkWidgets(this.state.room);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private onWidgetEchoStoreUpdate = () => {
|
|
|
|
|
if (!this.state.room) return;
|
|
|
|
|
this.checkWidgets(this.state.room);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private onWidgetLayoutChange = () => {
|
|
|
|
|
if (!this.state.room) return;
|
2021-12-13 17:46:50 +01:00
|
|
|
dis.dispatch({
|
|
|
|
|
action: "appsDrawer",
|
|
|
|
|
show: true,
|
|
|
|
|
});
|
2021-11-29 17:06:15 +01:00
|
|
|
if (WidgetLayoutStore.instance.hasMaximisedWidget(this.state.room)) {
|
|
|
|
|
// Show chat in right panel when a widget is maximised
|
2022-01-05 16:14:44 +01:00
|
|
|
RightPanelStore.instance.setCard({ phase: RightPanelPhases.Timeline });
|
2022-01-05 17:25:41 +01:00
|
|
|
} else if (
|
|
|
|
|
RightPanelStore.instance.isOpenForRoom &&
|
|
|
|
|
RightPanelStore.instance.roomPhaseHistory.some(card => (card.phase === RightPanelPhases.Timeline))
|
|
|
|
|
) {
|
|
|
|
|
// hide chat in right panel when the widget is minimized
|
|
|
|
|
RightPanelStore.instance.setCard({ phase: RightPanelPhases.RoomSummary });
|
|
|
|
|
RightPanelStore.instance.togglePanel();
|
2021-11-29 17:06:15 +01:00
|
|
|
}
|
2021-11-16 15:43:18 +01:00
|
|
|
this.checkWidgets(this.state.room);
|
2021-06-29 13:11:58 +01:00
|
|
|
};
|
2020-10-09 08:42:21 +01:00
|
|
|
|
|
|
|
|
private checkWidgets = (room) => {
|
|
|
|
|
this.setState({
|
2021-11-16 17:09:19 +01:00
|
|
|
hasPinnedWidgets: WidgetLayoutStore.instance.hasPinnedWidgets(room),
|
|
|
|
|
mainSplitContentType: this.getMainSplitContentType(room),
|
|
|
|
|
showApps: this.shouldShowApps(room),
|
2021-01-18 20:26:47 -07:00
|
|
|
});
|
2020-10-09 08:42:21 +01:00
|
|
|
};
|
|
|
|
|
|
2021-11-16 17:09:19 +01:00
|
|
|
private getMainSplitContentType = (room) => {
|
2021-11-16 15:43:18 +01:00
|
|
|
// TODO-video check if video should be displayed in main panel
|
2021-11-16 17:09:19 +01:00
|
|
|
return (WidgetLayoutStore.instance.hasMaximisedWidget(room))
|
2021-11-16 15:43:18 +01:00
|
|
|
? MainSplitContentType.MaximisedWidget
|
|
|
|
|
: MainSplitContentType.Timeline;
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onReadReceiptsChange = () => {
|
2020-03-20 09:29:59 +00:00
|
|
|
this.setState({
|
|
|
|
|
showReadReceipts: SettingsStore.getValue("showReadReceipts", this.state.roomId),
|
|
|
|
|
});
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2020-03-20 09:29:59 +00:00
|
|
|
|
2021-10-22 09:30:36 +01:00
|
|
|
private onRoomViewStoreUpdate = async (initial?: boolean): Promise<void> => {
|
2017-05-24 16:56:13 +01:00
|
|
|
if (this.unmounted) {
|
|
|
|
|
return;
|
2016-06-14 11:37:04 +01:00
|
|
|
}
|
2019-01-17 10:29:37 +01:00
|
|
|
|
|
|
|
|
if (!initial && this.state.roomId !== RoomViewStore.getRoomId()) {
|
2017-09-11 17:57:52 +01:00
|
|
|
// RoomView explicitly does not support changing what room
|
|
|
|
|
// is being viewed: instead it should just be re-mounted when
|
|
|
|
|
// switching rooms. Therefore, if the room ID changes, we
|
|
|
|
|
// ignore this. We either need to do this or add code to handle
|
|
|
|
|
// saving the scroll position (otherwise we end up saving the
|
2017-09-11 18:39:30 +01:00
|
|
|
// scroll position against the wrong room).
|
|
|
|
|
|
|
|
|
|
// Given that doing the setState here would cause a bunch of
|
|
|
|
|
// unnecessary work, we just ignore the change since we know
|
|
|
|
|
// that if the current room ID has changed from what we thought
|
|
|
|
|
// it was, it means we're about to be unmounted.
|
2017-09-11 17:57:52 +01:00
|
|
|
return;
|
|
|
|
|
}
|
2019-01-17 10:29:37 +01:00
|
|
|
|
2020-03-20 09:29:59 +00:00
|
|
|
const roomId = RoomViewStore.getRoomId();
|
|
|
|
|
|
2021-10-01 15:35:54 +02:00
|
|
|
const newState: Pick<IRoomState, any> = {
|
2020-03-20 09:29:59 +00:00
|
|
|
roomId,
|
2019-01-17 10:29:37 +01:00
|
|
|
roomAlias: RoomViewStore.getRoomAlias(),
|
|
|
|
|
roomLoading: RoomViewStore.isRoomLoading(),
|
|
|
|
|
roomLoadError: RoomViewStore.getRoomLoadError(),
|
|
|
|
|
joining: RoomViewStore.isJoining(),
|
2020-10-28 12:47:59 +00:00
|
|
|
replyToEvent: RoomViewStore.getQuotingEvent(),
|
2020-05-19 13:17:34 +01:00
|
|
|
// we should only peek once we have a ready client
|
|
|
|
|
shouldPeek: this.state.matrixClientIsReady && RoomViewStore.shouldPeek(),
|
2020-03-20 09:29:59 +00:00
|
|
|
showReadReceipts: SettingsStore.getValue("showReadReceipts", roomId),
|
2021-06-05 01:23:51 -04:00
|
|
|
showRedactions: SettingsStore.getValue("showRedactions", roomId),
|
|
|
|
|
showJoinLeaves: SettingsStore.getValue("showJoinLeaves", roomId),
|
|
|
|
|
showAvatarChanges: SettingsStore.getValue("showAvatarChanges", roomId),
|
|
|
|
|
showDisplaynameChanges: SettingsStore.getValue("showDisplaynameChanges", roomId),
|
2021-04-29 09:37:21 +01:00
|
|
|
wasContextSwitch: RoomViewStore.getWasContextSwitch(),
|
2022-01-10 11:34:27 +00:00
|
|
|
initialEventId: null, // default to clearing this, will get set later in the method if needed
|
2017-06-08 14:17:49 +01:00
|
|
|
};
|
|
|
|
|
|
2021-10-22 09:30:36 +01:00
|
|
|
const initialEventId = RoomViewStore.getInitialEventId();
|
|
|
|
|
if (initialEventId) {
|
|
|
|
|
const room = this.context.getRoom(roomId);
|
|
|
|
|
let initialEvent = room?.findEventById(initialEventId);
|
|
|
|
|
// The event does not exist in the current sync data
|
|
|
|
|
// We need to fetch it to know whether to route this request
|
|
|
|
|
// to the main timeline or to a threaded one
|
|
|
|
|
// In the current state, if a thread does not exist in the sync data
|
|
|
|
|
// We will only display the event targeted by the `matrix.to` link
|
|
|
|
|
// and the root event.
|
|
|
|
|
// The rest will be lost for now, until the aggregation API on the server
|
|
|
|
|
// becomes available to fetch a whole thread
|
|
|
|
|
if (!initialEvent) {
|
|
|
|
|
initialEvent = await fetchInitialEvent(
|
|
|
|
|
this.context,
|
|
|
|
|
roomId,
|
|
|
|
|
initialEventId,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const thread = initialEvent?.getThread();
|
|
|
|
|
if (thread && !initialEvent?.isThreadRoot) {
|
2022-01-05 17:25:41 +01:00
|
|
|
showThread({
|
|
|
|
|
rootEvent: thread.rootEvent,
|
2021-10-22 09:30:36 +01:00
|
|
|
initialEvent,
|
2022-01-05 17:25:41 +01:00
|
|
|
highlighted: RoomViewStore.isInitialEventHighlighted(),
|
|
|
|
|
});
|
2021-10-22 09:30:36 +01:00
|
|
|
} else {
|
|
|
|
|
newState.initialEventId = initialEventId;
|
|
|
|
|
newState.isInitialEventHighlighted = RoomViewStore.isInitialEventHighlighted();
|
2021-11-25 15:40:38 +00:00
|
|
|
|
|
|
|
|
if (thread && initialEvent?.isThreadRoot) {
|
2022-01-05 17:25:41 +01:00
|
|
|
showThread({
|
|
|
|
|
rootEvent: thread.rootEvent,
|
2021-11-25 15:40:38 +00:00
|
|
|
initialEvent,
|
2022-01-05 17:25:41 +01:00
|
|
|
highlighted: RoomViewStore.isInitialEventHighlighted(),
|
|
|
|
|
});
|
2021-11-25 15:40:38 +00:00
|
|
|
}
|
2021-10-22 09:30:36 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-05 01:23:51 -04:00
|
|
|
// Add watchers for each of the settings we just looked up
|
|
|
|
|
this.settingWatchers = this.settingWatchers.concat([
|
2021-06-24 11:28:16 -04:00
|
|
|
SettingsStore.watchSetting("showReadReceipts", roomId, (...[,,, value]) =>
|
|
|
|
|
this.setState({ showReadReceipts: value as boolean }),
|
2021-06-05 01:23:51 -04:00
|
|
|
),
|
2021-06-24 11:28:16 -04:00
|
|
|
SettingsStore.watchSetting("showRedactions", roomId, (...[,,, value]) =>
|
|
|
|
|
this.setState({ showRedactions: value as boolean }),
|
2021-06-05 01:23:51 -04:00
|
|
|
),
|
2021-06-24 11:28:16 -04:00
|
|
|
SettingsStore.watchSetting("showJoinLeaves", roomId, (...[,,, value]) =>
|
|
|
|
|
this.setState({ showJoinLeaves: value as boolean }),
|
2021-06-05 01:23:51 -04:00
|
|
|
),
|
2021-06-24 11:28:16 -04:00
|
|
|
SettingsStore.watchSetting("showAvatarChanges", roomId, (...[,,, value]) =>
|
|
|
|
|
this.setState({ showAvatarChanges: value as boolean }),
|
2021-06-05 01:23:51 -04:00
|
|
|
),
|
2021-06-24 11:28:16 -04:00
|
|
|
SettingsStore.watchSetting("showDisplaynameChanges", roomId, (...[,,, value]) =>
|
|
|
|
|
this.setState({ showDisplaynameChanges: value as boolean }),
|
2021-06-05 01:23:51 -04:00
|
|
|
),
|
|
|
|
|
]);
|
|
|
|
|
|
2020-03-31 10:37:56 +01:00
|
|
|
if (!initial && this.state.shouldPeek && !newState.shouldPeek) {
|
|
|
|
|
// Stop peeking because we have joined this room now
|
|
|
|
|
this.context.stopPeeking();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-03 16:02:26 +01:00
|
|
|
// Temporary logging to diagnose https://github.com/vector-im/element-web/issues/4307
|
2021-09-21 17:48:09 +02:00
|
|
|
logger.log(
|
2017-06-14 16:53:21 +01:00
|
|
|
'RVS update:',
|
|
|
|
|
newState.roomId,
|
|
|
|
|
newState.roomAlias,
|
|
|
|
|
'loading?', newState.roomLoading,
|
|
|
|
|
'joining?', newState.joining,
|
2017-06-16 18:24:07 +01:00
|
|
|
'initial?', initial,
|
|
|
|
|
'shouldPeek?', newState.shouldPeek,
|
2017-06-14 16:53:21 +01:00
|
|
|
);
|
|
|
|
|
|
2017-06-14 16:48:34 +01:00
|
|
|
// NB: This does assume that the roomID will not change for the lifetime of
|
|
|
|
|
// the RoomView instance
|
|
|
|
|
if (initial) {
|
2020-03-22 09:41:14 +00:00
|
|
|
newState.room = this.context.getRoom(newState.roomId);
|
2017-09-08 18:11:13 +01:00
|
|
|
if (newState.room) {
|
2020-09-07 17:32:03 +01:00
|
|
|
newState.showApps = this.shouldShowApps(newState.room);
|
|
|
|
|
this.onRoomLoaded(newState.room);
|
2017-09-08 18:11:13 +01:00
|
|
|
}
|
2017-06-14 16:48:34 +01:00
|
|
|
}
|
|
|
|
|
|
2017-09-08 13:39:22 +01:00
|
|
|
if (this.state.roomId === null && newState.roomId !== null) {
|
|
|
|
|
// Get the scroll state for the new room
|
2017-09-07 17:08:36 +01:00
|
|
|
|
|
|
|
|
// If an event ID wasn't specified, default to the one saved for this room
|
2017-09-07 17:16:32 +01:00
|
|
|
// in the scroll state store. Assume initialEventPixelOffset should be set.
|
2017-09-07 17:08:36 +01:00
|
|
|
if (!newState.initialEventId) {
|
2020-04-19 19:14:08 -06:00
|
|
|
const roomScrollState = RoomScrollStateStore.getScrollState(newState.roomId);
|
2017-09-07 17:08:36 +01:00
|
|
|
if (roomScrollState) {
|
|
|
|
|
newState.initialEventId = roomScrollState.focussedEvent;
|
|
|
|
|
newState.initialEventPixelOffset = roomScrollState.pixelOffset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-08 15:38:58 +01:00
|
|
|
// Clear the search results when clicking a search result (which changes the
|
2017-06-08 15:47:41 +01:00
|
|
|
// currently scrolled to event, this.state.initialEventId).
|
|
|
|
|
if (this.state.initialEventId !== newState.initialEventId) {
|
2017-06-08 14:17:49 +01:00
|
|
|
newState.searchResults = null;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-08 17:06:46 +01:00
|
|
|
this.setState(newState);
|
|
|
|
|
// At this point, newState.roomId could be null (e.g. the alias might not
|
|
|
|
|
// have been resolved yet) so anything called here must handle this case.
|
2017-09-08 17:39:10 +01:00
|
|
|
|
2017-09-08 17:06:46 +01:00
|
|
|
// We pass the new state into this function for it to read: it needs to
|
|
|
|
|
// observe the new state but we don't want to put it in the setState
|
|
|
|
|
// callback because this would prevent the setStates from being batched,
|
|
|
|
|
// ie. cause it to render RoomView twice rather than the once that is necessary.
|
|
|
|
|
if (initial) {
|
2020-09-07 17:32:03 +01:00
|
|
|
this.setupRoom(newState.room, newState.roomId, newState.joining, newState.shouldPeek);
|
2017-09-08 17:06:46 +01:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2016-06-14 11:37:04 +01:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private getRoomId = () => {
|
|
|
|
|
// According to `onRoomViewStoreUpdate`, `state.roomId` can be null
|
2019-02-12 08:59:38 +00:00
|
|
|
// if we have a room alias we haven't resolved yet. To work around this,
|
|
|
|
|
// first we'll try the room object if it's there, and then fallback to
|
|
|
|
|
// the bare room ID. (We may want to update `state.roomId` after
|
|
|
|
|
// resolving aliases, so we could always trust it.)
|
|
|
|
|
return this.state.room ? this.state.room.roomId : this.state.roomId;
|
2020-09-07 17:32:03 +01:00
|
|
|
};
|
2019-02-12 08:59:38 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private getPermalinkCreatorForRoom(room: Room) {
|
|
|
|
|
if (this.permalinkCreators[room.roomId]) return this.permalinkCreators[room.roomId];
|
2019-04-09 12:01:09 -06:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
this.permalinkCreators[room.roomId] = new RoomPermalinkCreator(room);
|
2019-04-12 10:38:39 -06:00
|
|
|
if (this.state.room && room.roomId === this.state.room.roomId) {
|
|
|
|
|
// We want to watch for changes in the creator for the primary room in the view, but
|
|
|
|
|
// don't need to do so for search results.
|
2020-09-07 17:32:03 +01:00
|
|
|
this.permalinkCreators[room.roomId].start();
|
2019-04-12 10:38:39 -06:00
|
|
|
} else {
|
2020-09-07 17:32:03 +01:00
|
|
|
this.permalinkCreators[room.roomId].load();
|
2019-04-12 10:38:39 -06:00
|
|
|
}
|
2020-09-07 17:32:03 +01:00
|
|
|
return this.permalinkCreators[room.roomId];
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2019-04-09 12:01:09 -06:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private stopAllPermalinkCreators() {
|
|
|
|
|
if (!this.permalinkCreators) return;
|
|
|
|
|
for (const roomId of Object.keys(this.permalinkCreators)) {
|
|
|
|
|
this.permalinkCreators[roomId].stop();
|
2019-04-09 12:01:09 -06:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2019-04-09 12:01:09 -06:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private setupRoom(room: Room, roomId: string, joining: boolean, shouldPeek: boolean) {
|
2016-01-07 16:22:17 +00:00
|
|
|
// if this is an unknown room then we're in one of three states:
|
|
|
|
|
// - This is a room we can peek into (search engine) (we can /peek)
|
|
|
|
|
// - This is a room we can publicly join or were invited to. (we can /join)
|
|
|
|
|
// - This is a room we cannot join at all. (no action can help us)
|
|
|
|
|
// We can't try to /join because this may implicitly accept invites (!)
|
|
|
|
|
// We can /peek though. If it fails then we present the join UI. If it
|
|
|
|
|
// succeeds then great, show the preview (but we still may be able to /join!).
|
2016-06-14 11:37:04 +01:00
|
|
|
// Note that peeking works by room ID and room ID only, as opposed to joining
|
|
|
|
|
// which must be by alias or invite wherever possible (peeking currently does
|
|
|
|
|
// not work over federation).
|
2016-01-27 07:54:15 +00:00
|
|
|
|
2017-06-15 11:49:16 +01:00
|
|
|
// NB. We peek if we have never seen the room before (i.e. js-sdk does not know
|
|
|
|
|
// about it). We don't peek in the historical case where we were joined but are
|
|
|
|
|
// now not joined because the js-sdk peeking API will clobber our historical room,
|
|
|
|
|
// making it impossible to indicate a newly joined room.
|
2017-09-08 17:56:53 +01:00
|
|
|
if (!joining && roomId) {
|
2021-03-24 16:45:53 +00:00
|
|
|
if (!room && shouldPeek) {
|
2021-10-15 16:32:15 +02:00
|
|
|
logger.info("Attempting to peek into room %s", roomId);
|
2017-06-05 09:52:39 +01:00
|
|
|
this.setState({
|
|
|
|
|
peekLoading: true,
|
2017-10-11 18:43:24 -06:00
|
|
|
isPeeking: true, // this will change to false if peeking fails
|
2017-06-05 09:52:39 +01:00
|
|
|
});
|
2020-03-22 09:41:14 +00:00
|
|
|
this.context.peekInRoom(roomId).then((room) => {
|
2018-02-08 10:01:24 +00:00
|
|
|
if (this.unmounted) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-02-10 18:27:40 +00:00
|
|
|
this.setState({
|
2016-06-20 16:30:51 +01:00
|
|
|
room: room,
|
2017-06-05 09:52:39 +01:00
|
|
|
peekLoading: false,
|
2016-02-10 18:27:40 +00:00
|
|
|
});
|
2020-09-07 17:32:03 +01:00
|
|
|
this.onRoomLoaded(room);
|
2020-02-25 16:11:07 -07:00
|
|
|
}).catch((err) => {
|
2018-02-08 10:01:24 +00:00
|
|
|
if (this.unmounted) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-12 07:24:20 -06:00
|
|
|
// Stop peeking if anything went wrong
|
|
|
|
|
this.setState({
|
|
|
|
|
isPeeking: false,
|
|
|
|
|
});
|
2017-10-25 11:09:48 +01:00
|
|
|
|
2016-06-20 16:30:51 +01:00
|
|
|
// This won't necessarily be a MatrixError, but we duck-type
|
|
|
|
|
// here and say if it's got an 'errcode' key with the right value,
|
|
|
|
|
// it means we can't peek.
|
2020-02-25 16:11:07 -07:00
|
|
|
if (err.errcode === "M_GUEST_ACCESS_FORBIDDEN" || err.errcode === 'M_FORBIDDEN') {
|
2016-06-20 16:30:51 +01:00
|
|
|
// This is fine: the room just isn't peekable (we assume).
|
|
|
|
|
this.setState({
|
2017-06-05 09:52:39 +01:00
|
|
|
peekLoading: false,
|
2016-06-20 16:30:51 +01:00
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
throw err;
|
|
|
|
|
}
|
2018-02-08 10:01:24 +00:00
|
|
|
});
|
2018-07-12 15:19:25 +02:00
|
|
|
} else if (room) {
|
|
|
|
|
// Stop peeking because we have joined this room previously
|
2020-03-22 09:41:14 +00:00
|
|
|
this.context.stopPeeking();
|
2021-06-29 13:11:58 +01:00
|
|
|
this.setState({ isPeeking: false });
|
2016-06-20 16:30:51 +01:00
|
|
|
}
|
2016-02-10 18:27:40 +00:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private shouldShowApps(room: Room) {
|
2021-01-22 17:00:30 -07:00
|
|
|
if (!BROWSER_SUPPORTS_SANDBOX || !room) return false;
|
2017-07-12 10:21:43 +01:00
|
|
|
|
2017-10-26 11:17:13 -07:00
|
|
|
// Check if user has previously chosen to hide the app drawer for this
|
|
|
|
|
// room. If so, do not show apps
|
2021-11-15 12:49:34 +01:00
|
|
|
const hideWidgetKey = room.roomId + "_hide_widget_drawer";
|
|
|
|
|
const hideWidgetDrawer = localStorage.getItem(hideWidgetKey);
|
2017-10-24 16:21:46 -07:00
|
|
|
|
2021-11-15 12:49:34 +01:00
|
|
|
// If unset show the Tray
|
|
|
|
|
// Otherwise (in case the user set hideWidgetDrawer by clicking the button) follow the parameter.
|
|
|
|
|
const isManuallyShown = hideWidgetDrawer ? hideWidgetDrawer === "false": true;
|
2021-01-22 17:00:30 -07:00
|
|
|
|
|
|
|
|
const widgets = WidgetLayoutStore.instance.getContainerWidgets(room, Container.Top);
|
2021-11-15 12:49:34 +01:00
|
|
|
return isManuallyShown && widgets.length > 0;
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2017-06-13 15:19:06 +02:00
|
|
|
|
2020-08-29 12:14:16 +01:00
|
|
|
componentDidMount() {
|
2021-01-31 16:09:11 +00:00
|
|
|
this.onRoomViewStoreUpdate(true);
|
|
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
const call = this.getCallForRoom();
|
2020-10-09 18:56:07 +01:00
|
|
|
const callState = call ? call.state : null;
|
2016-10-17 14:03:37 +01:00
|
|
|
this.setState({
|
2017-10-11 17:56:17 +01:00
|
|
|
callState: callState,
|
2016-10-17 14:03:37 +01:00
|
|
|
});
|
|
|
|
|
|
2021-12-15 18:06:37 +01:00
|
|
|
CallHandler.instance.on(CallHandlerEvent.CallState, this.onCallState);
|
2017-04-29 06:25:30 +01:00
|
|
|
window.addEventListener('beforeunload', this.onPageUnload);
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2016-10-17 14:03:37 +01:00
|
|
|
|
2020-08-29 12:14:16 +01:00
|
|
|
shouldComponentUpdate(nextProps, nextState) {
|
2021-05-19 14:32:49 +01:00
|
|
|
const hasPropsDiff = objectHasDiff(this.props, nextProps);
|
|
|
|
|
|
2021-06-16 12:04:37 +01:00
|
|
|
const { upgradeRecommendation, ...state } = this.state;
|
|
|
|
|
const { upgradeRecommendation: newUpgradeRecommendation, ...newState } = nextState;
|
2021-05-19 14:32:49 +01:00
|
|
|
|
|
|
|
|
const hasStateDiff =
|
2021-06-16 12:04:37 +01:00
|
|
|
newUpgradeRecommendation?.needsUpgrade !== upgradeRecommendation?.needsUpgrade ||
|
|
|
|
|
objectHasDiff(state, newState);
|
2021-05-19 14:32:49 +01:00
|
|
|
|
|
|
|
|
return hasPropsDiff || hasStateDiff;
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2016-03-07 22:27:35 +00:00
|
|
|
|
2020-08-29 12:14:16 +01:00
|
|
|
componentDidUpdate() {
|
2020-09-07 17:32:03 +01:00
|
|
|
if (this.roomView.current) {
|
|
|
|
|
const roomView = this.roomView.current;
|
2016-10-17 14:03:37 +01:00
|
|
|
if (!roomView.ondrop) {
|
|
|
|
|
roomView.addEventListener('drop', this.onDrop);
|
|
|
|
|
roomView.addEventListener('dragover', this.onDragOver);
|
2020-12-17 19:50:59 +01:00
|
|
|
roomView.addEventListener('dragenter', this.onDragEnter);
|
|
|
|
|
roomView.addEventListener('dragleave', this.onDragLeave);
|
2016-10-17 14:03:37 +01:00
|
|
|
}
|
|
|
|
|
}
|
2019-03-28 09:50:17 -06:00
|
|
|
|
|
|
|
|
// Note: We check the ref here with a flag because componentDidMount, despite
|
|
|
|
|
// documentation, does not define our messagePanel ref. It looks like our spinner
|
|
|
|
|
// in render() prevents the ref from being set on first mount, so we try and
|
|
|
|
|
// catch the messagePanel when it does mount. Because we only want the ref once,
|
|
|
|
|
// we use a boolean flag to avoid duplicate work.
|
2020-09-07 17:32:03 +01:00
|
|
|
if (this.messagePanel && !this.state.atEndOfLiveTimelineInit) {
|
2019-03-26 14:22:48 -06:00
|
|
|
this.setState({
|
|
|
|
|
atEndOfLiveTimelineInit: true,
|
2020-09-07 17:32:03 +01:00
|
|
|
atEndOfLiveTimeline: this.messagePanel.isAtEndOfLiveTimeline(),
|
2019-03-26 14:22:48 -06:00
|
|
|
});
|
|
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2016-10-17 14:03:37 +01:00
|
|
|
|
2020-08-29 12:14:16 +01:00
|
|
|
componentWillUnmount() {
|
2016-01-11 11:38:04 +00:00
|
|
|
// set a boolean to say we've been unmounted, which any pending
|
|
|
|
|
// promises can use to throw away their results.
|
|
|
|
|
//
|
|
|
|
|
// (We could use isMounted, but facebook have deprecated that.)
|
|
|
|
|
this.unmounted = true;
|
|
|
|
|
|
2021-11-30 19:09:13 +01:00
|
|
|
CallHandler.instance.removeListener(CallHandlerEvent.CallState, this.onCallState);
|
|
|
|
|
|
2016-11-04 09:28:35 +00:00
|
|
|
// update the scroll map before we get unmounted
|
2017-09-08 13:39:22 +01:00
|
|
|
if (this.state.roomId) {
|
2020-09-07 17:32:03 +01:00
|
|
|
RoomScrollStateStore.setScrollState(this.state.roomId, this.getScrollState());
|
2017-09-08 13:39:22 +01:00
|
|
|
}
|
2016-11-04 09:28:35 +00:00
|
|
|
|
2020-03-31 12:51:03 +01:00
|
|
|
if (this.state.shouldPeek) {
|
|
|
|
|
this.context.stopPeeking();
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-21 15:44:20 +01:00
|
|
|
// stop tracking room changes to format permalinks
|
2020-09-07 17:32:03 +01:00
|
|
|
this.stopAllPermalinkCreators();
|
2019-02-21 15:44:20 +01:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
if (this.roomView.current) {
|
2016-01-15 15:23:02 +00:00
|
|
|
// disconnect the D&D event listeners from the room view. This
|
|
|
|
|
// is really just for hygiene - we're going to be
|
2015-12-18 10:19:07 +00:00
|
|
|
// deleted anyway, so it doesn't matter if the event listeners
|
|
|
|
|
// don't get cleaned up.
|
2020-09-07 17:32:03 +01:00
|
|
|
const roomView = this.roomView.current;
|
2016-01-15 15:23:02 +00:00
|
|
|
roomView.removeEventListener('drop', this.onDrop);
|
|
|
|
|
roomView.removeEventListener('dragover', this.onDragOver);
|
2020-12-17 20:25:12 +01:00
|
|
|
roomView.removeEventListener('dragenter', this.onDragEnter);
|
|
|
|
|
roomView.removeEventListener('dragleave', this.onDragLeave);
|
2015-11-30 17:15:57 +00:00
|
|
|
}
|
2019-01-17 10:29:37 +01:00
|
|
|
dis.unregister(this.dispatcherRef);
|
2020-03-22 09:41:14 +00:00
|
|
|
if (this.context) {
|
|
|
|
|
this.context.removeListener("Room", this.onRoom);
|
|
|
|
|
this.context.removeListener("Room.timeline", this.onRoomTimeline);
|
|
|
|
|
this.context.removeListener("Room.name", this.onRoomName);
|
|
|
|
|
this.context.removeListener("Room.accountData", this.onRoomAccountData);
|
|
|
|
|
this.context.removeListener("RoomState.events", this.onRoomStateEvents);
|
|
|
|
|
this.context.removeListener("Room.myMembership", this.onMyMembership);
|
|
|
|
|
this.context.removeListener("RoomState.members", this.onRoomStateMember);
|
|
|
|
|
this.context.removeListener("accountData", this.onAccountData);
|
|
|
|
|
this.context.removeListener("crypto.keyBackupStatus", this.onKeyBackupStatus);
|
|
|
|
|
this.context.removeListener("deviceVerificationChanged", this.onDeviceVerificationChanged);
|
|
|
|
|
this.context.removeListener("userTrustStatusChanged", this.onUserVerificationChanged);
|
2020-04-09 13:43:30 +02:00
|
|
|
this.context.removeListener("crossSigning.keysChanged", this.onCrossSigningKeysChanged);
|
2020-10-19 23:10:43 +02:00
|
|
|
this.context.removeListener("Event.decrypted", this.onEventDecrypted);
|
2015-11-30 17:15:57 +00:00
|
|
|
}
|
2015-12-13 04:32:48 +00:00
|
|
|
|
2017-04-29 06:25:30 +01:00
|
|
|
window.removeEventListener('beforeunload', this.onPageUnload);
|
2016-01-08 03:22:38 +00:00
|
|
|
|
2017-06-01 18:01:30 +01:00
|
|
|
// Remove RoomStore listener
|
2020-09-07 17:32:03 +01:00
|
|
|
if (this.roomStoreToken) {
|
|
|
|
|
this.roomStoreToken.remove();
|
2017-06-01 18:01:30 +01:00
|
|
|
}
|
|
|
|
|
|
2022-01-05 16:14:44 +01:00
|
|
|
RightPanelStore.instance.off(UPDATE_EVENT, this.onRightPanelStoreUpdate);
|
2020-10-09 08:42:21 +01:00
|
|
|
WidgetEchoStore.removeListener(UPDATE_EVENT, this.onWidgetEchoStoreUpdate);
|
|
|
|
|
WidgetStore.instance.removeListener(UPDATE_EVENT, this.onWidgetStoreUpdate);
|
2018-07-03 11:16:44 +01:00
|
|
|
|
2021-01-22 17:00:30 -07:00
|
|
|
if (this.state.room) {
|
2021-01-22 17:03:36 -07:00
|
|
|
WidgetLayoutStore.instance.off(
|
|
|
|
|
WidgetLayoutStore.emissionForRoom(this.state.room),
|
|
|
|
|
this.onWidgetLayoutChange,
|
|
|
|
|
);
|
2021-01-22 17:00:30 -07:00
|
|
|
}
|
|
|
|
|
|
2021-12-15 18:06:37 +01:00
|
|
|
CallHandler.instance.off(CallHandlerEvent.CallState, this.onCallState);
|
|
|
|
|
|
2021-07-01 18:35:38 +01:00
|
|
|
// cancel any pending calls to the throttled updated
|
|
|
|
|
this.updateRoomMembers.cancel();
|
2016-08-10 13:39:47 +01:00
|
|
|
|
2021-06-05 01:23:51 -04:00
|
|
|
for (const watcher of this.settingWatchers) {
|
|
|
|
|
SettingsStore.unwatchSetting(watcher);
|
|
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2020-05-26 15:56:16 +01:00
|
|
|
|
2021-04-06 17:26:32 +01:00
|
|
|
private onUserScroll = () => {
|
|
|
|
|
if (this.state.initialEventId && this.state.isInitialEventHighlighted) {
|
|
|
|
|
dis.dispatch({
|
2021-11-25 17:49:43 -03:00
|
|
|
action: Action.ViewRoom,
|
2021-04-06 17:26:32 +01:00
|
|
|
room_id: this.state.room.roomId,
|
|
|
|
|
event_id: this.state.initialEventId,
|
|
|
|
|
highlighted: false,
|
2021-06-16 10:01:23 +01:00
|
|
|
replyingToEvent: this.state.replyToEvent,
|
2021-04-06 17:26:32 +01:00
|
|
|
});
|
|
|
|
|
}
|
2021-06-29 13:11:58 +01:00
|
|
|
};
|
2021-04-06 17:26:32 +01:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onRightPanelStoreUpdate = () => {
|
2020-03-20 00:18:24 +00:00
|
|
|
this.setState({
|
2022-01-05 16:14:44 +01:00
|
|
|
showRightPanel: RightPanelStore.instance.isOpenForRoom,
|
2020-03-20 00:18:24 +00:00
|
|
|
});
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2020-03-20 00:18:24 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onPageUnload = event => {
|
2019-04-01 16:42:41 +01:00
|
|
|
if (ContentMessages.sharedInstance().getCurrentUploads().length > 0) {
|
2017-04-29 06:25:30 +01:00
|
|
|
return event.returnValue =
|
2017-05-23 15:16:31 +01:00
|
|
|
_t("You seem to be uploading files, are you sure you want to quit?");
|
2020-09-07 17:32:03 +01:00
|
|
|
} else if (this.getCallForRoom() && this.state.callState !== 'ended') {
|
2017-05-03 16:36:57 +01:00
|
|
|
return event.returnValue =
|
2017-05-23 15:16:31 +01:00
|
|
|
_t("You seem to be in a call, are you sure you want to quit?");
|
2017-04-29 06:25:30 +01:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2017-04-29 06:25:30 +01:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onReactKeyDown = ev => {
|
2020-04-14 15:24:41 +01:00
|
|
|
let handled = false;
|
|
|
|
|
|
2021-03-01 21:43:00 +13:00
|
|
|
const action = getKeyBindingsManager().getRoomAction(ev);
|
2021-02-28 20:13:34 +13:00
|
|
|
switch (action) {
|
2021-03-01 21:43:00 +13:00
|
|
|
case RoomAction.DismissReadMarker:
|
2021-02-28 20:13:34 +13:00
|
|
|
this.messagePanel.forgetReadMarker();
|
|
|
|
|
this.jumpToLiveTimeline();
|
|
|
|
|
handled = true;
|
2020-03-24 21:35:17 -05:00
|
|
|
break;
|
2021-03-01 22:15:05 +13:00
|
|
|
case RoomAction.JumpToOldestUnread:
|
2021-02-28 20:13:34 +13:00
|
|
|
this.jumpToReadMarker();
|
|
|
|
|
handled = true;
|
2020-05-13 10:38:32 +01:00
|
|
|
break;
|
2021-03-01 21:43:00 +13:00
|
|
|
case RoomAction.UploadFile:
|
2021-02-28 20:13:34 +13:00
|
|
|
dis.dispatch({ action: "upload_file" }, true);
|
|
|
|
|
handled = true;
|
2020-05-13 10:38:32 +01:00
|
|
|
break;
|
2016-10-17 14:03:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (handled) {
|
|
|
|
|
ev.stopPropagation();
|
|
|
|
|
ev.preventDefault();
|
|
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2020-08-24 14:04:20 +02:00
|
|
|
|
2021-11-30 19:09:13 +01:00
|
|
|
private onCallState = (roomId: string): void => {
|
|
|
|
|
// don't filter out payloads for room IDs other than props.room because
|
|
|
|
|
// we may be interested in the conf 1:1 room
|
|
|
|
|
|
|
|
|
|
if (!roomId) return;
|
|
|
|
|
const call = this.getCallForRoom();
|
|
|
|
|
this.setState({ callState: call ? call.state : null });
|
|
|
|
|
};
|
|
|
|
|
|
2022-01-05 15:59:19 +00:00
|
|
|
private onAction = async (payload: ActionPayload): Promise<void> => {
|
2015-11-30 17:15:57 +00:00
|
|
|
switch (payload.action) {
|
|
|
|
|
case 'message_sent':
|
2020-11-05 15:39:22 +00:00
|
|
|
this.checkDesktopNotifications();
|
2020-08-24 10:44:32 +02:00
|
|
|
break;
|
2018-01-04 18:41:47 +00:00
|
|
|
case 'post_sticker_message':
|
2020-09-07 17:32:03 +01:00
|
|
|
this.injectSticker(
|
|
|
|
|
payload.data.content.url,
|
|
|
|
|
payload.data.content.info,
|
2021-12-03 08:22:13 +00:00
|
|
|
payload.data.description || payload.data.name,
|
|
|
|
|
payload.data.threadId);
|
2020-09-07 17:32:03 +01:00
|
|
|
break;
|
2017-12-03 19:44:59 +00:00
|
|
|
case 'picture_snapshot':
|
2020-09-07 17:32:03 +01:00
|
|
|
ContentMessages.sharedInstance().sendContentListToRoom(
|
2021-11-03 08:43:24 +00:00
|
|
|
[payload.file], this.state.room.roomId, null, this.context);
|
2019-09-10 08:38:51 +01:00
|
|
|
break;
|
2019-02-24 17:44:55 -07:00
|
|
|
case 'notifier_enabled':
|
2021-03-05 13:20:50 -07:00
|
|
|
case Action.UploadStarted:
|
|
|
|
|
case Action.UploadFinished:
|
|
|
|
|
case Action.UploadCanceled:
|
2015-11-30 17:15:57 +00:00
|
|
|
this.forceUpdate();
|
|
|
|
|
break;
|
2017-05-17 21:15:57 +01:00
|
|
|
case 'appsDrawer':
|
|
|
|
|
this.setState({
|
2017-06-28 12:21:05 +01:00
|
|
|
showApps: payload.show,
|
2017-05-17 21:15:57 +01:00
|
|
|
});
|
2015-11-30 17:15:57 +00:00
|
|
|
break;
|
2019-09-09 09:34:08 +01:00
|
|
|
case 'reply_to_event':
|
2021-10-19 16:05:34 +01:00
|
|
|
if (this.state.searchResults
|
|
|
|
|
&& payload.event.getRoomId() === this.state.roomId
|
|
|
|
|
&& !this.unmounted
|
|
|
|
|
&& payload.context === TimelineRenderingType.Room) {
|
2019-09-09 09:34:08 +01:00
|
|
|
this.onCancelSearchClick();
|
|
|
|
|
}
|
|
|
|
|
break;
|
2020-02-28 23:12:10 +00:00
|
|
|
case 'quote':
|
|
|
|
|
if (this.state.searchResults) {
|
|
|
|
|
const roomId = payload.event.getRoomId();
|
|
|
|
|
if (roomId === this.state.roomId) {
|
|
|
|
|
this.onCancelSearchClick();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setImmediate(() => {
|
|
|
|
|
dis.dispatch({
|
2021-11-25 17:49:43 -03:00
|
|
|
action: Action.ViewRoom,
|
2020-02-28 23:12:10 +00:00
|
|
|
room_id: roomId,
|
|
|
|
|
deferred_action: payload,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
break;
|
2020-05-19 13:17:34 +01:00
|
|
|
case 'sync_state':
|
|
|
|
|
if (!this.state.matrixClientIsReady) {
|
|
|
|
|
this.setState({
|
|
|
|
|
matrixClientIsReady: this.context && this.context.isInitialSyncComplete(),
|
|
|
|
|
}, () => {
|
|
|
|
|
// send another "initial" RVS update to trigger peeking if needed
|
2020-09-07 17:32:03 +01:00
|
|
|
this.onRoomViewStoreUpdate(true);
|
2020-05-19 13:17:34 +01:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
break;
|
2021-01-17 08:28:52 +01:00
|
|
|
case 'focus_search':
|
|
|
|
|
this.onSearchClick();
|
|
|
|
|
break;
|
2021-06-28 16:02:34 +01:00
|
|
|
|
2021-10-01 15:35:54 +02:00
|
|
|
case Action.EditEvent: {
|
|
|
|
|
// Quit early if we're trying to edit events in wrong rendering context
|
|
|
|
|
if (payload.timelineRenderingType !== this.state.timelineRenderingType) return;
|
2021-06-28 16:02:34 +01:00
|
|
|
const editState = payload.event ? new EditorStateTransfer(payload.event) : null;
|
|
|
|
|
this.setState({ editState }, () => {
|
|
|
|
|
if (payload.event) {
|
|
|
|
|
this.messagePanel?.scrollToEventIfNeeded(payload.event.getId());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case Action.ComposerInsert: {
|
2021-10-25 13:43:54 +02:00
|
|
|
if (payload.composerType) break;
|
2022-01-05 15:59:19 +00:00
|
|
|
|
|
|
|
|
if (this.state.searching && payload.timelineRenderingType === TimelineRenderingType.Room) {
|
|
|
|
|
// we don't have the composer rendered in this state, so bring it back first
|
|
|
|
|
await this.onCancelSearchClick();
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-28 16:02:34 +01:00
|
|
|
// re-dispatch to the correct composer
|
2021-07-08 18:31:47 +02:00
|
|
|
dis.dispatch({
|
|
|
|
|
...payload,
|
2021-10-25 13:43:54 +02:00
|
|
|
composerType: this.state.editState ? ComposerType.Edit : ComposerType.Send,
|
2021-07-08 18:31:47 +02:00
|
|
|
});
|
2021-06-28 16:02:34 +01:00
|
|
|
break;
|
|
|
|
|
}
|
2021-06-28 16:03:52 +01:00
|
|
|
|
2021-07-08 17:33:49 +02:00
|
|
|
case Action.FocusAComposer: {
|
|
|
|
|
// re-dispatch to the correct composer
|
2021-07-08 17:40:41 +02:00
|
|
|
dis.fire(this.state.editState ? Action.FocusEditMessageComposer : Action.FocusSendMessageComposer);
|
2021-06-28 16:02:34 +01:00
|
|
|
break;
|
|
|
|
|
}
|
2021-06-28 16:03:52 +01:00
|
|
|
|
|
|
|
|
case "scroll_to_bottom":
|
2021-12-06 15:32:15 +01:00
|
|
|
if (payload.timelineRenderingType === TimelineRenderingType.Room) {
|
2021-10-18 21:50:06 +02:00
|
|
|
this.messagePanel?.jumpToLiveTimeline();
|
|
|
|
|
}
|
2021-06-28 16:03:52 +01:00
|
|
|
break;
|
2015-11-30 17:15:57 +00:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onRoomTimeline = (ev: MatrixEvent, room: Room, toStartOfTimeline: boolean, removed, data) => {
|
2016-01-11 11:38:04 +00:00
|
|
|
if (this.unmounted) return;
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2016-01-27 07:54:15 +00:00
|
|
|
// ignore events for other rooms
|
2021-07-15 18:02:02 +01:00
|
|
|
if (!room || room.roomId !== this.state.room?.roomId) return;
|
2016-01-27 07:54:15 +00:00
|
|
|
|
2016-09-08 22:48:44 +01:00
|
|
|
// ignore events from filtered timelines
|
|
|
|
|
if (data.timeline.getTimelineSet() !== room.getUnfilteredTimelineSet()) return;
|
|
|
|
|
|
2016-07-18 10:47:03 +01:00
|
|
|
if (ev.getType() === "org.matrix.room.preview_urls") {
|
2020-09-07 17:32:03 +01:00
|
|
|
this.updatePreviewUrlVisibility(room);
|
2016-07-18 01:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
2019-02-01 19:14:11 +01:00
|
|
|
if (ev.getType() === "m.room.encryption") {
|
2020-09-07 17:32:03 +01:00
|
|
|
this.updateE2EStatus(room);
|
2019-02-01 19:14:11 +01:00
|
|
|
}
|
|
|
|
|
|
2016-01-27 07:54:15 +00:00
|
|
|
// ignore anything but real-time updates at the end of the room:
|
|
|
|
|
// updates from pagination will happen when the paginate completes.
|
|
|
|
|
if (toStartOfTimeline || !data || !data.liveEvent) return;
|
2015-11-30 17:15:57 +00:00
|
|
|
|
|
|
|
|
// no point handling anything while we're waiting for the join to finish:
|
|
|
|
|
// we'll only be showing a spinner.
|
|
|
|
|
if (this.state.joining) return;
|
|
|
|
|
|
2021-07-15 18:02:02 +01:00
|
|
|
if (!ev.isBeingDecrypted() && !ev.isDecryptionFailure()) {
|
|
|
|
|
this.handleEffects(ev);
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-22 09:41:14 +00:00
|
|
|
if (ev.getSender() !== this.context.credentials.userId) {
|
2015-11-30 17:15:57 +00:00
|
|
|
// update unread count when scrolled up
|
2016-02-03 08:03:10 +00:00
|
|
|
if (!this.state.searchResults && this.state.atEndOfLiveTimeline) {
|
2016-01-27 07:54:15 +00:00
|
|
|
// no change
|
2021-06-05 01:25:43 -04:00
|
|
|
} else if (!shouldHideEvent(ev, this.state)) {
|
2016-04-18 01:34:45 +01:00
|
|
|
this.setState((state, props) => {
|
2021-06-29 13:11:58 +01:00
|
|
|
return { numUnreadMessages: state.numUnreadMessages + 1 };
|
2016-01-27 07:54:15 +00:00
|
|
|
});
|
2015-11-30 17:15:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2020-10-21 13:37:36 +02:00
|
|
|
|
2021-07-15 18:02:02 +01:00
|
|
|
private onEventDecrypted = (ev: MatrixEvent) => {
|
|
|
|
|
if (!this.state.room || !this.state.matrixClientIsReady) return; // not ready at all
|
|
|
|
|
if (ev.getRoomId() !== this.state.room.roomId) return; // not for us
|
2020-10-21 13:37:36 +02:00
|
|
|
if (ev.isDecryptionFailure()) return;
|
2020-10-21 16:15:15 +02:00
|
|
|
this.handleEffects(ev);
|
2020-10-19 23:10:43 +02:00
|
|
|
};
|
|
|
|
|
|
2021-07-15 18:02:02 +01:00
|
|
|
private handleEffects = (ev: MatrixEvent) => {
|
2020-12-07 16:54:09 -07:00
|
|
|
const notifState = RoomNotificationStateStore.instance.getRoomState(this.state.room);
|
|
|
|
|
if (!notifState.isUnread) return;
|
|
|
|
|
|
2020-11-27 14:54:21 +01:00
|
|
|
CHAT_EFFECTS.forEach(effect => {
|
2020-10-26 16:37:45 +01:00
|
|
|
if (containsEmoji(ev.getContent(), effect.emojis) || ev.getContent().msgtype === effect.msgType) {
|
2021-11-18 12:47:11 +00:00
|
|
|
// For initial threads launch, chat effects are disabled
|
|
|
|
|
// see #19731
|
|
|
|
|
if (!SettingsStore.getValue("feature_thread") || !ev.isThreadRelation) {
|
|
|
|
|
dis.dispatch({ action: `effects.${effect.command}` });
|
|
|
|
|
}
|
2020-10-26 16:37:45 +01:00
|
|
|
}
|
2020-12-07 16:54:09 -07:00
|
|
|
});
|
2020-10-19 23:10:43 +02:00
|
|
|
};
|
2016-01-18 19:56:35 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onRoomName = (room: Room) => {
|
2017-02-17 11:44:56 +00:00
|
|
|
if (this.state.room && room.roomId == this.state.room.roomId) {
|
|
|
|
|
this.forceUpdate();
|
|
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2017-02-17 11:44:56 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onKeyBackupStatus = () => {
|
2019-01-02 15:32:14 -06:00
|
|
|
// Key backup status changes affect whether the in-room recovery
|
|
|
|
|
// reminder is displayed.
|
2018-12-06 15:39:59 -06:00
|
|
|
this.forceUpdate();
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2018-12-06 15:39:59 -06:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
public canResetTimeline = () => {
|
|
|
|
|
if (!this.messagePanel) {
|
2017-03-22 15:06:52 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
2020-09-07 17:32:03 +01:00
|
|
|
return this.messagePanel.canResetTimeline();
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2017-03-22 15:06:52 +00:00
|
|
|
|
2016-02-10 18:27:40 +00:00
|
|
|
// called when state.room is first initialised (either at initial load,
|
|
|
|
|
// after a successful peek, or after we join the room).
|
2020-09-07 17:32:03 +01:00
|
|
|
private onRoomLoaded = (room: Room) => {
|
2021-07-15 12:10:54 +01:00
|
|
|
if (this.unmounted) return;
|
2021-01-22 17:00:30 -07:00
|
|
|
// Attach a widget store listener only when we get a room
|
|
|
|
|
WidgetLayoutStore.instance.on(WidgetLayoutStore.emissionForRoom(room), this.onWidgetLayoutChange);
|
|
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
this.calculatePeekRules(room);
|
|
|
|
|
this.updatePreviewUrlVisibility(room);
|
|
|
|
|
this.loadMembersIfJoined(room);
|
|
|
|
|
this.calculateRecommendedVersion(room);
|
|
|
|
|
this.updateE2EStatus(room);
|
|
|
|
|
this.updatePermissions(room);
|
2020-10-09 08:42:21 +01:00
|
|
|
this.checkWidgets(room);
|
2021-10-01 15:35:54 +02:00
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
liveTimeline: room.getLiveTimeline(),
|
|
|
|
|
});
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2019-01-28 17:21:33 -07:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private async calculateRecommendedVersion(room: Room) {
|
2021-07-15 12:10:54 +01:00
|
|
|
const upgradeRecommendation = await room.getRecommendedVersion();
|
|
|
|
|
if (this.unmounted) return;
|
|
|
|
|
this.setState({ upgradeRecommendation });
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2018-09-13 18:43:24 +02:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private async loadMembersIfJoined(room: Room) {
|
2018-09-13 18:43:24 +02:00
|
|
|
// lazy load members if enabled
|
2020-03-22 09:41:14 +00:00
|
|
|
if (this.context.hasLazyLoadMembersEnabled()) {
|
2018-09-13 18:43:24 +02:00
|
|
|
if (room && room.getMyMembership() === 'join') {
|
2018-09-14 18:35:16 +02:00
|
|
|
try {
|
|
|
|
|
await room.loadMembersIfNeeded();
|
|
|
|
|
if (!this.unmounted) {
|
2021-06-29 13:11:58 +01:00
|
|
|
this.setState({ membersLoaded: true });
|
2018-09-14 18:35:16 +02:00
|
|
|
}
|
2018-09-17 20:01:55 +02:00
|
|
|
} catch (err) {
|
2018-09-13 18:43:24 +02:00
|
|
|
const errorMessage = `Fetching room members for ${room.roomId} failed.` +
|
|
|
|
|
" Room members will appear incomplete.";
|
2021-10-15 16:30:53 +02:00
|
|
|
logger.error(errorMessage);
|
|
|
|
|
logger.error(err);
|
2018-09-14 18:35:16 +02:00
|
|
|
}
|
2018-09-13 18:43:24 +02:00
|
|
|
}
|
2017-03-01 15:41:13 +00:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2017-03-01 15:41:13 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private calculatePeekRules(room: Room) {
|
2017-10-11 17:56:17 +01:00
|
|
|
const guestAccessEvent = room.currentState.getStateEvents("m.room.guest_access", "");
|
2016-01-18 20:05:33 +00:00
|
|
|
if (guestAccessEvent && guestAccessEvent.getContent().guest_access === "can_join") {
|
|
|
|
|
this.setState({
|
2017-10-11 17:56:17 +01:00
|
|
|
guestsCanJoin: true,
|
2016-01-18 20:05:33 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-11 17:56:17 +01:00
|
|
|
const historyVisibility = room.currentState.getStateEvents("m.room.history_visibility", "");
|
2016-01-18 20:05:33 +00:00
|
|
|
if (historyVisibility && historyVisibility.getContent().history_visibility === "world_readable") {
|
|
|
|
|
this.setState({
|
2017-10-11 17:56:17 +01:00
|
|
|
canPeek: true,
|
2016-01-18 20:05:33 +00:00
|
|
|
});
|
2016-01-18 17:39:23 +00:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2016-01-18 17:39:23 +00:00
|
|
|
|
2021-06-29 13:11:58 +01:00
|
|
|
private updatePreviewUrlVisibility({ roomId }: Room) {
|
2018-06-22 18:44:54 +01:00
|
|
|
// URL Previews in E2EE rooms can be a privacy leak so use a different setting which is per-room explicit
|
2020-03-22 09:41:14 +00:00
|
|
|
const key = this.context.isRoomEncrypted(roomId) ? 'urlPreviewsEnabled_e2ee' : 'urlPreviewsEnabled';
|
2016-07-18 01:35:42 +01:00
|
|
|
this.setState({
|
2018-06-22 18:44:54 +01:00
|
|
|
showUrlPreview: SettingsStore.getValue(key, roomId),
|
2016-07-18 01:35:42 +01:00
|
|
|
});
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2016-07-18 01:35:42 +01:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onRoom = (room: Room) => {
|
2017-05-24 16:56:13 +01:00
|
|
|
if (!room || room.roomId !== this.state.roomId) {
|
|
|
|
|
return;
|
2016-02-04 11:29:00 +00:00
|
|
|
}
|
2021-01-22 17:00:30 -07:00
|
|
|
|
|
|
|
|
// Detach the listener if the room is changing for some reason
|
|
|
|
|
if (this.state.room) {
|
2021-01-22 17:03:36 -07:00
|
|
|
WidgetLayoutStore.instance.off(
|
|
|
|
|
WidgetLayoutStore.emissionForRoom(this.state.room),
|
|
|
|
|
this.onWidgetLayoutChange,
|
|
|
|
|
);
|
2021-01-22 17:00:30 -07:00
|
|
|
}
|
|
|
|
|
|
2017-05-24 16:56:13 +01:00
|
|
|
this.setState({
|
|
|
|
|
room: room,
|
|
|
|
|
}, () => {
|
2020-09-07 17:32:03 +01:00
|
|
|
this.onRoomLoaded(room);
|
2017-05-24 16:56:13 +01:00
|
|
|
});
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2016-02-04 11:29:00 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onDeviceVerificationChanged = (userId: string, device: object) => {
|
2019-02-01 14:35:03 +01:00
|
|
|
const room = this.state.room;
|
|
|
|
|
if (!room.currentState.getMember(userId)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-09-07 17:32:03 +01:00
|
|
|
this.updateE2EStatus(room);
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2019-02-01 14:35:03 +01:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onUserVerificationChanged = (userId: string, trustStatus: object) => {
|
2020-01-15 13:57:29 +00:00
|
|
|
const room = this.state.room;
|
2020-01-24 19:11:57 +00:00
|
|
|
if (!room || !room.currentState.getMember(userId)) {
|
2020-01-15 13:57:29 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2020-09-07 17:32:03 +01:00
|
|
|
this.updateE2EStatus(room);
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2020-01-15 13:57:29 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onCrossSigningKeysChanged = () => {
|
2020-04-09 13:43:30 +02:00
|
|
|
const room = this.state.room;
|
|
|
|
|
if (room) {
|
2020-09-07 17:32:03 +01:00
|
|
|
this.updateE2EStatus(room);
|
2020-04-09 13:43:30 +02:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2020-04-09 13:43:30 +02:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private async updateE2EStatus(room: Room) {
|
2021-07-15 12:10:54 +01:00
|
|
|
if (!this.context.isRoomEncrypted(room.roomId)) return;
|
|
|
|
|
|
|
|
|
|
// If crypto is not currently enabled, we aren't tracking devices at all,
|
|
|
|
|
// so we don't know what the answer is. Let's error on the safe side and show
|
|
|
|
|
// a warning for this case.
|
|
|
|
|
let e2eStatus = E2EStatus.Warning;
|
|
|
|
|
if (this.context.isCryptoEnabled()) {
|
|
|
|
|
/* At this point, the user has encryption on and cross-signing on */
|
|
|
|
|
e2eStatus = await shieldStatusForRoom(this.context, room);
|
2019-04-08 16:26:54 +01:00
|
|
|
}
|
2020-01-16 16:31:50 +00:00
|
|
|
|
2021-07-15 12:10:54 +01:00
|
|
|
if (this.unmounted) return;
|
|
|
|
|
this.setState({ e2eStatus });
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2019-02-01 14:35:03 +01:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onAccountData = (event: MatrixEvent) => {
|
2018-06-22 19:17:55 +01:00
|
|
|
const type = event.getType();
|
|
|
|
|
if ((type === "org.matrix.preview_urls" || type === "im.vector.web.settings") && this.state.room) {
|
|
|
|
|
// non-e2ee url previews are stored in legacy event type `org.matrix.room.preview_urls`
|
2020-09-07 17:32:03 +01:00
|
|
|
this.updatePreviewUrlVisibility(this.state.room);
|
2016-07-20 18:14:16 +01:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2016-07-20 18:14:16 +01:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onRoomAccountData = (event: MatrixEvent, room: Room) => {
|
2016-07-20 12:03:13 +01:00
|
|
|
if (room.roomId == this.state.roomId) {
|
2018-06-22 19:17:55 +01:00
|
|
|
const type = event.getType();
|
2021-06-28 16:30:48 +01:00
|
|
|
if (type === "org.matrix.room.preview_urls" || type === "im.vector.web.settings") {
|
2018-06-22 19:17:55 +01:00
|
|
|
// non-e2ee url previews are stored in legacy event type `org.matrix.room.preview_urls`
|
2020-09-07 17:32:03 +01:00
|
|
|
this.updatePreviewUrlVisibility(room);
|
2016-07-18 01:35:42 +01:00
|
|
|
}
|
2016-01-08 03:22:38 +00:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2016-01-08 03:22:38 +00:00
|
|
|
|
2021-12-06 09:25:05 +00:00
|
|
|
private onRoomStateEvents = (ev: MatrixEvent, state: RoomState) => {
|
2019-07-31 00:46:21 +01:00
|
|
|
// ignore if we don't have a room yet
|
|
|
|
|
if (!this.state.room || this.state.room.roomId !== state.roomId) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-06 09:25:05 +00:00
|
|
|
if (ev.getType() === EventType.RoomCanonicalAlias) {
|
|
|
|
|
// re-view the room so MatrixChat can manage the alias in the URL properly
|
|
|
|
|
dis.dispatch({
|
|
|
|
|
action: Action.ViewRoom,
|
|
|
|
|
room_id: this.state.room.roomId,
|
|
|
|
|
});
|
|
|
|
|
return; // this event cannot affect permissions so bail
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
this.updatePermissions(this.state.room);
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2019-07-31 00:46:21 +01:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onRoomStateMember = (ev: MatrixEvent, state, member) => {
|
2016-04-12 19:25:07 +01:00
|
|
|
// ignore if we don't have a room yet
|
|
|
|
|
if (!this.state.room) {
|
2015-11-30 17:15:57 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2016-04-12 19:25:07 +01:00
|
|
|
|
|
|
|
|
// ignore members in other rooms
|
|
|
|
|
if (member.roomId !== this.state.room.roomId) {
|
2015-11-30 17:15:57 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2016-04-12 19:25:07 +01:00
|
|
|
|
2021-07-01 18:35:38 +01:00
|
|
|
this.updateRoomMembers();
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2016-07-26 18:15:26 +01:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onMyMembership = (room: Room, membership: string, oldMembership: string) => {
|
2018-09-17 19:14:52 +02:00
|
|
|
if (room.roomId === this.state.roomId) {
|
2017-09-15 15:07:09 +01:00
|
|
|
this.forceUpdate();
|
2020-09-07 17:32:03 +01:00
|
|
|
this.loadMembersIfJoined(room);
|
|
|
|
|
this.updatePermissions(room);
|
2019-07-31 00:46:21 +01:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2019-07-31 00:46:21 +01:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private updatePermissions(room: Room) {
|
2019-07-31 00:46:21 +01:00
|
|
|
if (room) {
|
2020-03-22 09:41:14 +00:00
|
|
|
const me = this.context.getUserId();
|
2019-07-31 00:46:21 +01:00
|
|
|
const canReact = room.getMyMembership() === "join" && room.currentState.maySendEvent("m.reaction", me);
|
|
|
|
|
const canReply = room.maySendMessage();
|
|
|
|
|
|
2021-06-29 13:11:58 +01:00
|
|
|
this.setState({ canReact, canReply });
|
2017-02-17 15:50:30 +00:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2017-02-17 15:50:30 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
// rate limited because a power level change will emit an event for every member in the room.
|
2021-07-01 18:35:38 +01:00
|
|
|
private updateRoomMembers = throttle(() => {
|
2020-09-07 17:32:03 +01:00
|
|
|
this.updateDMState();
|
|
|
|
|
this.updateE2EStatus(this.state.room);
|
2021-07-01 18:35:38 +01:00
|
|
|
}, 500, { leading: true, trailing: true });
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2020-11-05 15:39:22 +00:00
|
|
|
private checkDesktopNotifications() {
|
|
|
|
|
const memberCount = this.state.room.getJoinedMemberCount() + this.state.room.getInvitedMemberCount();
|
|
|
|
|
// if they are not alone prompt the user about notifications so they don't miss replies
|
|
|
|
|
if (memberCount > 1 && Notifier.shouldShowPrompt()) {
|
2020-11-02 17:25:48 +00:00
|
|
|
showNotificationsToast(true);
|
2017-10-11 21:15:00 -06:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2017-10-11 21:15:00 -06:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private updateDMState() {
|
2018-08-02 11:42:05 +02:00
|
|
|
const room = this.state.room;
|
|
|
|
|
if (room.getMyMembership() != "join") {
|
2018-02-20 14:10:34 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2018-08-02 11:42:19 +02:00
|
|
|
const dmInviter = room.getDMInviter();
|
2018-07-12 19:39:52 +02:00
|
|
|
if (dmInviter) {
|
2018-08-02 11:42:19 +02:00
|
|
|
Rooms.setDMRoom(room.roomId, dmInviter);
|
2018-02-20 14:10:34 +00:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2018-02-20 14:10:34 +00:00
|
|
|
|
2021-06-22 20:41:26 +01:00
|
|
|
private onSearchResultsFillRequest = (backwards: boolean): Promise<boolean> => {
|
2017-01-20 14:22:27 +00:00
|
|
|
if (!backwards) {
|
2017-07-12 14:02:00 +01:00
|
|
|
return Promise.resolve(false);
|
2017-01-20 14:22:27 +00:00
|
|
|
}
|
2015-12-22 15:18:50 +00:00
|
|
|
|
2015-12-22 18:15:32 +00:00
|
|
|
if (this.state.searchResults.next_batch) {
|
2016-01-04 16:28:32 +00:00
|
|
|
debuglog("requesting more search results");
|
2021-07-10 15:43:46 +01:00
|
|
|
const searchPromise = searchPagination(this.state.searchResults as ISearchResults);
|
2020-09-07 17:32:03 +01:00
|
|
|
return this.handleSearchResult(searchPromise);
|
2015-12-22 15:18:50 +00:00
|
|
|
} else {
|
2016-01-04 16:28:32 +00:00
|
|
|
debuglog("no more search results");
|
2017-07-12 14:02:00 +01:00
|
|
|
return Promise.resolve(false);
|
2015-12-10 20:53:21 +00:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2015-12-10 20:53:21 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onInviteButtonClick = () => {
|
2017-10-11 21:15:00 -06:00
|
|
|
// call AddressPickerDialog
|
2019-01-17 10:29:37 +01:00
|
|
|
dis.dispatch({
|
2017-10-11 21:15:00 -06:00
|
|
|
action: 'view_invite',
|
|
|
|
|
roomId: this.state.room.roomId,
|
|
|
|
|
});
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2017-10-11 21:15:00 -06:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onJoinButtonClicked = () => {
|
2017-04-28 13:22:55 +01:00
|
|
|
// If the user is a ROU, allow them to transition to a PWLU
|
2020-03-22 09:41:14 +00:00
|
|
|
if (this.context && this.context.isGuest()) {
|
2017-05-24 16:56:13 +01:00
|
|
|
// Join this room once the user has registered and logged in
|
2019-02-11 14:33:19 +00:00
|
|
|
// (If we failed to peek, we may not have a valid room object.)
|
2019-01-17 10:29:37 +01:00
|
|
|
dis.dispatch({
|
2017-05-24 16:56:13 +01:00
|
|
|
action: 'do_after_sync_prepared',
|
|
|
|
|
deferred_action: {
|
2021-11-25 17:49:43 -03:00
|
|
|
action: Action.ViewRoom,
|
2020-09-07 17:32:03 +01:00
|
|
|
room_id: this.getRoomId(),
|
2017-05-24 16:56:13 +01:00
|
|
|
},
|
2016-02-04 11:49:10 +00:00
|
|
|
});
|
2021-06-29 13:11:58 +01:00
|
|
|
dis.dispatch({ action: 'require_registration' });
|
2019-01-30 15:45:42 +01:00
|
|
|
} else {
|
|
|
|
|
Promise.resolve().then(() => {
|
2020-09-11 19:49:48 -06:00
|
|
|
const signUrl = this.props.threepidInvite?.signUrl;
|
2019-01-30 15:45:42 +01:00
|
|
|
dis.dispatch({
|
2021-05-24 14:34:06 +01:00
|
|
|
action: Action.JoinRoom,
|
|
|
|
|
roomId: this.getRoomId(),
|
2021-03-24 16:45:53 +00:00
|
|
|
opts: { inviteSignUrl: signUrl },
|
2020-10-29 15:53:14 +00:00
|
|
|
_type: "unknown", // TODO: instrumentation
|
2019-01-30 15:45:42 +01:00
|
|
|
});
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
});
|
2016-02-04 11:49:10 +00:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2016-02-04 11:49:10 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onMessageListScroll = ev => {
|
|
|
|
|
if (this.messagePanel.isAtEndOfLiveTimeline()) {
|
2016-02-10 18:27:40 +00:00
|
|
|
this.setState({
|
|
|
|
|
numUnreadMessages: 0,
|
|
|
|
|
atEndOfLiveTimeline: true,
|
|
|
|
|
});
|
2017-10-11 17:56:17 +01:00
|
|
|
} else {
|
2016-02-10 18:27:40 +00:00
|
|
|
this.setState({
|
|
|
|
|
atEndOfLiveTimeline: false,
|
|
|
|
|
});
|
2015-12-17 23:04:32 +00:00
|
|
|
}
|
2020-09-07 17:32:03 +01:00
|
|
|
this.updateTopUnreadMessagesBar();
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2020-12-17 19:50:59 +01:00
|
|
|
private onDragEnter = ev => {
|
|
|
|
|
ev.stopPropagation();
|
|
|
|
|
ev.preventDefault();
|
|
|
|
|
|
2021-04-09 07:57:25 +02:00
|
|
|
// We always increment the counter no matter the types, because dragging is
|
|
|
|
|
// still happening. If we didn't, the drag counter would get out of sync.
|
2021-06-29 13:11:58 +01:00
|
|
|
this.setState({ dragCounter: this.state.dragCounter + 1 });
|
2021-04-06 07:52:02 +02:00
|
|
|
|
2021-04-09 07:57:25 +02:00
|
|
|
// See:
|
|
|
|
|
// https://docs.w3cub.com/dom/datatransfer/types
|
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#file
|
2021-04-06 07:52:02 +02:00
|
|
|
if (ev.dataTransfer.types.includes("Files") || ev.dataTransfer.types.includes("application/x-moz-file")) {
|
2021-06-29 13:11:58 +01:00
|
|
|
this.setState({ draggingFile: true });
|
2021-04-06 07:52:02 +02:00
|
|
|
}
|
2020-12-17 19:50:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private onDragLeave = ev => {
|
|
|
|
|
ev.stopPropagation();
|
|
|
|
|
ev.preventDefault();
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
dragCounter: this.state.dragCounter - 1,
|
|
|
|
|
});
|
|
|
|
|
|
2021-03-02 07:42:07 +01:00
|
|
|
if (this.state.dragCounter === 0) {
|
2020-12-17 19:50:59 +01:00
|
|
|
this.setState({
|
|
|
|
|
draggingFile: false,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onDragOver = ev => {
|
2015-11-30 17:15:57 +00:00
|
|
|
ev.stopPropagation();
|
|
|
|
|
ev.preventDefault();
|
|
|
|
|
|
|
|
|
|
ev.dataTransfer.dropEffect = 'none';
|
|
|
|
|
|
2021-04-09 07:57:25 +02:00
|
|
|
// See:
|
|
|
|
|
// https://docs.w3cub.com/dom/datatransfer/types
|
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#file
|
2020-11-10 15:55:07 +00:00
|
|
|
if (ev.dataTransfer.types.includes("Files") || ev.dataTransfer.types.includes("application/x-moz-file")) {
|
|
|
|
|
ev.dataTransfer.dropEffect = 'copy';
|
2015-11-30 17:15:57 +00:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onDrop = ev => {
|
2015-11-30 17:15:57 +00:00
|
|
|
ev.stopPropagation();
|
|
|
|
|
ev.preventDefault();
|
2019-04-01 16:42:41 +01:00
|
|
|
ContentMessages.sharedInstance().sendContentListToRoom(
|
2021-11-03 08:43:24 +00:00
|
|
|
ev.dataTransfer.files, this.state.room.roomId, null, this.context,
|
2019-04-01 16:42:41 +01:00
|
|
|
);
|
2021-07-08 17:36:31 +02:00
|
|
|
dis.fire(Action.FocusSendMessageComposer);
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2020-12-17 19:50:59 +01:00
|
|
|
this.setState({
|
|
|
|
|
draggingFile: false,
|
|
|
|
|
dragCounter: this.state.dragCounter - 1,
|
|
|
|
|
});
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2021-12-03 08:22:13 +00:00
|
|
|
private injectSticker(url: string, info: object, text: string, threadId: string | null) {
|
2020-03-22 09:41:14 +00:00
|
|
|
if (this.context.isGuest()) {
|
2021-06-29 13:11:58 +01:00
|
|
|
dis.dispatch({ action: 'require_registration' });
|
2018-01-04 09:53:26 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-03 08:22:13 +00:00
|
|
|
ContentMessages.sharedInstance()
|
|
|
|
|
.sendStickerContentToRoom(url, this.state.room.roomId, threadId, info, text, this.context)
|
2019-11-18 10:03:05 +00:00
|
|
|
.then(undefined, (error) => {
|
2018-03-29 16:46:22 +01:00
|
|
|
if (error.name === "UnknownDeviceError") {
|
|
|
|
|
// Let the staus bar handle this
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2018-01-04 09:53:26 +00:00
|
|
|
|
2021-06-21 14:50:21 +01:00
|
|
|
private onSearch = (term: string, scope: SearchScope) => {
|
2015-12-18 11:11:41 +00:00
|
|
|
this.setState({
|
|
|
|
|
searchTerm: term,
|
|
|
|
|
searchScope: scope,
|
2015-12-22 18:15:32 +00:00
|
|
|
searchResults: {},
|
2015-12-18 11:11:41 +00:00
|
|
|
searchHighlights: [],
|
2015-12-11 02:25:33 +00:00
|
|
|
});
|
|
|
|
|
|
2015-12-22 15:18:50 +00:00
|
|
|
// if we already have a search panel, we need to tell it to forget
|
|
|
|
|
// about its scroll state.
|
2020-09-07 17:32:03 +01:00
|
|
|
if (this.searchResultsPanel.current) {
|
|
|
|
|
this.searchResultsPanel.current.resetScrollState();
|
2015-12-22 15:18:50 +00:00
|
|
|
}
|
|
|
|
|
|
2015-12-22 18:15:32 +00:00
|
|
|
// make sure that we don't end up showing results from
|
|
|
|
|
// an aborted search by keeping a unique id.
|
|
|
|
|
//
|
|
|
|
|
// todo: should cancel any previous search requests.
|
|
|
|
|
this.searchId = new Date().getTime();
|
|
|
|
|
|
2019-11-12 15:39:26 +01:00
|
|
|
let roomId;
|
2021-06-21 14:50:21 +01:00
|
|
|
if (scope === SearchScope.Room) roomId = this.state.room.roomId;
|
2015-12-22 18:15:32 +00:00
|
|
|
|
2016-01-05 15:51:16 +00:00
|
|
|
debuglog("sending search request");
|
2019-11-12 15:39:26 +01:00
|
|
|
const searchPromise = eventSearch(term, roomId);
|
2020-09-07 17:32:03 +01:00
|
|
|
this.handleSearchResult(searchPromise);
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2016-01-04 16:54:27 +00:00
|
|
|
|
2021-06-22 20:41:26 +01:00
|
|
|
private handleSearchResult(searchPromise: Promise<any>): Promise<boolean> {
|
2016-01-04 16:54:27 +00:00
|
|
|
// keep a record of the current search id, so that if the search terms
|
|
|
|
|
// change before we get a response, we can ignore the results.
|
2017-10-11 17:56:17 +01:00
|
|
|
const localSearchId = this.searchId;
|
2015-12-22 18:15:32 +00:00
|
|
|
|
2015-12-18 11:11:41 +00:00
|
|
|
this.setState({
|
|
|
|
|
searchInProgress: true,
|
|
|
|
|
});
|
|
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
return searchPromise.then((results) => {
|
2016-01-04 16:28:32 +00:00
|
|
|
debuglog("search complete");
|
2020-09-07 17:32:03 +01:00
|
|
|
if (this.unmounted || !this.state.searching || this.searchId != localSearchId) {
|
2021-10-15 16:30:53 +02:00
|
|
|
logger.error("Discarding stale search results");
|
2021-06-22 20:41:26 +01:00
|
|
|
return false;
|
2015-12-11 03:22:44 +00:00
|
|
|
}
|
|
|
|
|
|
2016-01-05 15:28:32 +00:00
|
|
|
// postgres on synapse returns us precise details of the strings
|
|
|
|
|
// which actually got matched for highlighting.
|
|
|
|
|
//
|
|
|
|
|
// In either case, we want to highlight the literal search term
|
|
|
|
|
// whether it was used by the search engine or not.
|
|
|
|
|
|
2017-10-11 17:56:17 +01:00
|
|
|
let highlights = results.highlights;
|
2020-09-07 17:32:03 +01:00
|
|
|
if (highlights.indexOf(this.state.searchTerm) < 0) {
|
|
|
|
|
highlights = highlights.concat(this.state.searchTerm);
|
2016-01-05 15:28:32 +00:00
|
|
|
}
|
2015-12-18 11:11:41 +00:00
|
|
|
|
2015-12-22 18:15:32 +00:00
|
|
|
// For overlapping highlights,
|
2015-12-18 11:11:41 +00:00
|
|
|
// favour longer (more specific) terms first
|
2016-01-08 13:25:03 +00:00
|
|
|
highlights = highlights.sort(function(a, b) {
|
2017-10-11 17:56:17 +01:00
|
|
|
return b.length - a.length;
|
2019-02-04 13:25:26 -07:00
|
|
|
});
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
this.setState({
|
2015-12-18 11:11:41 +00:00
|
|
|
searchHighlights: highlights,
|
2015-12-22 18:15:32 +00:00
|
|
|
searchResults: results,
|
2015-11-30 17:15:57 +00:00
|
|
|
});
|
2020-09-07 17:32:03 +01:00
|
|
|
}, (error) => {
|
2021-10-15 16:30:53 +02:00
|
|
|
logger.error("Search failed", error);
|
2017-08-10 15:17:52 +01:00
|
|
|
Modal.createTrackedDialog('Search failed', '', ErrorDialog, {
|
2017-05-23 15:16:31 +01:00
|
|
|
title: _t("Search failed"),
|
2020-09-07 17:32:03 +01:00
|
|
|
description: ((error && error.message) ? error.message :
|
|
|
|
|
_t("Server may be unavailable, overloaded, or search timed out :(")),
|
2015-11-30 17:15:57 +00:00
|
|
|
});
|
2021-06-22 20:41:26 +01:00
|
|
|
return false;
|
2020-09-07 17:32:03 +01:00
|
|
|
}).finally(() => {
|
|
|
|
|
this.setState({
|
2017-10-11 17:56:17 +01:00
|
|
|
searchInProgress: false,
|
2015-12-11 02:25:33 +00:00
|
|
|
});
|
2015-12-22 18:15:32 +00:00
|
|
|
});
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2015-12-18 11:11:41 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private getSearchResultTiles() {
|
2015-12-22 15:18:50 +00:00
|
|
|
// XXX: todo: merge overlapping results somehow?
|
|
|
|
|
// XXX: why doesn't searching on name work?
|
|
|
|
|
|
2017-10-11 17:56:17 +01:00
|
|
|
const ret = [];
|
2015-12-22 18:15:32 +00:00
|
|
|
|
2016-03-20 23:51:43 +00:00
|
|
|
if (this.state.searchInProgress) {
|
|
|
|
|
ret.push(<li key="search-spinner">
|
2020-09-07 17:32:03 +01:00
|
|
|
<Spinner />
|
|
|
|
|
</li>);
|
2016-03-20 23:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
2015-12-22 18:15:32 +00:00
|
|
|
if (!this.state.searchResults.next_batch) {
|
2020-10-19 12:46:55 +01:00
|
|
|
if (!this.state.searchResults?.results?.length) {
|
2015-12-22 15:18:50 +00:00
|
|
|
ret.push(<li key="search-top-marker">
|
2020-09-07 17:32:03 +01:00
|
|
|
<h2 className="mx_RoomView_topMarker">{ _t("No results") }</h2>
|
|
|
|
|
</li>,
|
2020-03-22 09:41:14 +00:00
|
|
|
);
|
2015-12-22 15:18:50 +00:00
|
|
|
} else {
|
|
|
|
|
ret.push(<li key="search-top-marker">
|
2020-09-07 17:32:03 +01:00
|
|
|
<h2 className="mx_RoomView_topMarker">{ _t("No more results") }</h2>
|
|
|
|
|
</li>,
|
2020-03-22 09:41:14 +00:00
|
|
|
);
|
2015-12-22 15:18:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-02 00:36:19 +01:00
|
|
|
// once dynamic content in the search results load, make the scrollPanel check
|
2016-02-22 17:19:04 +00:00
|
|
|
// the scroll offsets.
|
2019-03-06 12:27:16 +01:00
|
|
|
const onHeightChanged = () => {
|
2020-09-07 17:32:03 +01:00
|
|
|
const scrollPanel = this.searchResultsPanel.current;
|
2016-02-22 17:19:04 +00:00
|
|
|
if (scrollPanel) {
|
|
|
|
|
scrollPanel.checkScroll();
|
|
|
|
|
}
|
2017-01-20 14:22:27 +00:00
|
|
|
};
|
2016-02-22 17:19:04 +00:00
|
|
|
|
2017-10-11 17:56:17 +01:00
|
|
|
let lastRoomId;
|
2015-12-22 15:18:50 +00:00
|
|
|
|
2020-10-19 12:46:55 +01:00
|
|
|
for (let i = (this.state.searchResults?.results?.length || 0) - 1; i >= 0; i--) {
|
2017-10-11 17:56:17 +01:00
|
|
|
const result = this.state.searchResults.results[i];
|
2015-12-22 18:15:32 +00:00
|
|
|
|
2017-10-11 17:56:17 +01:00
|
|
|
const mxEv = result.context.getEvent();
|
|
|
|
|
const roomId = mxEv.getRoomId();
|
2020-03-22 09:41:14 +00:00
|
|
|
const room = this.context.getRoom(roomId);
|
2020-06-18 22:45:42 +01:00
|
|
|
if (!room) {
|
|
|
|
|
// if we do not have the room in js-sdk stores then hide it as we cannot easily show it
|
|
|
|
|
// As per the spec, an all rooms search can create this condition,
|
|
|
|
|
// it happens with Seshat but not Synapse.
|
2020-06-18 22:49:39 +01:00
|
|
|
// It will make the result count not match the displayed count.
|
2021-09-21 17:48:09 +02:00
|
|
|
logger.log("Hiding search result from an unknown room", roomId);
|
2020-06-18 22:45:42 +01:00
|
|
|
continue;
|
|
|
|
|
}
|
2015-12-22 15:18:50 +00:00
|
|
|
|
2021-06-16 20:40:47 -04:00
|
|
|
if (!haveTileForEvent(mxEv, this.state.showHiddenEventsInTimeline)) {
|
2015-12-22 15:18:50 +00:00
|
|
|
// XXX: can this ever happen? It will make the result count
|
|
|
|
|
// not match the displayed count.
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.state.searchScope === 'All') {
|
2020-06-18 22:45:42 +01:00
|
|
|
if (roomId !== lastRoomId) {
|
2016-01-06 16:46:29 +00:00
|
|
|
ret.push(<li key={mxEv.getId() + "-room"}>
|
2020-09-07 17:32:03 +01:00
|
|
|
<h2>{ _t("Room") }: { room.name }</h2>
|
|
|
|
|
</li>);
|
2015-12-22 15:18:50 +00:00
|
|
|
lastRoomId = roomId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-11 17:56:17 +01:00
|
|
|
const resultLink = "#/room/"+roomId+"/"+mxEv.getId();
|
2016-02-17 19:50:04 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
ret.push(<SearchResultTile
|
|
|
|
|
key={mxEv.getId()}
|
|
|
|
|
searchResult={result}
|
|
|
|
|
searchHighlights={this.state.searchHighlights}
|
|
|
|
|
resultLink={resultLink}
|
|
|
|
|
permalinkCreator={this.getPermalinkCreatorForRoom(room)}
|
|
|
|
|
onHeightChanged={onHeightChanged}
|
|
|
|
|
/>);
|
2015-12-22 15:18:50 +00:00
|
|
|
}
|
|
|
|
|
return ret;
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2015-12-22 15:18:50 +00:00
|
|
|
|
2021-11-30 19:09:13 +01:00
|
|
|
private onCallPlaced = (type: CallType): void => {
|
|
|
|
|
CallHandler.instance.placeCall(this.state.room?.roomId, type);
|
2021-02-26 13:46:39 -07:00
|
|
|
};
|
|
|
|
|
|
2020-10-09 08:42:21 +01:00
|
|
|
private onAppsClick = () => {
|
|
|
|
|
dis.dispatch({
|
2020-10-15 15:24:42 +01:00
|
|
|
action: "appsDrawer",
|
2020-10-09 08:42:21 +01:00
|
|
|
show: !this.state.showApps,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onForgetClick = () => {
|
2020-07-13 16:35:03 +01:00
|
|
|
dis.dispatch({
|
|
|
|
|
action: 'forget_room',
|
|
|
|
|
room_id: this.state.room.roomId,
|
2015-12-16 16:06:29 +00:00
|
|
|
});
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2015-12-13 13:49:28 +00:00
|
|
|
|
2021-03-01 18:10:17 +00:00
|
|
|
private onRejectButtonClicked = () => {
|
2015-11-30 17:15:57 +00:00
|
|
|
this.setState({
|
2017-10-11 17:56:17 +01:00
|
|
|
rejecting: true,
|
2015-11-30 17:15:57 +00:00
|
|
|
});
|
2020-09-07 17:32:03 +01:00
|
|
|
this.context.leave(this.state.roomId).then(() => {
|
2020-12-03 11:15:55 +00:00
|
|
|
dis.dispatch({ action: 'view_home_page' });
|
2020-09-07 17:32:03 +01:00
|
|
|
this.setState({
|
2017-10-11 17:56:17 +01:00
|
|
|
rejecting: false,
|
2015-11-30 17:15:57 +00:00
|
|
|
});
|
2020-09-07 17:32:03 +01:00
|
|
|
}, (error) => {
|
2021-10-15 16:30:53 +02:00
|
|
|
logger.error("Failed to reject invite: %s", error);
|
2016-02-15 20:59:44 +02:00
|
|
|
|
2017-10-11 17:56:17 +01:00
|
|
|
const msg = error.message ? error.message : JSON.stringify(error);
|
2017-08-10 15:17:52 +01:00
|
|
|
Modal.createTrackedDialog('Failed to reject invite', '', ErrorDialog, {
|
2017-05-23 15:16:31 +01:00
|
|
|
title: _t("Failed to reject invite"),
|
|
|
|
|
description: msg,
|
2016-02-15 20:59:44 +02:00
|
|
|
});
|
|
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
this.setState({
|
2015-11-30 17:15:57 +00:00
|
|
|
rejecting: false,
|
2017-10-11 17:56:17 +01:00
|
|
|
rejectError: error,
|
2015-11-30 17:15:57 +00:00
|
|
|
});
|
|
|
|
|
});
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onRejectAndIgnoreClick = async () => {
|
2020-01-23 11:50:59 +00:00
|
|
|
this.setState({
|
|
|
|
|
rejecting: true,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
try {
|
2020-03-22 09:41:14 +00:00
|
|
|
const myMember = this.state.room.getMember(this.context.getUserId());
|
2020-01-23 11:50:59 +00:00
|
|
|
const inviteEvent = myMember.events.member;
|
2020-03-22 09:41:14 +00:00
|
|
|
const ignoredUsers = this.context.getIgnoredUsers();
|
2020-01-23 11:50:59 +00:00
|
|
|
ignoredUsers.push(inviteEvent.getSender()); // de-duped internally in the js-sdk
|
2020-03-22 09:41:14 +00:00
|
|
|
await this.context.setIgnoredUsers(ignoredUsers);
|
2020-01-23 11:50:59 +00:00
|
|
|
|
2020-03-22 09:41:14 +00:00
|
|
|
await this.context.leave(this.state.roomId);
|
2020-12-03 11:15:55 +00:00
|
|
|
dis.dispatch({ action: 'view_home_page' });
|
2020-01-23 11:50:59 +00:00
|
|
|
this.setState({
|
|
|
|
|
rejecting: false,
|
|
|
|
|
});
|
|
|
|
|
} catch (error) {
|
2021-10-15 16:30:53 +02:00
|
|
|
logger.error("Failed to reject invite: %s", error);
|
2020-01-23 11:50:59 +00:00
|
|
|
|
|
|
|
|
const msg = error.message ? error.message : JSON.stringify(error);
|
|
|
|
|
Modal.createTrackedDialog('Failed to reject invite', '', ErrorDialog, {
|
|
|
|
|
title: _t("Failed to reject invite"),
|
|
|
|
|
description: msg,
|
|
|
|
|
});
|
|
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
this.setState({
|
2020-01-23 11:50:59 +00:00
|
|
|
rejecting: false,
|
|
|
|
|
rejectError: error,
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2020-01-23 11:50:59 +00:00
|
|
|
|
2021-03-01 18:10:17 +00:00
|
|
|
private onRejectThreepidInviteButtonClicked = () => {
|
2016-03-11 10:20:52 +00:00
|
|
|
// We can reject 3pid invites in the same way that we accept them,
|
|
|
|
|
// using /leave rather than /join. In the short term though, we
|
|
|
|
|
// just ignore them.
|
|
|
|
|
// https://github.com/vector-im/vector-web/issues/1134
|
2020-06-08 20:33:21 -06:00
|
|
|
dis.fire(Action.ViewRoomDirectory);
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2016-03-10 15:56:58 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onSearchClick = () => {
|
2019-02-24 02:57:13 +00:00
|
|
|
this.setState({
|
|
|
|
|
searching: !this.state.searching,
|
|
|
|
|
});
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2022-01-05 15:59:19 +00:00
|
|
|
private onCancelSearchClick = (): Promise<void> => {
|
|
|
|
|
return new Promise<void>(resolve => {
|
|
|
|
|
this.setState({
|
|
|
|
|
searching: false,
|
|
|
|
|
searchResults: null,
|
|
|
|
|
}, resolve);
|
2015-12-18 16:42:46 +00:00
|
|
|
});
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2015-12-18 16:42:46 +00:00
|
|
|
|
2016-02-03 08:03:10 +00:00
|
|
|
// jump down to the bottom of this room, where new events are arriving
|
2020-09-07 17:32:03 +01:00
|
|
|
private jumpToLiveTimeline = () => {
|
2021-06-05 13:20:27 -04:00
|
|
|
if (this.state.initialEventId && this.state.isInitialEventHighlighted) {
|
|
|
|
|
// If we were viewing a highlighted event, firing view_room without
|
|
|
|
|
// an event will take care of both clearing the URL fragment and
|
|
|
|
|
// jumping to the bottom
|
|
|
|
|
dis.dispatch({
|
2021-11-25 17:49:43 -03:00
|
|
|
action: Action.ViewRoom,
|
2021-06-05 13:20:27 -04:00
|
|
|
room_id: this.state.room.roomId,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// Otherwise we have to jump manually
|
|
|
|
|
this.messagePanel.jumpToLiveTimeline();
|
2021-07-08 17:36:31 +02:00
|
|
|
dis.fire(Action.FocusSendMessageComposer);
|
2021-06-05 13:20:27 -04:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2015-12-16 17:57:32 +00:00
|
|
|
|
2016-02-24 17:26:34 +00:00
|
|
|
// jump up to wherever our read marker is
|
2020-09-07 17:32:03 +01:00
|
|
|
private jumpToReadMarker = () => {
|
|
|
|
|
this.messagePanel.jumpToReadMarker();
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2016-02-24 17:26:34 +00:00
|
|
|
|
|
|
|
|
// update the read marker to match the read-receipt
|
2020-09-07 17:32:03 +01:00
|
|
|
private forgetReadMarker = ev => {
|
2016-04-13 12:46:36 +01:00
|
|
|
ev.stopPropagation();
|
2020-09-07 17:32:03 +01:00
|
|
|
this.messagePanel.forgetReadMarker();
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2016-02-24 17:26:34 +00:00
|
|
|
|
|
|
|
|
// decide whether or not the top 'unread messages' bar should be shown
|
2020-09-07 17:32:03 +01:00
|
|
|
private updateTopUnreadMessagesBar = () => {
|
|
|
|
|
if (!this.messagePanel) {
|
2016-02-24 17:26:34 +00:00
|
|
|
return;
|
2017-01-20 14:22:27 +00:00
|
|
|
}
|
2016-02-24 17:26:34 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
const showBar = this.messagePanel.canJumpToReadMarker();
|
2016-03-10 15:55:03 +00:00
|
|
|
if (this.state.showTopUnreadMessagesBar != showBar) {
|
2021-06-29 13:11:58 +01:00
|
|
|
this.setState({ showTopUnreadMessagesBar: showBar });
|
2016-03-10 15:55:03 +00:00
|
|
|
}
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2016-02-24 17:26:34 +00:00
|
|
|
|
2015-12-10 21:34:10 +00:00
|
|
|
// get the current scroll position of the room, so that it can be
|
2016-02-01 16:31:12 +00:00
|
|
|
// restored when we switch back to it.
|
|
|
|
|
//
|
2021-07-03 12:17:38 +01:00
|
|
|
private getScrollState(): ScrollState {
|
2020-09-07 17:32:03 +01:00
|
|
|
const messagePanel = this.messagePanel;
|
2015-12-22 15:18:50 +00:00
|
|
|
if (!messagePanel) return null;
|
|
|
|
|
|
2016-02-04 16:17:03 +00:00
|
|
|
// if we're following the live timeline, we want to return null; that
|
|
|
|
|
// means that, if we switch back, we will jump to the read-up-to mark.
|
|
|
|
|
//
|
|
|
|
|
// That should be more intuitive than slavishly preserving the current
|
|
|
|
|
// scroll state, in the case where the room advances in the meantime
|
|
|
|
|
// (particularly in the case that the user reads some stuff on another
|
|
|
|
|
// device).
|
|
|
|
|
//
|
|
|
|
|
if (this.state.atEndOfLiveTimeline) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-11 17:56:17 +01:00
|
|
|
const scrollState = messagePanel.getScrollState();
|
2015-12-10 16:26:36 +00:00
|
|
|
|
2019-10-03 23:00:08 +01:00
|
|
|
// getScrollState on TimelinePanel *may* return null, so guard against that
|
|
|
|
|
if (!scrollState || scrollState.stuckAtBottom) {
|
2016-02-01 16:31:12 +00:00
|
|
|
// we don't really expect to be in this state, but it will
|
2016-02-03 08:03:10 +00:00
|
|
|
// occasionally happen when no scroll state has been set on the
|
|
|
|
|
// messagePanel (ie, we didn't have an initial event (so it's
|
|
|
|
|
// probably a new room), there has been no user-initiated scroll, and
|
|
|
|
|
// no read-receipts have arrived to update the scroll position).
|
|
|
|
|
//
|
|
|
|
|
// Return null, which will cause us to scroll to last unread on
|
|
|
|
|
// reload.
|
2016-02-01 16:31:12 +00:00
|
|
|
return null;
|
2015-12-10 16:26:36 +00:00
|
|
|
}
|
2016-02-01 16:31:12 +00:00
|
|
|
|
|
|
|
|
return {
|
2016-02-03 08:03:10 +00:00
|
|
|
focussedEvent: scrollState.trackedScrollToken,
|
2016-02-01 16:31:12 +00:00
|
|
|
pixelOffset: scrollState.pixelOffset,
|
|
|
|
|
};
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2015-12-10 16:26:36 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onStatusBarVisible = () => {
|
2021-06-16 12:06:41 +01:00
|
|
|
if (this.unmounted || this.state.statusBarVisible) return;
|
|
|
|
|
this.setState({ statusBarVisible: true });
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2017-01-23 16:01:39 +01:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private onStatusBarHidden = () => {
|
2018-01-05 12:03:46 +00:00
|
|
|
// This is currently not desired as it is annoying if it keeps expanding and collapsing
|
2021-06-16 12:06:41 +01:00
|
|
|
if (this.unmounted || !this.state.statusBarVisible) return;
|
|
|
|
|
this.setState({ statusBarVisible: false });
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2017-01-23 16:01:39 +01:00
|
|
|
|
2021-06-09 14:03:31 +01:00
|
|
|
/**
|
|
|
|
|
* called by the parent component when PageUp/Down/etc is pressed.
|
|
|
|
|
*
|
|
|
|
|
* We pass it down to the scroll panel.
|
|
|
|
|
*/
|
|
|
|
|
private handleScrollKey = ev => {
|
|
|
|
|
let panel;
|
|
|
|
|
if (this.searchResultsPanel.current) {
|
|
|
|
|
panel = this.searchResultsPanel.current;
|
|
|
|
|
} else if (this.messagePanel) {
|
|
|
|
|
panel = this.messagePanel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (panel) {
|
|
|
|
|
panel.handleScrollKey(ev);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2016-04-12 19:25:07 +01:00
|
|
|
/**
|
|
|
|
|
* get any current call for this room
|
|
|
|
|
*/
|
2020-10-09 18:56:07 +01:00
|
|
|
private getCallForRoom(): MatrixCall {
|
2016-04-12 19:25:07 +01:00
|
|
|
if (!this.state.room) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2021-11-30 19:09:13 +01:00
|
|
|
return CallHandler.instance.getCallForRoom(this.state.room.roomId);
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2016-04-12 19:25:07 +01:00
|
|
|
|
2016-03-08 12:16:34 +00:00
|
|
|
// this has to be a proper method rather than an unnamed function,
|
|
|
|
|
// otherwise react calls it with null on each update.
|
2020-09-07 17:32:03 +01:00
|
|
|
private gatherTimelinePanelRef = r => {
|
|
|
|
|
this.messagePanel = r;
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2016-01-17 03:59:31 +00:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
private getOldRoom() {
|
2019-03-26 19:22:24 -06:00
|
|
|
const createEvent = this.state.room.currentState.getStateEvents("m.room.create", "");
|
|
|
|
|
if (!createEvent || !createEvent.getContent()['predecessor']) return null;
|
|
|
|
|
|
2020-03-22 09:41:14 +00:00
|
|
|
return this.context.getRoom(createEvent.getContent()['predecessor']['room_id']);
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2019-03-26 19:22:24 -06:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
getHiddenHighlightCount() {
|
|
|
|
|
const oldRoom = this.getOldRoom();
|
2019-03-26 19:22:24 -06:00
|
|
|
if (!oldRoom) return 0;
|
|
|
|
|
return oldRoom.getUnreadNotificationCount('highlight');
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
2019-03-26 19:22:24 -06:00
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
onHiddenHighlightsClick = () => {
|
|
|
|
|
const oldRoom = this.getOldRoom();
|
2019-03-26 19:22:24 -06:00
|
|
|
if (!oldRoom) return;
|
2021-06-29 13:11:58 +01:00
|
|
|
dis.dispatch({ action: "view_room", room_id: oldRoom.roomId });
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2020-08-29 12:14:16 +01:00
|
|
|
render() {
|
2016-02-10 18:27:40 +00:00
|
|
|
if (!this.state.room) {
|
2020-05-22 11:18:14 +01:00
|
|
|
const loading = !this.state.matrixClientIsReady || this.state.roomLoading || this.state.peekLoading;
|
2019-04-15 18:49:00 +02:00
|
|
|
if (loading) {
|
2020-05-19 13:17:34 +01:00
|
|
|
// Assume preview loading if we don't have a ready client or a room ID (still resolving the alias)
|
|
|
|
|
const previewLoading = !this.state.matrixClientIsReady || !this.state.roomId || this.state.peekLoading;
|
2017-05-30 11:21:33 +01:00
|
|
|
return (
|
|
|
|
|
<div className="mx_RoomView">
|
2019-10-02 17:28:03 +01:00
|
|
|
<ErrorBoundary>
|
|
|
|
|
<RoomPreviewBar
|
|
|
|
|
canPreview={false}
|
2020-05-19 13:17:34 +01:00
|
|
|
previewLoading={previewLoading && !this.state.roomLoadError}
|
2019-10-02 17:28:03 +01:00
|
|
|
error={this.state.roomLoadError}
|
|
|
|
|
loading={loading}
|
|
|
|
|
joining={this.state.joining}
|
|
|
|
|
oobData={this.props.oobData}
|
|
|
|
|
/>
|
|
|
|
|
</ErrorBoundary>
|
2017-05-30 11:21:33 +01:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
} else {
|
2020-09-07 17:32:03 +01:00
|
|
|
let inviterName = undefined;
|
2017-05-30 11:21:33 +01:00
|
|
|
if (this.props.oobData) {
|
|
|
|
|
inviterName = this.props.oobData.inviterName;
|
|
|
|
|
}
|
2020-09-11 19:49:48 -06:00
|
|
|
const invitedEmail = this.props.threepidInvite?.toEmail;
|
2016-03-01 18:23:57 +00:00
|
|
|
|
2017-05-30 11:21:33 +01:00
|
|
|
// We have no room object for this room, only the ID.
|
|
|
|
|
// We've got to this room by following a link, possibly a third party invite.
|
2017-06-16 11:10:55 +01:00
|
|
|
const roomAlias = this.state.roomAlias;
|
2017-05-30 11:21:33 +01:00
|
|
|
return (
|
|
|
|
|
<div className="mx_RoomView">
|
2019-10-02 17:28:03 +01:00
|
|
|
<ErrorBoundary>
|
2020-05-19 13:17:34 +01:00
|
|
|
<RoomPreviewBar
|
|
|
|
|
onJoinClick={this.onJoinButtonClicked}
|
2019-10-02 17:28:03 +01:00
|
|
|
onForgetClick={this.onForgetClick}
|
|
|
|
|
onRejectClick={this.onRejectThreepidInviteButtonClicked}
|
2021-07-23 10:23:45 +01:00
|
|
|
canPreview={false}
|
|
|
|
|
error={this.state.roomLoadError}
|
2019-10-02 17:28:03 +01:00
|
|
|
roomAlias={roomAlias}
|
|
|
|
|
joining={this.state.joining}
|
|
|
|
|
inviterName={inviterName}
|
|
|
|
|
invitedEmail={invitedEmail}
|
|
|
|
|
oobData={this.props.oobData}
|
2020-09-11 19:49:48 -06:00
|
|
|
signUrl={this.props.threepidInvite?.signUrl}
|
2019-10-02 17:28:03 +01:00
|
|
|
room={this.state.room}
|
|
|
|
|
/>
|
|
|
|
|
</ErrorBoundary>
|
2017-05-30 11:21:33 +01:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2015-11-30 17:15:57 +00:00
|
|
|
}
|
|
|
|
|
|
2018-08-22 16:35:58 +01:00
|
|
|
const myMembership = this.state.room.getMyMembership();
|
2021-07-15 08:26:49 +01:00
|
|
|
// SpaceRoomView handles invites itself
|
|
|
|
|
if (myMembership === "invite" && (!SpaceStore.spacesEnabled || !this.state.room.isSpaceRoom())) {
|
2015-11-30 17:15:57 +00:00
|
|
|
if (this.state.joining || this.state.rejecting) {
|
|
|
|
|
return (
|
2019-10-02 17:28:03 +01:00
|
|
|
<ErrorBoundary>
|
|
|
|
|
<RoomPreviewBar
|
2019-04-15 18:49:00 +02:00
|
|
|
canPreview={false}
|
|
|
|
|
error={this.state.roomLoadError}
|
|
|
|
|
joining={this.state.joining}
|
|
|
|
|
rejecting={this.state.rejecting}
|
|
|
|
|
/>
|
2019-10-02 17:28:03 +01:00
|
|
|
</ErrorBoundary>
|
2015-11-30 17:15:57 +00:00
|
|
|
);
|
|
|
|
|
} else {
|
2020-03-22 09:41:14 +00:00
|
|
|
const myUserId = this.context.credentials.userId;
|
2018-08-22 16:35:58 +01:00
|
|
|
const myMember = this.state.room.getMember(myUserId);
|
2020-05-10 11:17:21 +01:00
|
|
|
const inviteEvent = myMember ? myMember.events.member : null;
|
|
|
|
|
let inviterName = _t("Unknown");
|
|
|
|
|
if (inviteEvent) {
|
|
|
|
|
inviterName = inviteEvent.sender ? inviteEvent.sender.name : inviteEvent.getSender();
|
|
|
|
|
}
|
2016-01-18 17:39:23 +00:00
|
|
|
|
|
|
|
|
// We deliberately don't try to peek into invites, even if we have permission to peek
|
|
|
|
|
// as they could be a spam vector.
|
|
|
|
|
// XXX: in future we could give the option of a 'Preview' button which lets them view anyway.
|
2016-01-18 20:15:12 +00:00
|
|
|
|
2016-03-17 18:38:25 +00:00
|
|
|
// We have a regular invite for this room.
|
2015-11-30 17:15:57 +00:00
|
|
|
return (
|
|
|
|
|
<div className="mx_RoomView">
|
2019-10-02 17:28:03 +01:00
|
|
|
<ErrorBoundary>
|
2020-01-23 11:50:59 +00:00
|
|
|
<RoomPreviewBar
|
|
|
|
|
onJoinClick={this.onJoinButtonClicked}
|
2019-10-02 17:28:03 +01:00
|
|
|
onForgetClick={this.onForgetClick}
|
|
|
|
|
onRejectClick={this.onRejectButtonClicked}
|
2020-01-23 11:50:59 +00:00
|
|
|
onRejectAndIgnoreClick={this.onRejectAndIgnoreClick}
|
2019-10-02 17:28:03 +01:00
|
|
|
inviterName={inviterName}
|
|
|
|
|
canPreview={false}
|
|
|
|
|
joining={this.state.joining}
|
|
|
|
|
room={this.state.room}
|
|
|
|
|
/>
|
|
|
|
|
</ErrorBoundary>
|
2015-11-30 17:15:57 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2016-02-08 16:43:08 +00:00
|
|
|
}
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2021-03-02 12:07:33 +01:00
|
|
|
let fileDropTarget = null;
|
|
|
|
|
if (this.state.draggingFile) {
|
|
|
|
|
fileDropTarget = (
|
|
|
|
|
<div className="mx_RoomView_fileDropTarget">
|
|
|
|
|
<img
|
|
|
|
|
src={require("../../../res/img/upload-big.svg")}
|
|
|
|
|
className="mx_RoomView_fileDropTarget_image"
|
|
|
|
|
/>
|
|
|
|
|
{ _t("Drop file here to upload") }
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-08 16:43:08 +00:00
|
|
|
// We have successfully loaded this room, and are not previewing.
|
|
|
|
|
// Display the "normal" room view.
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2020-10-09 18:56:07 +01:00
|
|
|
let activeCall = null;
|
|
|
|
|
{
|
2020-10-13 09:55:03 +01:00
|
|
|
// New block because this variable doesn't need to hang around for the rest of the function
|
2020-10-09 18:56:07 +01:00
|
|
|
const call = this.getCallForRoom();
|
|
|
|
|
if (call && (this.state.callState !== 'ended' && this.state.callState !== 'ringing')) {
|
|
|
|
|
activeCall = call;
|
|
|
|
|
}
|
2016-02-08 18:04:54 +00:00
|
|
|
}
|
|
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
const scrollheaderClasses = classNames({
|
2016-02-08 16:43:08 +00:00
|
|
|
mx_RoomView_scrollheader: true,
|
|
|
|
|
});
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2017-10-11 17:56:17 +01:00
|
|
|
let statusBar;
|
2017-01-26 18:07:42 +00:00
|
|
|
let isStatusAreaExpanded = true;
|
2016-02-08 16:43:08 +00:00
|
|
|
|
2019-04-01 16:42:41 +01:00
|
|
|
if (ContentMessages.sharedInstance().getCurrentUploads().length > 0) {
|
2017-01-20 14:22:27 +00:00
|
|
|
statusBar = <UploadBar room={this.state.room} />;
|
2016-02-08 16:43:08 +00:00
|
|
|
} else if (!this.state.searchResults) {
|
2017-01-26 18:07:42 +00:00
|
|
|
isStatusAreaExpanded = this.state.statusBarVisible;
|
2016-02-08 18:04:54 +00:00
|
|
|
statusBar = <RoomStatusBar
|
|
|
|
|
room={this.state.room}
|
2018-10-15 14:35:36 -06:00
|
|
|
isPeeking={myMembership !== "join"}
|
2017-10-11 21:15:00 -06:00
|
|
|
onInviteClick={this.onInviteButtonClick}
|
2017-01-23 16:01:39 +01:00
|
|
|
onVisible={this.onStatusBarVisible}
|
|
|
|
|
onHidden={this.onStatusBarHidden}
|
|
|
|
|
/>;
|
2016-02-08 16:43:08 +00:00
|
|
|
}
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2021-03-13 15:24:26 +02:00
|
|
|
const statusBarAreaClass = classNames("mx_RoomView_statusArea", {
|
|
|
|
|
"mx_RoomView_statusArea_expanded": isStatusAreaExpanded,
|
|
|
|
|
});
|
|
|
|
|
|
2021-08-08 21:00:15 +03:00
|
|
|
// if statusBar does not exist then statusBarArea is blank and takes up unnecessary space on the screen
|
|
|
|
|
// show statusBarArea only if statusBar is present
|
2021-03-13 15:24:26 +02:00
|
|
|
const statusBarArea = statusBar && <div className={statusBarAreaClass}>
|
|
|
|
|
<div className="mx_RoomView_statusAreaBox">
|
|
|
|
|
<div className="mx_RoomView_statusAreaBox_line" />
|
2021-07-24 19:00:47 +03:00
|
|
|
{ statusBar }
|
2021-03-13 15:24:26 +02:00
|
|
|
</div>
|
2021-07-24 16:10:51 +03:00
|
|
|
</div>;
|
|
|
|
|
|
2019-01-28 17:21:33 -07:00
|
|
|
const roomVersionRecommendation = this.state.upgradeRecommendation;
|
2018-08-17 14:54:43 +01:00
|
|
|
const showRoomUpgradeBar = (
|
2019-01-28 17:21:33 -07:00
|
|
|
roomVersionRecommendation &&
|
|
|
|
|
roomVersionRecommendation.needsUpgrade &&
|
2020-03-22 09:41:14 +00:00
|
|
|
this.state.room.userMayUpgradeRoom(this.context.credentials.userId)
|
2018-08-17 14:54:43 +01:00
|
|
|
);
|
|
|
|
|
|
2020-09-07 17:32:03 +01:00
|
|
|
const hiddenHighlightCount = this.getHiddenHighlightCount();
|
2019-03-26 19:22:24 -06:00
|
|
|
|
2017-04-21 12:56:59 +01:00
|
|
|
let aux = null;
|
2019-04-10 17:49:45 +02:00
|
|
|
let previewBar;
|
2021-05-08 20:07:51 -04:00
|
|
|
if (this.state.searching) {
|
2020-09-07 17:32:03 +01:00
|
|
|
aux = <SearchBar
|
|
|
|
|
searchInProgress={this.state.searchInProgress}
|
|
|
|
|
onCancelClick={this.onCancelSearchClick}
|
|
|
|
|
onSearch={this.onSearch}
|
2020-09-16 17:23:37 -06:00
|
|
|
isRoomEncrypted={this.context.isRoomEncrypted(this.state.room.roomId)}
|
2020-09-07 17:32:03 +01:00
|
|
|
/>;
|
2018-08-17 14:54:43 +01:00
|
|
|
} else if (showRoomUpgradeBar) {
|
2021-08-16 09:16:02 +01:00
|
|
|
aux = <RoomUpgradeWarningBar room={this.state.room} />;
|
2018-08-22 16:35:58 +01:00
|
|
|
} else if (myMembership !== "join") {
|
2016-03-18 16:06:36 +00:00
|
|
|
// We do have a room object for this room, but we're not currently in it.
|
|
|
|
|
// We may have a 3rd party invite to it.
|
2020-09-07 17:32:03 +01:00
|
|
|
let inviterName = undefined;
|
2016-03-10 15:56:58 +00:00
|
|
|
if (this.props.oobData) {
|
|
|
|
|
inviterName = this.props.oobData.inviterName;
|
|
|
|
|
}
|
2020-09-11 19:49:48 -06:00
|
|
|
const invitedEmail = this.props.threepidInvite?.toEmail;
|
2019-04-10 17:49:45 +02:00
|
|
|
previewBar = (
|
2020-09-07 17:32:03 +01:00
|
|
|
<RoomPreviewBar
|
|
|
|
|
onJoinClick={this.onJoinButtonClicked}
|
|
|
|
|
onForgetClick={this.onForgetClick}
|
|
|
|
|
onRejectClick={this.onRejectThreepidInviteButtonClicked}
|
|
|
|
|
joining={this.state.joining}
|
|
|
|
|
inviterName={inviterName}
|
|
|
|
|
invitedEmail={invitedEmail}
|
|
|
|
|
oobData={this.props.oobData}
|
|
|
|
|
canPreview={this.state.canPeek}
|
|
|
|
|
room={this.state.room}
|
2016-02-09 16:55:03 +00:00
|
|
|
/>
|
2016-02-08 16:43:08 +00:00
|
|
|
);
|
2021-07-15 08:26:49 +01:00
|
|
|
if (!this.state.canPeek && (!SpaceStore.spacesEnabled || !this.state.room?.isSpaceRoom())) {
|
2019-04-12 12:47:52 +02:00
|
|
|
return (
|
|
|
|
|
<div className="mx_RoomView">
|
|
|
|
|
{ previewBar }
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2019-03-26 19:22:24 -06:00
|
|
|
} else if (hiddenHighlightCount > 0) {
|
|
|
|
|
aux = (
|
2020-09-07 17:32:03 +01:00
|
|
|
<AccessibleButton
|
|
|
|
|
element="div"
|
|
|
|
|
className="mx_RoomView_auxPanel_hiddenHighlights"
|
|
|
|
|
onClick={this.onHiddenHighlightsClick}
|
|
|
|
|
>
|
2021-07-19 22:43:11 +01:00
|
|
|
{ _t(
|
2019-03-26 19:22:24 -06:00
|
|
|
"You have %(count)s unread notifications in a prior version of this room.",
|
2021-06-29 13:11:58 +01:00
|
|
|
{ count: hiddenHighlightCount },
|
2021-07-19 22:43:11 +01:00
|
|
|
) }
|
2019-03-27 13:14:31 -06:00
|
|
|
</AccessibleButton>
|
2019-03-26 19:22:24 -06:00
|
|
|
);
|
2016-02-08 16:43:08 +00:00
|
|
|
}
|
|
|
|
|
|
2021-10-20 06:55:22 -06:00
|
|
|
if (this.state.room?.isSpaceRoom() && !this.props.forceTimeline) {
|
2021-03-01 18:10:17 +00:00
|
|
|
return <SpaceRoomView
|
|
|
|
|
space={this.state.room}
|
|
|
|
|
justCreatedOpts={this.props.justCreatedOpts}
|
|
|
|
|
resizeNotifier={this.props.resizeNotifier}
|
|
|
|
|
onJoinButtonClicked={this.onJoinButtonClicked}
|
|
|
|
|
onRejectButtonClicked={this.props.threepidInvite
|
|
|
|
|
? this.onRejectThreepidInviteButtonClicked
|
|
|
|
|
: this.onRejectButtonClicked}
|
|
|
|
|
/>;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-11 17:56:17 +01:00
|
|
|
const auxPanel = (
|
2020-09-02 11:13:00 +01:00
|
|
|
<AuxPanel
|
|
|
|
|
room={this.state.room}
|
|
|
|
|
userId={this.context.credentials.userId}
|
|
|
|
|
showApps={this.state.showApps}
|
|
|
|
|
resizeNotifier={this.props.resizeNotifier}
|
|
|
|
|
>
|
2016-02-23 15:46:27 +00:00
|
|
|
{ aux }
|
|
|
|
|
</AuxPanel>
|
|
|
|
|
);
|
2016-02-08 16:43:08 +00:00
|
|
|
|
2018-10-26 22:50:35 -05:00
|
|
|
let messageComposer; let searchInfo;
|
2017-10-11 17:56:17 +01:00
|
|
|
const canSpeak = (
|
2016-02-08 16:43:08 +00:00
|
|
|
// joined and not showing search results
|
2018-10-15 14:26:02 -06:00
|
|
|
myMembership === 'join' && !this.state.searchResults
|
2016-02-08 16:43:08 +00:00
|
|
|
);
|
|
|
|
|
if (canSpeak) {
|
2020-01-06 00:13:16 +00:00
|
|
|
messageComposer =
|
|
|
|
|
<MessageComposer
|
|
|
|
|
room={this.state.room}
|
|
|
|
|
e2eStatus={this.state.e2eStatus}
|
2020-07-31 14:02:40 +02:00
|
|
|
resizeNotifier={this.props.resizeNotifier}
|
2020-10-28 12:47:59 +00:00
|
|
|
replyToEvent={this.state.replyToEvent}
|
2020-09-07 17:32:03 +01:00
|
|
|
permalinkCreator={this.getPermalinkCreatorForRoom(this.state.room)}
|
2020-01-06 00:13:16 +00:00
|
|
|
/>;
|
2016-02-08 16:43:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: Why aren't we storing the term/scope/count in this format
|
|
|
|
|
// in this.state if this is what RoomHeader desires?
|
|
|
|
|
if (this.state.searchResults) {
|
|
|
|
|
searchInfo = {
|
2017-10-11 17:56:17 +01:00
|
|
|
searchTerm: this.state.searchTerm,
|
|
|
|
|
searchScope: this.state.searchScope,
|
|
|
|
|
searchCount: this.state.searchResults.count,
|
2016-02-08 16:43:08 +00:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if we have search results, we keep the messagepanel (so that it preserves its
|
|
|
|
|
// scroll state), but hide it.
|
2017-10-11 17:56:17 +01:00
|
|
|
let searchResultsPanel;
|
|
|
|
|
let hideMessagePanel = false;
|
2016-02-08 16:43:08 +00:00
|
|
|
|
|
|
|
|
if (this.state.searchResults) {
|
2019-01-15 18:45:56 +01:00
|
|
|
// show searching spinner
|
2020-10-19 12:46:55 +01:00
|
|
|
if (this.state.searchResults.count === undefined) {
|
2020-09-07 17:32:03 +01:00
|
|
|
searchResultsPanel = (
|
|
|
|
|
<div className="mx_RoomView_messagePanel mx_RoomView_messagePanelSearchSpinner" />
|
|
|
|
|
);
|
2019-01-15 18:45:56 +01:00
|
|
|
} else {
|
|
|
|
|
searchResultsPanel = (
|
2020-06-16 00:51:11 +01:00
|
|
|
<ScrollPanel
|
2020-09-07 17:32:03 +01:00
|
|
|
ref={this.searchResultsPanel}
|
2020-06-16 00:51:11 +01:00
|
|
|
className="mx_RoomView_messagePanel mx_RoomView_searchResultsPanel mx_GroupLayout"
|
2019-01-15 18:45:56 +01:00
|
|
|
onFillRequest={this.onSearchResultsFillRequest}
|
2019-03-18 14:05:56 +01:00
|
|
|
resizeNotifier={this.props.resizeNotifier}
|
2019-01-15 18:45:56 +01:00
|
|
|
>
|
2020-09-07 17:32:03 +01:00
|
|
|
<li className={scrollheaderClasses} />
|
2019-01-15 18:45:56 +01:00
|
|
|
{ this.getSearchResultTiles() }
|
|
|
|
|
</ScrollPanel>
|
|
|
|
|
);
|
|
|
|
|
}
|
2016-02-08 16:43:08 +00:00
|
|
|
hideMessagePanel = true;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-08 14:17:49 +01:00
|
|
|
let highlightedEventId = null;
|
2021-05-08 20:07:51 -04:00
|
|
|
if (this.state.isInitialEventHighlighted) {
|
2017-06-08 15:47:41 +01:00
|
|
|
highlightedEventId = this.state.initialEventId;
|
2017-06-08 14:17:49 +01:00
|
|
|
}
|
|
|
|
|
|
2020-05-26 15:56:16 +01:00
|
|
|
const messagePanelClassNames = classNames(
|
|
|
|
|
"mx_RoomView_messagePanel",
|
|
|
|
|
{
|
2021-01-22 13:44:45 +01:00
|
|
|
"mx_IRCLayout": this.state.layout == Layout.IRC,
|
|
|
|
|
"mx_GroupLayout": this.state.layout == Layout.Group,
|
2020-05-26 15:56:16 +01:00
|
|
|
});
|
|
|
|
|
|
2019-11-26 01:14:03 +00:00
|
|
|
// console.info("ShowUrlPreview for %s is %s", this.state.room.roomId, this.state.showUrlPreview);
|
2017-10-11 17:56:17 +01:00
|
|
|
const messagePanel = (
|
2019-12-08 12:16:17 +00:00
|
|
|
<TimelinePanel
|
2020-09-07 17:32:03 +01:00
|
|
|
ref={this.gatherTimelinePanelRef}
|
2017-08-30 13:32:07 +01:00
|
|
|
timelineSet={this.state.room.getUnfilteredTimelineSet()}
|
2020-03-20 09:29:59 +00:00
|
|
|
showReadReceipts={this.state.showReadReceipts}
|
2017-10-11 18:43:24 -06:00
|
|
|
manageReadReceipts={!this.state.isPeeking}
|
2021-04-29 09:37:21 +01:00
|
|
|
sendReadReceiptOnLoad={!this.state.wasContextSwitch}
|
2017-10-11 18:43:24 -06:00
|
|
|
manageReadMarkers={!this.state.isPeeking}
|
2017-08-30 13:32:07 +01:00
|
|
|
hidden={hideMessagePanel}
|
|
|
|
|
highlightedEventId={highlightedEventId}
|
|
|
|
|
eventId={this.state.initialEventId}
|
|
|
|
|
eventPixelOffset={this.state.initialEventPixelOffset}
|
2017-10-11 17:56:17 +01:00
|
|
|
onScroll={this.onMessageListScroll}
|
2021-04-06 17:26:32 +01:00
|
|
|
onUserScroll={this.onUserScroll}
|
2020-09-07 17:32:03 +01:00
|
|
|
onReadMarkerUpdated={this.updateTopUnreadMessagesBar}
|
2021-07-19 22:43:11 +01:00
|
|
|
showUrlPreview={this.state.showUrlPreview}
|
2020-05-26 15:56:16 +01:00
|
|
|
className={messagePanelClassNames}
|
2018-09-17 19:27:25 +02:00
|
|
|
membersLoaded={this.state.membersLoaded}
|
2020-09-07 17:32:03 +01:00
|
|
|
permalinkCreator={this.getPermalinkCreatorForRoom(this.state.room)}
|
2019-03-12 16:36:12 +01:00
|
|
|
resizeNotifier={this.props.resizeNotifier}
|
2019-05-21 17:23:19 +01:00
|
|
|
showReactions={true}
|
2021-01-22 13:44:45 +01:00
|
|
|
layout={this.state.layout}
|
2021-06-29 08:16:43 +01:00
|
|
|
editState={this.state.editState}
|
2016-02-10 18:27:40 +00:00
|
|
|
/>);
|
2016-02-08 16:43:08 +00:00
|
|
|
|
2017-10-11 17:56:17 +01:00
|
|
|
let topUnreadMessagesBar = null;
|
2019-12-26 20:32:25 +00:00
|
|
|
// Do not show TopUnreadMessagesBar if we have search results showing, it makes no sense
|
|
|
|
|
if (this.state.showTopUnreadMessagesBar && !this.state.searchResults) {
|
2020-09-07 17:32:03 +01:00
|
|
|
topUnreadMessagesBar = (
|
|
|
|
|
<TopUnreadMessagesBar onScrollUpClick={this.jumpToReadMarker} onCloseClick={this.forgetReadMarker} />
|
|
|
|
|
);
|
2016-02-24 17:26:34 +00:00
|
|
|
}
|
2019-01-22 14:50:16 +01:00
|
|
|
let jumpToBottom;
|
2019-12-26 20:32:25 +00:00
|
|
|
// Do not show JumpToBottomButton if we have search results showing, it makes no sense
|
|
|
|
|
if (!this.state.atEndOfLiveTimeline && !this.state.searchResults) {
|
2019-01-22 14:50:16 +01:00
|
|
|
jumpToBottom = (<JumpToBottomButton
|
2021-06-18 16:18:42 +01:00
|
|
|
highlight={this.state.room.getUnreadNotificationCount(NotificationCountType.Highlight) > 0}
|
2019-01-22 14:50:16 +01:00
|
|
|
numUnreadMessages={this.state.numUnreadMessages}
|
|
|
|
|
onScrollToBottomClick={this.jumpToLiveTimeline}
|
|
|
|
|
/>);
|
|
|
|
|
}
|
2017-10-25 15:15:49 +01:00
|
|
|
|
2020-10-01 12:30:41 +01:00
|
|
|
const showRightPanel = this.state.room && this.state.showRightPanel;
|
2021-11-29 17:06:15 +01:00
|
|
|
|
2019-12-05 17:47:18 -07:00
|
|
|
const rightPanel = showRightPanel
|
2021-08-17 10:38:09 +01:00
|
|
|
? <RightPanel
|
|
|
|
|
room={this.state.room}
|
|
|
|
|
resizeNotifier={this.props.resizeNotifier}
|
2021-09-07 16:02:26 +01:00
|
|
|
permalinkCreator={this.getPermalinkCreatorForRoom(this.state.room)}
|
|
|
|
|
e2eStatus={this.state.e2eStatus} />
|
2019-12-05 17:47:18 -07:00
|
|
|
: null;
|
2018-10-30 18:13:17 +01:00
|
|
|
|
2020-03-20 09:29:59 +00:00
|
|
|
const timelineClasses = classNames("mx_RoomView_timeline", {
|
|
|
|
|
mx_RoomView_timeline_rr_enabled: this.state.showReadReceipts,
|
|
|
|
|
});
|
|
|
|
|
|
2020-04-14 15:24:41 +01:00
|
|
|
const mainClasses = classNames("mx_RoomView", {
|
2020-10-09 18:56:07 +01:00
|
|
|
mx_RoomView_inCall: Boolean(activeCall),
|
2020-04-14 15:24:41 +01:00
|
|
|
});
|
|
|
|
|
|
2020-10-19 21:25:01 +02:00
|
|
|
const showChatEffects = SettingsStore.getValue('showChatEffects');
|
|
|
|
|
|
2021-11-16 15:43:18 +01:00
|
|
|
// Decide what to show in the main split
|
|
|
|
|
let mainSplitBody = <React.Fragment>
|
|
|
|
|
{ auxPanel }
|
|
|
|
|
<div className={timelineClasses}>
|
|
|
|
|
{ fileDropTarget }
|
|
|
|
|
{ topUnreadMessagesBar }
|
|
|
|
|
{ jumpToBottom }
|
|
|
|
|
{ messagePanel }
|
|
|
|
|
{ searchResultsPanel }
|
|
|
|
|
</div>
|
|
|
|
|
{ statusBarArea }
|
|
|
|
|
{ previewBar }
|
|
|
|
|
{ messageComposer }
|
|
|
|
|
</React.Fragment>;
|
|
|
|
|
|
|
|
|
|
switch (this.state.mainSplitContentType) {
|
|
|
|
|
case MainSplitContentType.Timeline:
|
|
|
|
|
// keep the timeline in as the mainSplitBody
|
|
|
|
|
break;
|
|
|
|
|
case MainSplitContentType.MaximisedWidget:
|
|
|
|
|
mainSplitBody = <AppsDrawer
|
|
|
|
|
room={this.state.room}
|
|
|
|
|
userId={this.context.credentials.userId}
|
|
|
|
|
resizeNotifier={this.props.resizeNotifier}
|
|
|
|
|
showApps={true}
|
|
|
|
|
/>;
|
|
|
|
|
break;
|
|
|
|
|
// TODO-video MainSplitContentType.Video:
|
|
|
|
|
// break;
|
|
|
|
|
}
|
2021-11-29 19:01:47 +01:00
|
|
|
let excludedRightPanelPhaseButtons = [RightPanelPhases.Timeline];
|
|
|
|
|
let onAppsClick = this.onAppsClick;
|
|
|
|
|
let onForgetClick = this.onForgetClick;
|
|
|
|
|
let onSearchClick = this.onSearchClick;
|
|
|
|
|
if (this.state.mainSplitContentType === MainSplitContentType.MaximisedWidget) {
|
|
|
|
|
// Disable phase buttons and action button to have a simplified header when a widget is maximised
|
|
|
|
|
// and enable (not disable) the RightPanelPhases.Timeline button
|
|
|
|
|
excludedRightPanelPhaseButtons = [
|
|
|
|
|
RightPanelPhases.ThreadPanel,
|
|
|
|
|
RightPanelPhases.PinnedMessages,
|
|
|
|
|
];
|
|
|
|
|
onAppsClick = null;
|
|
|
|
|
onForgetClick = null;
|
|
|
|
|
onSearchClick = null;
|
|
|
|
|
}
|
2016-02-08 16:43:08 +00:00
|
|
|
return (
|
2019-12-17 17:26:12 +00:00
|
|
|
<RoomContext.Provider value={this.state}>
|
2020-09-07 17:32:03 +01:00
|
|
|
<main className={mainClasses} ref={this.roomView} onKeyDown={this.onReactKeyDown}>
|
2021-07-19 22:43:11 +01:00
|
|
|
{ showChatEffects && this.roomView.current &&
|
2020-10-19 21:25:01 +02:00
|
|
|
<EffectsOverlay roomWidth={this.roomView.current.offsetWidth} />
|
2020-10-19 13:54:09 +02:00
|
|
|
}
|
2019-12-17 17:26:12 +00:00
|
|
|
<ErrorBoundary>
|
|
|
|
|
<RoomHeader
|
|
|
|
|
room={this.state.room}
|
|
|
|
|
searchInfo={searchInfo}
|
|
|
|
|
oobData={this.props.oobData}
|
|
|
|
|
inRoom={myMembership === 'join'}
|
2021-11-29 19:01:47 +01:00
|
|
|
onSearchClick={onSearchClick}
|
|
|
|
|
onForgetClick={(myMembership === "leave") ? onForgetClick : null}
|
2019-12-17 17:26:12 +00:00
|
|
|
e2eStatus={this.state.e2eStatus}
|
2021-11-29 19:01:47 +01:00
|
|
|
onAppsClick={this.state.hasPinnedWidgets ? onAppsClick : null}
|
2020-10-09 08:42:21 +01:00
|
|
|
appsShown={this.state.showApps}
|
2021-02-26 13:46:39 -07:00
|
|
|
onCallPlaced={this.onCallPlaced}
|
2021-11-29 19:01:47 +01:00
|
|
|
excludedRightPanelPhaseButtons={excludedRightPanelPhaseButtons}
|
2019-12-17 17:26:12 +00:00
|
|
|
/>
|
2020-09-02 12:00:35 +01:00
|
|
|
<MainSplit panel={rightPanel} resizeNotifier={this.props.resizeNotifier}>
|
2022-01-11 17:21:59 +00:00
|
|
|
<div className="mx_RoomView_body" data-layout={this.state.layout}>
|
2021-11-16 15:43:18 +01:00
|
|
|
{ mainSplitBody }
|
2019-10-02 17:28:03 +01:00
|
|
|
</div>
|
2019-12-17 17:26:12 +00:00
|
|
|
</MainSplit>
|
|
|
|
|
</ErrorBoundary>
|
|
|
|
|
</main>
|
|
|
|
|
</RoomContext.Provider>
|
2016-02-08 16:43:08 +00:00
|
|
|
);
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
|
|
|
|
}
|
2021-10-01 15:35:54 +02:00
|
|
|
|
|
|
|
|
const RoomViewWithMatrixClient = withMatrixClientHOC(RoomView);
|
|
|
|
|
export default RoomViewWithMatrixClient;
|