2015-11-30 20:15:57 +03:00
|
|
|
/*
|
2016-01-07 07:06:39 +03:00
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
2017-02-17 14:44:56 +03:00
|
|
|
Copyright 2017 Vector Creations Ltd
|
2019-01-09 19:27:41 +03:00
|
|
|
Copyright 2018, 2019 New Vector Ltd
|
2019-06-10 12:24:06 +03:00
|
|
|
Copyright 2019 The Matrix.org Foundation C.I.C.
|
2015-11-30 20:15:57 +03: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
|
|
|
|
|
2019-04-02 12:50:17 +03:00
|
|
|
import shouldHideEvent from '../../shouldHideEvent';
|
2017-08-28 15:46:09 +03:00
|
|
|
|
2019-12-08 15:16:17 +03:00
|
|
|
import React, {createRef} from 'react';
|
2019-08-30 12:34:59 +03:00
|
|
|
import createReactClass from 'create-react-class';
|
2017-12-26 04:03:18 +03:00
|
|
|
import PropTypes from 'prop-types';
|
2019-04-02 12:50:17 +03:00
|
|
|
import classNames from 'classnames';
|
2017-05-25 13:39:08 +03:00
|
|
|
import { _t } from '../../languageHandler';
|
2019-10-01 05:39:58 +03:00
|
|
|
import {RoomPermalinkCreator} from '../../utils/permalinks/Permalinks';
|
2015-11-30 20:15:57 +03:00
|
|
|
|
2019-04-01 18:42:41 +03:00
|
|
|
import ContentMessages from '../../ContentMessages';
|
2019-04-02 12:50:17 +03:00
|
|
|
import Modal from '../../Modal';
|
2019-12-20 04:19:56 +03:00
|
|
|
import * as sdk from '../../index';
|
2019-04-02 12:50:17 +03:00
|
|
|
import CallHandler from '../../CallHandler';
|
2020-05-14 05:41:41 +03:00
|
|
|
import dis from '../../dispatcher/dispatcher';
|
2019-04-02 12:50:17 +03:00
|
|
|
import Tinter from '../../Tinter';
|
|
|
|
import rate_limited_func from '../../ratelimitedfunc';
|
2019-12-20 04:19:56 +03:00
|
|
|
import * as ObjectUtils from '../../ObjectUtils';
|
2019-05-09 17:17:54 +03:00
|
|
|
import * as Rooms from '../../Rooms';
|
2020-05-29 12:44:08 +03:00
|
|
|
import eventSearch, {searchPagination} from '../../Searching';
|
2015-11-30 20:15:57 +03:00
|
|
|
|
2020-05-13 12:38:32 +03:00
|
|
|
import {isOnlyCtrlOrCmdIgnoreShiftKeyEvent, isOnlyCtrlOrCmdKeyEvent, Key} from '../../Keyboard';
|
2016-10-17 16:03:37 +03:00
|
|
|
|
2018-10-30 20:13:17 +03:00
|
|
|
import MainSplit from './MainSplit';
|
|
|
|
import RightPanel from './RightPanel';
|
2019-01-17 12:29:37 +03:00
|
|
|
import RoomViewStore from '../../stores/RoomViewStore';
|
2017-09-07 19:08:36 +03:00
|
|
|
import RoomScrollStateStore from '../../stores/RoomScrollStateStore';
|
2018-07-03 13:16:44 +03:00
|
|
|
import WidgetEchoStore from '../../stores/WidgetEchoStore';
|
2020-07-28 20:53:43 +03:00
|
|
|
import SettingsStore from "../../settings/SettingsStore";
|
2019-03-27 22:14:31 +03:00
|
|
|
import AccessibleButton from "../views/elements/AccessibleButton";
|
2019-12-06 03:47:18 +03:00
|
|
|
import RightPanelStore from "../../stores/RightPanelStore";
|
2019-12-21 00:43:06 +03:00
|
|
|
import {haveTileForEvent} from "../views/rooms/EventTile";
|
2019-12-17 20:26:12 +03:00
|
|
|
import RoomContext from "../../contexts/RoomContext";
|
2020-03-22 12:41:14 +03:00
|
|
|
import MatrixClientContext from "../../contexts/MatrixClientContext";
|
2020-03-30 12:18:47 +03:00
|
|
|
import { shieldStatusForRoom } from '../../utils/ShieldUtils';
|
2020-06-03 04:07:46 +03:00
|
|
|
import {Action} from "../../dispatcher/actions";
|
2020-07-28 20:53:43 +03:00
|
|
|
import {SettingLevel} from "../../settings/SettingLevel";
|
2017-05-24 18:56:13 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const DEBUG = false;
|
2017-06-27 19:39:29 +03:00
|
|
|
let debuglog = function() {};
|
2015-11-30 20:15:57 +03:00
|
|
|
|
2017-07-12 12:21:43 +03:00
|
|
|
const BROWSER_SUPPORTS_SANDBOX = 'sandbox' in document.createElement('iframe');
|
|
|
|
|
2016-02-10 21:27:40 +03:00
|
|
|
if (DEBUG) {
|
2016-01-04 19:28:32 +03:00
|
|
|
// using bind means that we get to keep useful line numbers in the console
|
2017-06-27 19:39:29 +03:00
|
|
|
debuglog = console.log.bind(console);
|
2016-01-04 19:28:32 +03:00
|
|
|
}
|
|
|
|
|
2019-12-20 03:45:24 +03:00
|
|
|
export default createReactClass({
|
2015-11-30 20:15:57 +03:00
|
|
|
displayName: 'RoomView',
|
|
|
|
propTypes: {
|
2017-12-26 04:03:18 +03:00
|
|
|
ConferenceHandler: PropTypes.any,
|
2016-02-03 18:18:18 +03:00
|
|
|
|
2017-04-28 15:22:55 +03:00
|
|
|
// Called with the credentials of a registered user (if they were a ROU that
|
|
|
|
// transitioned to PWLU)
|
2017-12-26 04:03:18 +03:00
|
|
|
onRegistered: PropTypes.func,
|
2016-06-14 14:56:37 +03:00
|
|
|
|
2016-03-17 21:38:25 +03:00
|
|
|
// An object representing a third party invite to join this room
|
|
|
|
// Fields:
|
|
|
|
// * inviteSignUrl (string) The URL used to join this room from an email invite
|
|
|
|
// (given as part of the link in the invite email)
|
|
|
|
// * invitedEmail (string) The email address that was invited to this room
|
2017-12-26 04:03:18 +03:00
|
|
|
thirdPartyInvite: PropTypes.object,
|
2016-02-23 13:15:07 +03:00
|
|
|
|
2019-02-01 03:52:39 +03:00
|
|
|
// Any data about the room that would normally come from the homeserver
|
2016-03-01 21:23:57 +03:00
|
|
|
// but has been passed out-of-band, eg. the room name and avatar URL
|
|
|
|
// from an email invite (a workaround for the fact that we can't
|
|
|
|
// get this information from the HS using an email invite).
|
2016-03-02 14:51:47 +03:00
|
|
|
// Fields:
|
|
|
|
// * name (string) The room's name
|
|
|
|
// * avatarUrl (string) The mxc:// avatar URL for the room
|
2016-03-02 17:04:51 +03:00
|
|
|
// * inviterName (string) The display name of the person who
|
2019-07-31 02:46:21 +03:00
|
|
|
// * invited us to the room
|
2017-12-26 04:03:18 +03:00
|
|
|
oobData: PropTypes.object,
|
2016-03-01 21:23:57 +03:00
|
|
|
|
2018-10-19 22:30:38 +03:00
|
|
|
// Servers the RoomView can use to try and assist joins
|
|
|
|
viaServers: PropTypes.arrayOf(PropTypes.string),
|
2015-11-30 20:15:57 +03:00
|
|
|
},
|
|
|
|
|
2020-03-22 12:41:14 +03:00
|
|
|
statics: {
|
|
|
|
contextType: MatrixClientContext,
|
|
|
|
},
|
|
|
|
|
2015-11-30 20:15:57 +03:00
|
|
|
getInitialState: function() {
|
2020-03-22 12:41:14 +03:00
|
|
|
const llMembers = this.context.hasLazyLoadMembersEnabled();
|
2015-11-30 20:15:57 +03:00
|
|
|
return {
|
2016-06-14 16:38:45 +03:00
|
|
|
room: null,
|
|
|
|
roomId: null,
|
|
|
|
roomLoading: true,
|
2017-06-05 11:52:39 +03:00
|
|
|
peekLoading: false,
|
2017-06-16 20:24:07 +03:00
|
|
|
shouldPeek: true,
|
2018-06-23 16:28:20 +03:00
|
|
|
|
|
|
|
// Media limits for uploading.
|
|
|
|
mediaConfig: undefined,
|
2017-04-21 14:56:59 +03:00
|
|
|
|
2018-09-17 20:27:25 +03:00
|
|
|
// used to trigger a rerender in TimelinePanel once the members are loaded,
|
|
|
|
// so RR are rendered again (now with the members available), ...
|
|
|
|
membersLoaded: !llMembers,
|
2017-06-08 17:37:30 +03:00
|
|
|
// The event to be scrolled to initially
|
2017-06-08 19:26:08 +03:00
|
|
|
initialEventId: null,
|
2017-06-08 17:37:30 +03:00
|
|
|
// The offset in pixels from the event with which to scroll vertically
|
2017-06-08 19:26:08 +03:00
|
|
|
initialEventPixelOffset: null,
|
2017-06-08 17:37:30 +03:00
|
|
|
// Whether to highlight the event scrolled to
|
2017-06-08 19:26:08 +03:00
|
|
|
isInitialEventHighlighted: null,
|
2017-04-21 14:56:59 +03:00
|
|
|
|
2017-05-19 03:29:11 +03:00
|
|
|
forwardingEvent: null,
|
2015-11-30 20:15:57 +03:00
|
|
|
numUnreadMessages: 0,
|
|
|
|
draggingFile: false,
|
|
|
|
searching: false,
|
|
|
|
searchResults: null,
|
2015-12-15 02:37:34 +03:00
|
|
|
callState: null,
|
2016-01-13 16:22:58 +03:00
|
|
|
guestsCanJoin: false,
|
2016-01-18 20:39:23 +03:00
|
|
|
canPeek: false,
|
2017-05-17 23:15:57 +03:00
|
|
|
showApps: false,
|
2017-10-12 06:15:00 +03:00
|
|
|
isAlone: false,
|
2017-10-12 03:43:24 +03:00
|
|
|
isPeeking: false,
|
2018-05-27 04:32:23 +03:00
|
|
|
showingPinned: false,
|
2020-03-20 12:29:59 +03:00
|
|
|
showReadReceipts: true,
|
2020-03-20 03:18:24 +03:00
|
|
|
showRightPanel: RightPanelStore.getSharedInstance().isOpenForRoom,
|
2016-02-03 11:03:10 +03:00
|
|
|
|
2016-06-28 19:11:47 +03:00
|
|
|
// error object, as from the matrix client/server API
|
2016-06-28 16:59:45 +03:00
|
|
|
// If we failed to load information about the room,
|
|
|
|
// store the error here.
|
2016-06-24 17:34:07 +03:00
|
|
|
roomLoadError: null,
|
2016-02-03 11:03:10 +03:00
|
|
|
|
2017-09-15 17:07:09 +03:00
|
|
|
// Have we sent a request to join the room that we're waiting to complete?
|
|
|
|
joining: false,
|
|
|
|
|
2016-02-03 11:03:10 +03:00
|
|
|
// 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: true,
|
2019-03-26 23:22:48 +03:00
|
|
|
atEndOfLiveTimelineInit: false, // used by componentDidUpdate to avoid unnecessary checks
|
2016-02-23 18:46:27 +03:00
|
|
|
|
2016-02-24 20:26:34 +03:00
|
|
|
showTopUnreadMessagesBar: false,
|
|
|
|
|
2016-02-23 18:46:27 +03:00
|
|
|
auxPanelMaxHeight: undefined,
|
2017-01-23 18:01:39 +03:00
|
|
|
|
|
|
|
statusBarVisible: false,
|
2019-01-29 03:21:33 +03:00
|
|
|
|
|
|
|
// We load this later by asking the js-sdk to suggest a version for us.
|
|
|
|
// This object is the result of Room#getRecommendedVersion()
|
|
|
|
upgradeRecommendation: null,
|
2019-07-31 02:46:21 +03:00
|
|
|
|
|
|
|
canReact: false,
|
|
|
|
canReply: false,
|
2020-05-19 15:17:34 +03:00
|
|
|
|
2020-06-16 19:55:19 +03:00
|
|
|
useIRCLayout: SettingsStore.getValue("useIRCLayout"),
|
2020-05-29 21:14:19 +03:00
|
|
|
|
2020-05-19 15:17:34 +03:00
|
|
|
matrixClientIsReady: this.context && this.context.isInitialSyncComplete(),
|
2019-07-31 02:46:21 +03:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2020-03-31 23:12:52 +03:00
|
|
|
// TODO: [REACT-WARNING] Replace component with real class, use constructor for refs
|
|
|
|
UNSAFE_componentWillMount: function() {
|
2019-01-17 12:29:37 +03:00
|
|
|
this.dispatcherRef = dis.register(this.onAction);
|
2020-03-22 12:41:14 +03: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 14:43:30 +03:00
|
|
|
this.context.on("crossSigning.keysChanged", this.onCrossSigningKeysChanged);
|
2017-05-24 18:56:13 +03:00
|
|
|
// Start listening for RoomViewStore updates
|
2019-01-17 12:29:37 +03:00
|
|
|
this._roomStoreToken = RoomViewStore.addListener(this._onRoomViewStoreUpdate);
|
2020-03-20 03:18:24 +03:00
|
|
|
this._rightPanelStoreToken = RightPanelStore.getSharedInstance().addListener(this._onRightPanelStoreUpdate);
|
2017-05-24 18:56:13 +03:00
|
|
|
this._onRoomViewStoreUpdate(true);
|
2018-07-03 13:16:44 +03:00
|
|
|
|
2018-07-05 22:00:42 +03:00
|
|
|
WidgetEchoStore.on('update', this._onWidgetEchoStoreUpdate);
|
2020-03-20 12:29:59 +03:00
|
|
|
this._showReadReceiptsWatchRef = SettingsStore.watchSetting("showReadReceipts", null,
|
|
|
|
this._onReadReceiptsChange);
|
2019-10-04 08:20:00 +03:00
|
|
|
|
2019-12-08 15:16:17 +03:00
|
|
|
this._roomView = createRef();
|
|
|
|
this._searchResultsPanel = createRef();
|
2020-05-26 17:56:16 +03:00
|
|
|
|
2020-06-16 19:55:19 +03:00
|
|
|
this._layoutWatcherRef = SettingsStore.watchSetting("useIRCLayout", null, this.onLayoutChange);
|
2019-10-04 08:20:00 +03:00
|
|
|
},
|
|
|
|
|
2020-03-20 12:29:59 +03:00
|
|
|
_onReadReceiptsChange: function() {
|
|
|
|
this.setState({
|
|
|
|
showReadReceipts: SettingsStore.getValue("showReadReceipts", this.state.roomId),
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2017-05-24 18:56:13 +03:00
|
|
|
_onRoomViewStoreUpdate: function(initial) {
|
|
|
|
if (this.unmounted) {
|
|
|
|
return;
|
2016-06-14 13:37:04 +03:00
|
|
|
}
|
2019-01-17 12:29:37 +03:00
|
|
|
|
|
|
|
if (!initial && this.state.roomId !== RoomViewStore.getRoomId()) {
|
2017-09-11 19:57:52 +03: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 20:39:30 +03: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 19:57:52 +03:00
|
|
|
return;
|
|
|
|
}
|
2019-01-17 12:29:37 +03:00
|
|
|
|
2020-03-20 12:29:59 +03:00
|
|
|
const roomId = RoomViewStore.getRoomId();
|
|
|
|
|
2017-06-08 16:17:49 +03:00
|
|
|
const newState = {
|
2020-03-20 12:29:59 +03:00
|
|
|
roomId,
|
2019-01-17 12:29:37 +03:00
|
|
|
roomAlias: RoomViewStore.getRoomAlias(),
|
|
|
|
roomLoading: RoomViewStore.isRoomLoading(),
|
|
|
|
roomLoadError: RoomViewStore.getRoomLoadError(),
|
|
|
|
joining: RoomViewStore.isJoining(),
|
|
|
|
initialEventId: RoomViewStore.getInitialEventId(),
|
|
|
|
isInitialEventHighlighted: RoomViewStore.isInitialEventHighlighted(),
|
|
|
|
forwardingEvent: RoomViewStore.getForwardingEvent(),
|
2020-05-19 15:17:34 +03:00
|
|
|
// we should only peek once we have a ready client
|
|
|
|
shouldPeek: this.state.matrixClientIsReady && RoomViewStore.shouldPeek(),
|
2020-03-20 12:29:59 +03:00
|
|
|
showingPinned: SettingsStore.getValue("PinnedEvents.isOpen", roomId),
|
|
|
|
showReadReceipts: SettingsStore.getValue("showReadReceipts", roomId),
|
2017-06-08 16:17:49 +03:00
|
|
|
};
|
|
|
|
|
2020-03-31 12:37:56 +03:00
|
|
|
if (!initial && this.state.shouldPeek && !newState.shouldPeek) {
|
|
|
|
// Stop peeking because we have joined this room now
|
|
|
|
this.context.stopPeeking();
|
|
|
|
}
|
|
|
|
|
2020-08-03 18:02:26 +03:00
|
|
|
// Temporary logging to diagnose https://github.com/vector-im/element-web/issues/4307
|
2017-06-14 18:53:21 +03:00
|
|
|
console.log(
|
|
|
|
'RVS update:',
|
|
|
|
newState.roomId,
|
|
|
|
newState.roomAlias,
|
|
|
|
'loading?', newState.roomLoading,
|
|
|
|
'joining?', newState.joining,
|
2017-06-16 20:24:07 +03:00
|
|
|
'initial?', initial,
|
|
|
|
'shouldPeek?', newState.shouldPeek,
|
2017-06-14 18:53:21 +03:00
|
|
|
);
|
|
|
|
|
2017-06-14 18:48:34 +03:00
|
|
|
// NB: This does assume that the roomID will not change for the lifetime of
|
|
|
|
// the RoomView instance
|
|
|
|
if (initial) {
|
2020-03-22 12:41:14 +03:00
|
|
|
newState.room = this.context.getRoom(newState.roomId);
|
2017-09-08 20:11:13 +03:00
|
|
|
if (newState.room) {
|
|
|
|
newState.showApps = this._shouldShowApps(newState.room);
|
|
|
|
this._onRoomLoaded(newState.room);
|
|
|
|
}
|
2017-06-14 18:48:34 +03:00
|
|
|
}
|
|
|
|
|
2017-09-08 15:39:22 +03:00
|
|
|
if (this.state.roomId === null && newState.roomId !== null) {
|
|
|
|
// Get the scroll state for the new room
|
2017-09-07 19:08:36 +03:00
|
|
|
|
|
|
|
// If an event ID wasn't specified, default to the one saved for this room
|
2017-09-07 19:16:32 +03:00
|
|
|
// in the scroll state store. Assume initialEventPixelOffset should be set.
|
2017-09-07 19:08:36 +03:00
|
|
|
if (!newState.initialEventId) {
|
2020-04-20 04:14:08 +03:00
|
|
|
const roomScrollState = RoomScrollStateStore.getScrollState(newState.roomId);
|
2017-09-07 19:08:36 +03:00
|
|
|
if (roomScrollState) {
|
|
|
|
newState.initialEventId = roomScrollState.focussedEvent;
|
|
|
|
newState.initialEventPixelOffset = roomScrollState.pixelOffset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-08 17:38:58 +03:00
|
|
|
// Clear the search results when clicking a search result (which changes the
|
2017-06-08 17:47:41 +03:00
|
|
|
// currently scrolled to event, this.state.initialEventId).
|
|
|
|
if (this.state.initialEventId !== newState.initialEventId) {
|
2017-06-08 16:17:49 +03:00
|
|
|
newState.searchResults = null;
|
|
|
|
}
|
|
|
|
|
2017-09-08 19:06:46 +03: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 19:39:10 +03:00
|
|
|
|
2017-09-08 19:06:46 +03: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) {
|
2017-09-08 20:11:13 +03:00
|
|
|
this._setupRoom(newState.room, newState.roomId, newState.joining, newState.shouldPeek);
|
2017-09-08 19:06:46 +03:00
|
|
|
}
|
2016-06-14 13:37:04 +03:00
|
|
|
},
|
|
|
|
|
2019-02-12 11:59:38 +03:00
|
|
|
_getRoomId() {
|
|
|
|
// According to `_onRoomViewStoreUpdate`, `state.roomId` can be null
|
|
|
|
// 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;
|
|
|
|
},
|
|
|
|
|
2019-04-09 21:01:09 +03:00
|
|
|
_getPermalinkCreatorForRoom: function(room) {
|
|
|
|
if (!this._permalinkCreators) this._permalinkCreators = {};
|
|
|
|
if (this._permalinkCreators[room.roomId]) return this._permalinkCreators[room.roomId];
|
|
|
|
|
2019-04-11 19:59:00 +03:00
|
|
|
this._permalinkCreators[room.roomId] = new RoomPermalinkCreator(room);
|
2019-04-12 19:38:39 +03: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.
|
|
|
|
this._permalinkCreators[room.roomId].start();
|
|
|
|
} else {
|
|
|
|
this._permalinkCreators[room.roomId].load();
|
|
|
|
}
|
2019-04-11 19:59:00 +03:00
|
|
|
return this._permalinkCreators[room.roomId];
|
2019-04-09 21:01:09 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
_stopAllPermalinkCreators: function() {
|
|
|
|
if (!this._permalinkCreators) return;
|
|
|
|
for (const roomId of Object.keys(this._permalinkCreators)) {
|
|
|
|
this._permalinkCreators[roomId].stop();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-07-03 13:16:44 +03:00
|
|
|
_onWidgetEchoStoreUpdate: function() {
|
|
|
|
this.setState({
|
|
|
|
showApps: this._shouldShowApps(this.state.room),
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2017-09-08 20:11:13 +03:00
|
|
|
_setupRoom: function(room, roomId, joining, shouldPeek) {
|
2016-01-07 19:22:17 +03: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 13:37:04 +03: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 10:54:15 +03:00
|
|
|
|
2017-06-15 13:49:16 +03: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 19:56:53 +03:00
|
|
|
if (!joining && roomId) {
|
2016-06-20 18:30:51 +03:00
|
|
|
if (this.props.autoJoin) {
|
|
|
|
this.onJoinButtonClicked();
|
2017-09-08 19:56:53 +03:00
|
|
|
} else if (!room && shouldPeek) {
|
2019-11-26 04:14:03 +03:00
|
|
|
console.info("Attempting to peek into room %s", roomId);
|
2017-06-05 11:52:39 +03:00
|
|
|
this.setState({
|
|
|
|
peekLoading: true,
|
2017-10-12 03:43:24 +03:00
|
|
|
isPeeking: true, // this will change to false if peeking fails
|
2017-06-05 11:52:39 +03:00
|
|
|
});
|
2020-03-22 12:41:14 +03:00
|
|
|
this.context.peekInRoom(roomId).then((room) => {
|
2018-02-08 13:01:24 +03:00
|
|
|
if (this.unmounted) {
|
|
|
|
return;
|
|
|
|
}
|
2016-02-10 21:27:40 +03:00
|
|
|
this.setState({
|
2016-06-20 18:30:51 +03:00
|
|
|
room: room,
|
2017-06-05 11:52:39 +03:00
|
|
|
peekLoading: false,
|
2016-02-10 21:27:40 +03:00
|
|
|
});
|
2016-06-20 18:30:51 +03:00
|
|
|
this._onRoomLoaded(room);
|
2020-02-26 02:11:07 +03:00
|
|
|
}).catch((err) => {
|
2018-02-08 13:01:24 +03:00
|
|
|
if (this.unmounted) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-10-12 16:24:20 +03:00
|
|
|
// Stop peeking if anything went wrong
|
|
|
|
this.setState({
|
|
|
|
isPeeking: false,
|
|
|
|
});
|
2017-10-25 13:09:48 +03:00
|
|
|
|
2016-06-20 18:30:51 +03: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-26 02:11:07 +03:00
|
|
|
if (err.errcode === "M_GUEST_ACCESS_FORBIDDEN" || err.errcode === 'M_FORBIDDEN') {
|
2016-06-20 18:30:51 +03:00
|
|
|
// This is fine: the room just isn't peekable (we assume).
|
|
|
|
this.setState({
|
2017-06-05 11:52:39 +03:00
|
|
|
peekLoading: false,
|
2016-06-20 18:30:51 +03:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
throw err;
|
|
|
|
}
|
2018-02-08 13:01:24 +03:00
|
|
|
});
|
2018-07-12 16:19:25 +03:00
|
|
|
} else if (room) {
|
|
|
|
// Stop peeking because we have joined this room previously
|
2020-03-22 12:41:14 +03:00
|
|
|
this.context.stopPeeking();
|
2018-07-12 16:19:25 +03:00
|
|
|
this.setState({isPeeking: false});
|
2016-06-20 18:30:51 +03:00
|
|
|
}
|
2016-02-10 21:27:40 +03:00
|
|
|
}
|
2015-11-30 20:15:57 +03:00
|
|
|
},
|
|
|
|
|
2017-06-13 16:19:06 +03:00
|
|
|
_shouldShowApps: function(room) {
|
2017-07-12 12:21:43 +03:00
|
|
|
if (!BROWSER_SUPPORTS_SANDBOX) return false;
|
|
|
|
|
2017-10-26 21:17:13 +03:00
|
|
|
// Check if user has previously chosen to hide the app drawer for this
|
|
|
|
// room. If so, do not show apps
|
2017-11-16 16:19:36 +03:00
|
|
|
const hideWidgetDrawer = localStorage.getItem(
|
2017-10-26 21:17:13 +03:00
|
|
|
room.roomId + "_hide_widget_drawer");
|
2017-10-25 02:21:46 +03:00
|
|
|
|
2020-04-09 23:47:20 +03:00
|
|
|
// This is confusing, but it means to say that we default to the tray being
|
|
|
|
// hidden unless the user clicked to open it.
|
|
|
|
return hideWidgetDrawer === "false";
|
2017-06-13 16:19:06 +03:00
|
|
|
},
|
|
|
|
|
2016-10-17 16:03:37 +03:00
|
|
|
componentDidMount: function() {
|
2017-10-11 19:56:17 +03:00
|
|
|
const call = this._getCallForRoom();
|
|
|
|
const callState = call ? call.call_state : "ended";
|
2016-10-17 16:03:37 +03:00
|
|
|
this.setState({
|
2017-10-11 19:56:17 +03:00
|
|
|
callState: callState,
|
2016-10-17 16:03:37 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
this._updateConfCallNotification();
|
|
|
|
|
2017-04-29 08:25:30 +03:00
|
|
|
window.addEventListener('beforeunload', this.onPageUnload);
|
2019-03-28 19:56:12 +03:00
|
|
|
if (this.props.resizeNotifier) {
|
|
|
|
this.props.resizeNotifier.on("middlePanelResized", this.onResize);
|
|
|
|
}
|
2016-10-17 16:03:37 +03:00
|
|
|
this.onResize();
|
|
|
|
|
2020-04-14 17:24:41 +03:00
|
|
|
document.addEventListener("keydown", this.onNativeKeyDown);
|
2016-10-17 16:03:37 +03:00
|
|
|
},
|
|
|
|
|
2016-03-08 01:27:35 +03:00
|
|
|
shouldComponentUpdate: function(nextProps, nextState) {
|
|
|
|
return (!ObjectUtils.shallowEqual(this.props, nextProps) ||
|
|
|
|
!ObjectUtils.shallowEqual(this.state, nextState));
|
|
|
|
},
|
|
|
|
|
2016-10-17 16:03:37 +03:00
|
|
|
componentDidUpdate: function() {
|
2019-12-08 15:16:17 +03:00
|
|
|
if (this._roomView.current) {
|
2019-12-23 15:24:49 +03:00
|
|
|
const roomView = this._roomView.current;
|
2016-10-17 16:03:37 +03:00
|
|
|
if (!roomView.ondrop) {
|
|
|
|
roomView.addEventListener('drop', this.onDrop);
|
|
|
|
roomView.addEventListener('dragover', this.onDragOver);
|
|
|
|
roomView.addEventListener('dragleave', this.onDragLeaveOrEnd);
|
|
|
|
roomView.addEventListener('dragend', this.onDragLeaveOrEnd);
|
|
|
|
}
|
|
|
|
}
|
2019-03-28 18:50:17 +03: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.
|
2019-12-08 15:16:17 +03:00
|
|
|
if (this._messagePanel && !this.state.atEndOfLiveTimelineInit) {
|
2019-03-26 23:22:48 +03:00
|
|
|
this.setState({
|
|
|
|
atEndOfLiveTimelineInit: true,
|
2019-12-08 15:16:17 +03:00
|
|
|
atEndOfLiveTimeline: this._messagePanel.isAtEndOfLiveTimeline(),
|
2019-03-26 23:22:48 +03:00
|
|
|
});
|
|
|
|
}
|
2016-10-17 16:03:37 +03:00
|
|
|
},
|
|
|
|
|
2015-11-30 20:15:57 +03:00
|
|
|
componentWillUnmount: function() {
|
2016-01-11 14:38:04 +03: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;
|
|
|
|
|
2016-11-04 12:28:35 +03:00
|
|
|
// update the scroll map before we get unmounted
|
2017-09-08 15:39:22 +03:00
|
|
|
if (this.state.roomId) {
|
2020-04-20 04:14:08 +03:00
|
|
|
RoomScrollStateStore.setScrollState(this.state.roomId, this._getScrollState());
|
2017-09-08 15:39:22 +03:00
|
|
|
}
|
2016-11-04 12:28:35 +03:00
|
|
|
|
2020-03-31 14:51:03 +03:00
|
|
|
if (this.state.shouldPeek) {
|
|
|
|
this.context.stopPeeking();
|
|
|
|
}
|
|
|
|
|
2019-02-21 17:44:20 +03:00
|
|
|
// stop tracking room changes to format permalinks
|
2019-04-09 21:01:09 +03:00
|
|
|
this._stopAllPermalinkCreators();
|
2019-02-21 17:44:20 +03:00
|
|
|
|
2019-12-08 15:16:17 +03:00
|
|
|
if (this._roomView.current) {
|
2016-01-15 18:23:02 +03: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 13:19:07 +03:00
|
|
|
// deleted anyway, so it doesn't matter if the event listeners
|
|
|
|
// don't get cleaned up.
|
2019-12-23 15:24:49 +03:00
|
|
|
const roomView = this._roomView.current;
|
2016-01-15 18:23:02 +03:00
|
|
|
roomView.removeEventListener('drop', this.onDrop);
|
|
|
|
roomView.removeEventListener('dragover', this.onDragOver);
|
|
|
|
roomView.removeEventListener('dragleave', this.onDragLeaveOrEnd);
|
|
|
|
roomView.removeEventListener('dragend', this.onDragLeaveOrEnd);
|
2015-11-30 20:15:57 +03:00
|
|
|
}
|
2019-01-17 12:29:37 +03:00
|
|
|
dis.unregister(this.dispatcherRef);
|
2020-03-22 12:41:14 +03: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 14:43:30 +03:00
|
|
|
this.context.removeListener("crossSigning.keysChanged", this.onCrossSigningKeysChanged);
|
2015-11-30 20:15:57 +03:00
|
|
|
}
|
2015-12-13 07:32:48 +03:00
|
|
|
|
2017-04-29 08:25:30 +03:00
|
|
|
window.removeEventListener('beforeunload', this.onPageUnload);
|
2019-03-28 19:56:12 +03:00
|
|
|
if (this.props.resizeNotifier) {
|
|
|
|
this.props.resizeNotifier.removeListener("middlePanelResized", this.onResize);
|
|
|
|
}
|
2016-01-08 06:22:38 +03:00
|
|
|
|
2020-04-14 17:24:41 +03:00
|
|
|
document.removeEventListener("keydown", this.onNativeKeyDown);
|
2016-10-17 16:03:37 +03:00
|
|
|
|
2017-06-01 20:01:30 +03:00
|
|
|
// Remove RoomStore listener
|
|
|
|
if (this._roomStoreToken) {
|
|
|
|
this._roomStoreToken.remove();
|
|
|
|
}
|
2020-03-20 03:18:24 +03:00
|
|
|
// Remove RightPanelStore listener
|
|
|
|
if (this._rightPanelStoreToken) {
|
|
|
|
this._rightPanelStoreToken.remove();
|
|
|
|
}
|
2017-06-01 20:01:30 +03:00
|
|
|
|
2018-07-05 22:00:42 +03:00
|
|
|
WidgetEchoStore.removeListener('update', this._onWidgetEchoStoreUpdate);
|
2018-07-03 13:16:44 +03:00
|
|
|
|
2020-03-20 12:29:59 +03:00
|
|
|
if (this._showReadReceiptsWatchRef) {
|
|
|
|
SettingsStore.unwatchSetting(this._showReadReceiptsWatchRef);
|
|
|
|
this._showReadReceiptsWatchRef = null;
|
|
|
|
}
|
|
|
|
|
2016-08-10 15:39:47 +03:00
|
|
|
// cancel any pending calls to the rate_limited_funcs
|
|
|
|
this._updateRoomMembers.cancelPendingCall();
|
|
|
|
|
2016-04-16 03:00:10 +03:00
|
|
|
// no need to do this as Dir & Settings are now overlays. It just burnt CPU.
|
|
|
|
// console.log("Tinter.tint from RoomView.unmount");
|
|
|
|
// Tinter.tint(); // reset colourscheme
|
2020-05-26 17:56:16 +03:00
|
|
|
|
|
|
|
SettingsStore.unwatchSetting(this._layoutWatcherRef);
|
|
|
|
},
|
|
|
|
|
|
|
|
onLayoutChange: function() {
|
|
|
|
this.setState({
|
2020-06-16 19:55:19 +03:00
|
|
|
useIRCLayout: SettingsStore.getValue("useIRCLayout"),
|
2020-05-26 17:56:16 +03:00
|
|
|
});
|
2015-11-30 20:15:57 +03:00
|
|
|
},
|
|
|
|
|
2020-03-20 03:18:24 +03:00
|
|
|
_onRightPanelStoreUpdate: function() {
|
|
|
|
this.setState({
|
|
|
|
showRightPanel: RightPanelStore.getSharedInstance().isOpenForRoom,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2017-04-29 08:25:30 +03:00
|
|
|
onPageUnload(event) {
|
2019-04-01 18:42:41 +03:00
|
|
|
if (ContentMessages.sharedInstance().getCurrentUploads().length > 0) {
|
2017-04-29 08:25:30 +03:00
|
|
|
return event.returnValue =
|
2017-05-23 17:16:31 +03:00
|
|
|
_t("You seem to be uploading files, are you sure you want to quit?");
|
2017-05-03 18:36:57 +03:00
|
|
|
} else if (this._getCallForRoom() && this.state.callState !== 'ended') {
|
|
|
|
return event.returnValue =
|
2017-05-23 17:16:31 +03:00
|
|
|
_t("You seem to be in a call, are you sure you want to quit?");
|
2017-04-29 08:25:30 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-04-14 17:24:41 +03:00
|
|
|
// we register global shortcuts here, they *must not conflict* with local shortcuts elsewhere or both will fire
|
|
|
|
onNativeKeyDown: function(ev) {
|
2016-11-08 21:04:22 +03:00
|
|
|
let handled = false;
|
2017-12-01 13:44:00 +03:00
|
|
|
const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev);
|
2016-10-17 16:03:37 +03:00
|
|
|
|
2019-12-16 20:14:03 +03:00
|
|
|
switch (ev.key) {
|
|
|
|
case Key.D:
|
2016-11-08 21:04:22 +03:00
|
|
|
if (ctrlCmdOnly) {
|
2016-10-17 16:03:37 +03:00
|
|
|
this.onMuteAudioClick();
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2019-12-16 20:14:03 +03:00
|
|
|
case Key.E:
|
2016-11-08 21:04:22 +03:00
|
|
|
if (ctrlCmdOnly) {
|
2016-10-17 16:03:37 +03:00
|
|
|
this.onMuteVideoClick();
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (handled) {
|
|
|
|
ev.stopPropagation();
|
|
|
|
ev.preventDefault();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-04-14 17:24:41 +03:00
|
|
|
onReactKeyDown: function(ev) {
|
|
|
|
let handled = false;
|
|
|
|
|
|
|
|
switch (ev.key) {
|
2020-03-25 05:35:17 +03:00
|
|
|
case Key.ESCAPE:
|
2020-04-14 17:24:41 +03:00
|
|
|
if (!ev.altKey && !ev.ctrlKey && !ev.shiftKey && !ev.metaKey) {
|
|
|
|
this._messagePanel.forgetReadMarker();
|
|
|
|
this.jumpToLiveTimeline();
|
|
|
|
handled = true;
|
|
|
|
}
|
2020-03-25 05:35:17 +03:00
|
|
|
break;
|
2020-05-13 12:38:32 +03:00
|
|
|
case Key.PAGE_UP:
|
|
|
|
if (!ev.altKey && !ev.ctrlKey && ev.shiftKey && !ev.metaKey) {
|
|
|
|
this.jumpToReadMarker();
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case Key.U.toUpperCase():
|
|
|
|
if (isOnlyCtrlOrCmdIgnoreShiftKeyEvent(ev) && ev.shiftKey) {
|
|
|
|
dis.dispatch({ action: "upload_file" })
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
2016-10-17 16:03:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (handled) {
|
|
|
|
ev.stopPropagation();
|
|
|
|
ev.preventDefault();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-11-30 20:15:57 +03:00
|
|
|
onAction: function(payload) {
|
|
|
|
switch (payload.action) {
|
|
|
|
case 'message_send_failed':
|
|
|
|
case 'message_sent':
|
2017-10-12 06:15:00 +03:00
|
|
|
this._checkIfAlone(this.state.room);
|
2015-11-30 20:15:57 +03:00
|
|
|
break;
|
2018-01-04 21:41:47 +03:00
|
|
|
case 'post_sticker_message':
|
|
|
|
this.injectSticker(
|
|
|
|
payload.data.content.url,
|
|
|
|
payload.data.content.info,
|
|
|
|
payload.data.description || payload.data.name);
|
2018-01-04 12:53:26 +03:00
|
|
|
break;
|
2017-12-03 22:44:59 +03:00
|
|
|
case 'picture_snapshot':
|
2020-03-22 12:41:14 +03:00
|
|
|
ContentMessages.sharedInstance().sendContentListToRoom([payload.file], this.state.room.roomId, this.context);
|
2019-09-10 10:38:51 +03:00
|
|
|
break;
|
2019-02-25 03:44:55 +03:00
|
|
|
case 'notifier_enabled':
|
2015-12-02 21:16:16 +03:00
|
|
|
case 'upload_started':
|
|
|
|
case 'upload_finished':
|
2019-04-08 19:53:39 +03:00
|
|
|
case 'upload_canceled':
|
2015-11-30 20:15:57 +03:00
|
|
|
this.forceUpdate();
|
|
|
|
break;
|
|
|
|
case 'call_state':
|
2015-12-15 02:37:34 +03:00
|
|
|
// don't filter out payloads for room IDs other than props.room because
|
|
|
|
// we may be interested in the conf 1:1 room
|
|
|
|
|
|
|
|
if (!payload.room_id) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-04-12 21:25:07 +03:00
|
|
|
var call = this._getCallForRoom();
|
2015-12-15 02:37:34 +03:00
|
|
|
var callState;
|
|
|
|
|
|
|
|
if (call) {
|
|
|
|
callState = call.call_state;
|
2017-10-11 19:56:17 +03:00
|
|
|
} else {
|
2015-12-15 02:37:34 +03:00
|
|
|
callState = "ended";
|
2015-11-30 20:15:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// possibly remove the conf call notification if we're now in
|
|
|
|
// the conf
|
|
|
|
this._updateConfCallNotification();
|
2015-12-15 02:37:34 +03:00
|
|
|
|
|
|
|
this.setState({
|
2017-05-17 23:15:57 +03:00
|
|
|
callState: callState,
|
2015-12-15 02:37:34 +03:00
|
|
|
});
|
|
|
|
|
2017-05-17 23:15:57 +03:00
|
|
|
break;
|
|
|
|
case 'appsDrawer':
|
|
|
|
this.setState({
|
2017-06-28 14:21:05 +03:00
|
|
|
showApps: payload.show,
|
2017-05-17 23:15:57 +03:00
|
|
|
});
|
2015-11-30 20:15:57 +03:00
|
|
|
break;
|
2019-09-09 11:34:08 +03:00
|
|
|
case 'reply_to_event':
|
|
|
|
if (this.state.searchResults && payload.event.getRoomId() === this.state.roomId && !this.unmounted) {
|
|
|
|
this.onCancelSearchClick();
|
|
|
|
}
|
|
|
|
break;
|
2020-02-29 02:12:10 +03:00
|
|
|
case 'quote':
|
|
|
|
if (this.state.searchResults) {
|
|
|
|
const roomId = payload.event.getRoomId();
|
|
|
|
if (roomId === this.state.roomId) {
|
|
|
|
this.onCancelSearchClick();
|
|
|
|
}
|
|
|
|
|
|
|
|
setImmediate(() => {
|
|
|
|
dis.dispatch({
|
|
|
|
action: 'view_room',
|
|
|
|
room_id: roomId,
|
|
|
|
deferred_action: payload,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
break;
|
2020-05-19 15:17:34 +03: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
|
|
|
|
this._onRoomViewStoreUpdate(true);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
break;
|
2015-11-30 20:15:57 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-01-27 10:54:15 +03:00
|
|
|
onRoomTimeline: function(ev, room, toStartOfTimeline, removed, data) {
|
2016-01-11 14:38:04 +03:00
|
|
|
if (this.unmounted) return;
|
2015-11-30 20:15:57 +03:00
|
|
|
|
2016-01-27 10:54:15 +03:00
|
|
|
// ignore events for other rooms
|
2016-09-09 04:09:12 +03:00
|
|
|
if (!room) return;
|
2016-04-12 21:25:07 +03:00
|
|
|
if (!this.state.room || room.roomId != this.state.room.roomId) return;
|
2016-01-27 10:54:15 +03:00
|
|
|
|
2016-09-09 00:48:44 +03:00
|
|
|
// ignore events from filtered timelines
|
|
|
|
if (data.timeline.getTimelineSet() !== room.getUnfilteredTimelineSet()) return;
|
|
|
|
|
2016-07-18 12:47:03 +03:00
|
|
|
if (ev.getType() === "org.matrix.room.preview_urls") {
|
|
|
|
this._updatePreviewUrlVisibility(room);
|
2016-07-18 03:35:42 +03:00
|
|
|
}
|
|
|
|
|
2019-02-01 21:14:11 +03:00
|
|
|
if (ev.getType() === "m.room.encryption") {
|
|
|
|
this._updateE2EStatus(room);
|
|
|
|
}
|
|
|
|
|
2016-01-27 10:54:15 +03: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 20:15:57 +03: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;
|
|
|
|
|
2020-03-22 12:41:14 +03:00
|
|
|
if (ev.getSender() !== this.context.credentials.userId) {
|
2015-11-30 20:15:57 +03:00
|
|
|
// update unread count when scrolled up
|
2016-02-03 11:03:10 +03:00
|
|
|
if (!this.state.searchResults && this.state.atEndOfLiveTimeline) {
|
2016-01-27 10:54:15 +03:00
|
|
|
// no change
|
2017-10-29 10:43:52 +03:00
|
|
|
} else if (!shouldHideEvent(ev)) {
|
2016-04-18 03:34:45 +03:00
|
|
|
this.setState((state, props) => {
|
2016-01-27 10:54:15 +03:00
|
|
|
return {numUnreadMessages: state.numUnreadMessages + 1};
|
|
|
|
});
|
2015-11-30 20:15:57 +03:00
|
|
|
}
|
|
|
|
}
|
2016-01-18 23:05:33 +03:00
|
|
|
},
|
2016-01-18 22:56:35 +03:00
|
|
|
|
2017-02-17 14:44:56 +03:00
|
|
|
onRoomName: function(room) {
|
|
|
|
if (this.state.room && room.roomId == this.state.room.roomId) {
|
|
|
|
this.forceUpdate();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-01-09 19:27:41 +03:00
|
|
|
onRoomRecoveryReminderDontAskAgain: function() {
|
|
|
|
// Called when the option to not ask again is set:
|
|
|
|
// force an update to hide the recovery reminder
|
|
|
|
this.forceUpdate();
|
2019-01-03 00:32:14 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
onKeyBackupStatus() {
|
|
|
|
// Key backup status changes affect whether the in-room recovery
|
|
|
|
// reminder is displayed.
|
2018-12-07 00:39:59 +03:00
|
|
|
this.forceUpdate();
|
|
|
|
},
|
|
|
|
|
2017-03-22 18:06:52 +03:00
|
|
|
canResetTimeline: function() {
|
2019-12-08 15:16:17 +03:00
|
|
|
if (!this._messagePanel) {
|
2017-03-22 18:06:52 +03:00
|
|
|
return true;
|
|
|
|
}
|
2019-12-08 15:16:17 +03:00
|
|
|
return this._messagePanel.canResetTimeline();
|
2017-03-22 18:06:52 +03:00
|
|
|
},
|
|
|
|
|
2016-02-10 21:27:40 +03:00
|
|
|
// called when state.room is first initialised (either at initial load,
|
|
|
|
// after a successful peek, or after we join the room).
|
|
|
|
_onRoomLoaded: function(room) {
|
|
|
|
this._calculatePeekRules(room);
|
2016-07-20 14:03:13 +03:00
|
|
|
this._updatePreviewUrlVisibility(room);
|
2018-09-17 20:24:34 +03:00
|
|
|
this._loadMembersIfJoined(room);
|
2019-01-29 03:21:33 +03:00
|
|
|
this._calculateRecommendedVersion(room);
|
2019-02-01 16:35:03 +03:00
|
|
|
this._updateE2EStatus(room);
|
2019-07-31 02:46:21 +03:00
|
|
|
this._updatePermissions(room);
|
2019-01-29 03:21:33 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
_calculateRecommendedVersion: async function(room) {
|
|
|
|
this.setState({
|
|
|
|
upgradeRecommendation: await room.getRecommendedVersion(),
|
|
|
|
});
|
2018-09-13 19:43:24 +03:00
|
|
|
},
|
|
|
|
|
2018-09-17 20:24:34 +03:00
|
|
|
_loadMembersIfJoined: async function(room) {
|
2018-09-13 19:43:24 +03:00
|
|
|
// lazy load members if enabled
|
2020-03-22 12:41:14 +03:00
|
|
|
if (this.context.hasLazyLoadMembersEnabled()) {
|
2018-09-13 19:43:24 +03:00
|
|
|
if (room && room.getMyMembership() === 'join') {
|
2018-09-14 19:35:16 +03:00
|
|
|
try {
|
|
|
|
await room.loadMembersIfNeeded();
|
|
|
|
if (!this.unmounted) {
|
2018-09-17 20:27:25 +03:00
|
|
|
this.setState({membersLoaded: true});
|
2018-09-14 19:35:16 +03:00
|
|
|
}
|
2018-09-17 21:01:55 +03:00
|
|
|
} catch (err) {
|
2018-09-13 19:43:24 +03:00
|
|
|
const errorMessage = `Fetching room members for ${room.roomId} failed.` +
|
|
|
|
" Room members will appear incomplete.";
|
|
|
|
console.error(errorMessage);
|
|
|
|
console.error(err);
|
2018-09-14 19:35:16 +03:00
|
|
|
}
|
2018-09-13 19:43:24 +03:00
|
|
|
}
|
2017-03-01 18:41:13 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-01-18 23:05:33 +03:00
|
|
|
_calculatePeekRules: function(room) {
|
2017-10-11 19:56:17 +03:00
|
|
|
const guestAccessEvent = room.currentState.getStateEvents("m.room.guest_access", "");
|
2016-01-18 23:05:33 +03:00
|
|
|
if (guestAccessEvent && guestAccessEvent.getContent().guest_access === "can_join") {
|
|
|
|
this.setState({
|
2017-10-11 19:56:17 +03:00
|
|
|
guestsCanJoin: true,
|
2016-01-18 23:05:33 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const historyVisibility = room.currentState.getStateEvents("m.room.history_visibility", "");
|
2016-01-18 23:05:33 +03:00
|
|
|
if (historyVisibility && historyVisibility.getContent().history_visibility === "world_readable") {
|
|
|
|
this.setState({
|
2017-10-11 19:56:17 +03:00
|
|
|
canPeek: true,
|
2016-01-18 23:05:33 +03:00
|
|
|
});
|
2016-01-18 20:39:23 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-06-21 03:16:01 +03:00
|
|
|
_updatePreviewUrlVisibility: function({roomId}) {
|
2018-06-22 20:44:54 +03:00
|
|
|
// URL Previews in E2EE rooms can be a privacy leak so use a different setting which is per-room explicit
|
2020-03-22 12:41:14 +03:00
|
|
|
const key = this.context.isRoomEncrypted(roomId) ? 'urlPreviewsEnabled_e2ee' : 'urlPreviewsEnabled';
|
2016-07-18 03:35:42 +03:00
|
|
|
this.setState({
|
2018-06-22 20:44:54 +03:00
|
|
|
showUrlPreview: SettingsStore.getValue(key, roomId),
|
2016-07-18 03:35:42 +03:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-02-04 14:29:00 +03:00
|
|
|
onRoom: function(room) {
|
2017-05-24 18:56:13 +03:00
|
|
|
if (!room || room.roomId !== this.state.roomId) {
|
|
|
|
return;
|
2016-02-04 14:29:00 +03:00
|
|
|
}
|
2017-05-24 18:56:13 +03:00
|
|
|
this.setState({
|
|
|
|
room: room,
|
|
|
|
}, () => {
|
|
|
|
this._onRoomLoaded(room);
|
|
|
|
});
|
2016-02-04 14:29:00 +03:00
|
|
|
},
|
|
|
|
|
2019-02-01 16:35:03 +03:00
|
|
|
onDeviceVerificationChanged: function(userId, device) {
|
|
|
|
const room = this.state.room;
|
|
|
|
if (!room.currentState.getMember(userId)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this._updateE2EStatus(room);
|
|
|
|
},
|
|
|
|
|
2020-01-15 16:57:29 +03:00
|
|
|
onUserVerificationChanged: function(userId, _trustStatus) {
|
|
|
|
const room = this.state.room;
|
2020-01-24 22:11:57 +03:00
|
|
|
if (!room || !room.currentState.getMember(userId)) {
|
2020-01-15 16:57:29 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
this._updateE2EStatus(room);
|
|
|
|
},
|
|
|
|
|
2020-04-09 14:43:30 +03:00
|
|
|
onCrossSigningKeysChanged: function() {
|
|
|
|
const room = this.state.room;
|
|
|
|
if (room) {
|
|
|
|
this._updateE2EStatus(room);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-12-13 20:57:26 +03:00
|
|
|
_updateE2EStatus: async function(room) {
|
2020-03-22 12:41:14 +03:00
|
|
|
if (!this.context.isRoomEncrypted(room.roomId)) {
|
2019-02-01 19:52:27 +03:00
|
|
|
return;
|
|
|
|
}
|
2020-03-22 12:41:14 +03:00
|
|
|
if (!this.context.isCryptoEnabled()) {
|
2019-04-08 18:26:54 +03:00
|
|
|
// 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.
|
|
|
|
this.setState({
|
|
|
|
e2eStatus: "warning",
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
2020-01-15 16:57:29 +03:00
|
|
|
|
2020-01-16 19:31:50 +03:00
|
|
|
/* At this point, the user has encryption on and cross-signing on */
|
2019-12-13 20:57:26 +03:00
|
|
|
this.setState({
|
2020-03-30 12:18:47 +03:00
|
|
|
e2eStatus: await shieldStatusForRoom(this.context, room),
|
2019-02-01 16:35:03 +03:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-01-08 06:22:38 +03:00
|
|
|
updateTint: function() {
|
2017-10-11 19:56:17 +03:00
|
|
|
const room = this.state.room;
|
2016-01-08 06:22:38 +03:00
|
|
|
if (!room) return;
|
|
|
|
|
2016-04-16 03:00:10 +03:00
|
|
|
console.log("Tinter.tint from updateTint");
|
2018-10-23 07:15:28 +03:00
|
|
|
const colorScheme = SettingsStore.getValue("roomColor", room.roomId);
|
|
|
|
Tinter.tint(colorScheme.primary_color, colorScheme.secondary_color);
|
2016-01-08 06:22:38 +03:00
|
|
|
},
|
|
|
|
|
2016-07-20 20:14:16 +03:00
|
|
|
onAccountData: function(event) {
|
2018-06-22 21:17:55 +03: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`
|
2016-07-20 20:14:16 +03:00
|
|
|
this._updatePreviewUrlVisibility(this.state.room);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-07-20 14:03:13 +03:00
|
|
|
onRoomAccountData: function(event, room) {
|
|
|
|
if (room.roomId == this.state.roomId) {
|
2018-06-22 21:17:55 +03:00
|
|
|
const type = event.getType();
|
|
|
|
if (type === "org.matrix.room.color_scheme") {
|
2018-10-23 07:15:28 +03:00
|
|
|
const colorScheme = event.getContent();
|
2016-01-08 06:22:38 +03:00
|
|
|
// XXX: we should validate the event
|
2016-04-16 03:00:10 +03:00
|
|
|
console.log("Tinter.tint from onRoomAccountData");
|
2018-10-23 07:15:28 +03:00
|
|
|
Tinter.tint(colorScheme.primary_color, colorScheme.secondary_color);
|
2018-06-22 21:17:55 +03:00
|
|
|
} else if (type === "org.matrix.room.preview_urls" || type === "im.vector.web.settings") {
|
|
|
|
// non-e2ee url previews are stored in legacy event type `org.matrix.room.preview_urls`
|
2016-07-20 14:03:13 +03:00
|
|
|
this._updatePreviewUrlVisibility(room);
|
2016-07-18 03:35:42 +03:00
|
|
|
}
|
2016-01-08 06:22:38 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-07-31 02:46:21 +03:00
|
|
|
onRoomStateEvents: function(ev, state) {
|
|
|
|
// ignore if we don't have a room yet
|
|
|
|
if (!this.state.room || this.state.room.roomId !== state.roomId) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this._updatePermissions(this.state.room);
|
|
|
|
},
|
|
|
|
|
2016-07-26 20:15:26 +03:00
|
|
|
onRoomStateMember: function(ev, state, member) {
|
2016-04-12 21:25:07 +03:00
|
|
|
// ignore if we don't have a room yet
|
|
|
|
if (!this.state.room) {
|
|
|
|
return;
|
2015-12-22 18:38:23 +03:00
|
|
|
}
|
|
|
|
|
2016-04-12 21:25:07 +03:00
|
|
|
// ignore members in other rooms
|
|
|
|
if (member.roomId !== this.state.room.roomId) {
|
2015-11-30 20:15:57 +03:00
|
|
|
return;
|
|
|
|
}
|
2016-04-12 21:25:07 +03:00
|
|
|
|
2019-03-13 23:06:34 +03:00
|
|
|
this._updateRoomMembers(member);
|
2016-07-26 20:15:26 +03:00
|
|
|
},
|
|
|
|
|
2018-09-17 20:14:52 +03:00
|
|
|
onMyMembership: function(room, membership, oldMembership) {
|
|
|
|
if (room.roomId === this.state.roomId) {
|
2017-09-15 17:07:09 +03:00
|
|
|
this.forceUpdate();
|
2018-09-17 20:14:52 +03:00
|
|
|
this._loadMembersIfJoined(room);
|
2019-07-31 02:46:21 +03:00
|
|
|
this._updatePermissions(room);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
_updatePermissions: function(room) {
|
|
|
|
if (room) {
|
2020-03-22 12:41:14 +03:00
|
|
|
const me = this.context.getUserId();
|
2019-07-31 02:46:21 +03:00
|
|
|
const canReact = room.getMyMembership() === "join" && room.currentState.maySendEvent("m.reaction", me);
|
|
|
|
const canReply = room.maySendMessage();
|
|
|
|
|
|
|
|
this.setState({canReact, canReply});
|
2017-02-17 18:50:30 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-07-26 20:19:25 +03:00
|
|
|
// rate limited because a power level change will emit an event for every
|
|
|
|
// member in the room.
|
2019-12-13 05:33:08 +03:00
|
|
|
_updateRoomMembers: rate_limited_func(function(dueToMember) {
|
2016-10-26 15:09:53 +03:00
|
|
|
// a member state changed in this room
|
2016-10-26 17:32:09 +03:00
|
|
|
// refresh the conf call notification state
|
2016-10-26 15:09:53 +03:00
|
|
|
this._updateConfCallNotification();
|
2018-02-20 17:10:34 +03:00
|
|
|
this._updateDMState();
|
2019-03-13 23:06:34 +03:00
|
|
|
|
|
|
|
let memberCountInfluence = 0;
|
|
|
|
if (dueToMember && dueToMember.membership === "invite" && this.state.room.getInvitedMemberCount() === 0) {
|
|
|
|
// A member got invited, but the room hasn't detected that change yet. Influence the member
|
|
|
|
// count by 1 to counteract this.
|
|
|
|
memberCountInfluence = 1;
|
|
|
|
}
|
|
|
|
this._checkIfAlone(this.state.room, memberCountInfluence);
|
|
|
|
|
2019-02-12 20:34:22 +03:00
|
|
|
this._updateE2EStatus(this.state.room);
|
2016-07-26 19:58:19 +03:00
|
|
|
}, 500),
|
2015-11-30 20:15:57 +03:00
|
|
|
|
2019-03-13 23:06:34 +03:00
|
|
|
_checkIfAlone: function(room, countInfluence) {
|
2017-10-12 06:15:00 +03:00
|
|
|
let warnedAboutLonelyRoom = false;
|
|
|
|
if (localStorage) {
|
|
|
|
warnedAboutLonelyRoom = localStorage.getItem('mx_user_alone_warned_' + this.state.room.roomId);
|
|
|
|
}
|
|
|
|
if (warnedAboutLonelyRoom) {
|
|
|
|
if (this.state.isAlone) this.setState({isAlone: false});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-03-13 23:06:34 +03:00
|
|
|
let joinedOrInvitedMemberCount = room.getJoinedMemberCount() + room.getInvitedMemberCount();
|
|
|
|
if (countInfluence) joinedOrInvitedMemberCount += countInfluence;
|
2018-08-22 19:05:36 +03:00
|
|
|
this.setState({isAlone: joinedOrInvitedMemberCount === 1});
|
2017-10-12 06:15:00 +03:00
|
|
|
},
|
|
|
|
|
2015-11-30 20:15:57 +03:00
|
|
|
_updateConfCallNotification: function() {
|
2017-10-11 19:56:17 +03:00
|
|
|
const room = this.state.room;
|
2015-11-30 20:15:57 +03:00
|
|
|
if (!room || !this.props.ConferenceHandler) {
|
|
|
|
return;
|
|
|
|
}
|
2017-10-11 19:56:17 +03:00
|
|
|
const confMember = room.getMember(
|
|
|
|
this.props.ConferenceHandler.getConferenceUserIdForRoom(room.roomId),
|
2015-11-30 20:15:57 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
if (!confMember) {
|
|
|
|
return;
|
|
|
|
}
|
2017-10-11 19:56:17 +03:00
|
|
|
const confCall = this.props.ConferenceHandler.getConferenceCallForRoom(confMember.roomId);
|
2015-11-30 20:15:57 +03:00
|
|
|
|
|
|
|
// A conf call notification should be displayed if there is an ongoing
|
|
|
|
// conf call but this cilent isn't a part of it.
|
|
|
|
this.setState({
|
|
|
|
displayConfCallNotification: (
|
|
|
|
(!confCall || confCall.call_state === "ended") &&
|
|
|
|
confMember.membership === "join"
|
2017-10-11 19:56:17 +03:00
|
|
|
),
|
2015-11-30 20:15:57 +03:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2018-02-20 17:10:34 +03:00
|
|
|
_updateDMState() {
|
2018-08-02 12:42:05 +03:00
|
|
|
const room = this.state.room;
|
|
|
|
if (room.getMyMembership() != "join") {
|
2018-02-20 17:10:34 +03:00
|
|
|
return;
|
|
|
|
}
|
2018-08-02 12:42:19 +03:00
|
|
|
const dmInviter = room.getDMInviter();
|
2018-07-12 20:39:52 +03:00
|
|
|
if (dmInviter) {
|
2018-08-02 12:42:19 +03:00
|
|
|
Rooms.setDMRoom(room.roomId, dmInviter);
|
2018-02-20 17:10:34 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-12-22 18:18:50 +03:00
|
|
|
onSearchResultsFillRequest: function(backwards) {
|
2017-01-20 17:22:27 +03:00
|
|
|
if (!backwards) {
|
2017-07-12 16:02:00 +03:00
|
|
|
return Promise.resolve(false);
|
2017-01-20 17:22:27 +03:00
|
|
|
}
|
2015-11-30 20:15:57 +03:00
|
|
|
|
2015-12-22 21:15:32 +03:00
|
|
|
if (this.state.searchResults.next_batch) {
|
2016-01-04 19:28:32 +03:00
|
|
|
debuglog("requesting more search results");
|
2020-05-29 12:44:08 +03:00
|
|
|
const searchPromise = searchPagination(this.state.searchResults);
|
2016-01-05 18:51:16 +03:00
|
|
|
return this._handleSearchResult(searchPromise);
|
2015-12-22 18:18:50 +03:00
|
|
|
} else {
|
2016-01-04 19:28:32 +03:00
|
|
|
debuglog("no more search results");
|
2017-07-12 16:02:00 +03:00
|
|
|
return Promise.resolve(false);
|
2015-12-22 18:18:50 +03:00
|
|
|
}
|
|
|
|
},
|
2015-11-30 20:15:57 +03:00
|
|
|
|
2017-10-12 06:15:00 +03:00
|
|
|
onInviteButtonClick: function() {
|
|
|
|
// call AddressPickerDialog
|
2019-01-17 12:29:37 +03:00
|
|
|
dis.dispatch({
|
2017-10-12 06:15:00 +03:00
|
|
|
action: 'view_invite',
|
|
|
|
roomId: this.state.room.roomId,
|
|
|
|
});
|
|
|
|
this.setState({isAlone: false}); // there's a good chance they'll invite someone
|
|
|
|
},
|
|
|
|
|
|
|
|
onStopAloneWarningClick: function() {
|
|
|
|
if (localStorage) {
|
|
|
|
localStorage.setItem('mx_user_alone_warned_' + this.state.room.roomId, true);
|
|
|
|
}
|
|
|
|
this.setState({isAlone: false});
|
|
|
|
},
|
|
|
|
|
2015-11-30 20:15:57 +03:00
|
|
|
onJoinButtonClicked: function(ev) {
|
2017-04-28 15:22:55 +03:00
|
|
|
// If the user is a ROU, allow them to transition to a PWLU
|
2020-03-22 12:41:14 +03:00
|
|
|
if (this.context && this.context.isGuest()) {
|
2017-05-24 18:56:13 +03:00
|
|
|
// Join this room once the user has registered and logged in
|
2019-02-11 17:33:19 +03:00
|
|
|
// (If we failed to peek, we may not have a valid room object.)
|
2019-01-17 12:29:37 +03:00
|
|
|
dis.dispatch({
|
2017-05-24 18:56:13 +03:00
|
|
|
action: 'do_after_sync_prepared',
|
|
|
|
deferred_action: {
|
2019-01-30 17:45:42 +03:00
|
|
|
action: 'view_room',
|
2019-02-12 11:59:38 +03:00
|
|
|
room_id: this._getRoomId(),
|
2017-05-24 18:56:13 +03:00
|
|
|
},
|
|
|
|
});
|
2016-02-04 14:49:10 +03:00
|
|
|
|
2017-05-25 19:04:42 +03:00
|
|
|
// Don't peek whilst registering otherwise getPendingEventList complains
|
|
|
|
// Do this by indicating our intention to join
|
|
|
|
|
2019-01-30 15:13:09 +03:00
|
|
|
// XXX: ILAG is disabled for now,
|
2020-08-03 18:02:26 +03:00
|
|
|
// see https://github.com/vector-im/element-web/issues/8222
|
2019-01-30 15:13:09 +03:00
|
|
|
dis.dispatch({action: 'require_registration'});
|
|
|
|
// dis.dispatch({
|
|
|
|
// action: 'will_join',
|
|
|
|
// });
|
|
|
|
|
|
|
|
// const SetMxIdDialog = sdk.getComponent('views.dialogs.SetMxIdDialog');
|
|
|
|
// const close = Modal.createTrackedDialog('Set MXID', '', SetMxIdDialog, {
|
|
|
|
// homeserverUrl: cli.getHomeserverUrl(),
|
|
|
|
// onFinished: (submitted, credentials) => {
|
|
|
|
// if (submitted) {
|
|
|
|
// this.props.onRegistered(credentials);
|
|
|
|
// } else {
|
|
|
|
// dis.dispatch({
|
|
|
|
// action: 'cancel_after_sync_prepared',
|
|
|
|
// });
|
|
|
|
// dis.dispatch({
|
|
|
|
// action: 'cancel_join',
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// onDifferentServerClicked: (ev) => {
|
|
|
|
// dis.dispatch({action: 'start_registration'});
|
|
|
|
// close();
|
|
|
|
// },
|
|
|
|
// onLoginClick: (ev) => {
|
|
|
|
// dis.dispatch({action: 'start_login'});
|
|
|
|
// close();
|
|
|
|
// },
|
|
|
|
// }).close;
|
|
|
|
// return;
|
2019-01-30 17:45:42 +03:00
|
|
|
} else {
|
|
|
|
Promise.resolve().then(() => {
|
|
|
|
const signUrl = this.props.thirdPartyInvite ?
|
|
|
|
this.props.thirdPartyInvite.inviteSignUrl : undefined;
|
|
|
|
dis.dispatch({
|
|
|
|
action: 'join_room',
|
|
|
|
opts: { inviteSignUrl: signUrl, viaServers: this.props.viaServers },
|
|
|
|
});
|
|
|
|
return Promise.resolve();
|
|
|
|
});
|
2016-02-04 14:49:10 +03:00
|
|
|
}
|
|
|
|
|
2015-11-30 20:15:57 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
onMessageListScroll: function(ev) {
|
2019-12-08 15:16:17 +03:00
|
|
|
if (this._messagePanel.isAtEndOfLiveTimeline()) {
|
2016-02-10 21:27:40 +03:00
|
|
|
this.setState({
|
|
|
|
numUnreadMessages: 0,
|
|
|
|
atEndOfLiveTimeline: true,
|
|
|
|
});
|
2017-10-11 19:56:17 +03:00
|
|
|
} else {
|
2016-02-10 21:27:40 +03:00
|
|
|
this.setState({
|
|
|
|
atEndOfLiveTimeline: false,
|
|
|
|
});
|
2015-12-18 02:04:32 +03:00
|
|
|
}
|
2016-02-24 20:26:34 +03:00
|
|
|
this._updateTopUnreadMessagesBar();
|
2015-11-30 20:15:57 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
onDragOver: function(ev) {
|
|
|
|
ev.stopPropagation();
|
|
|
|
ev.preventDefault();
|
|
|
|
|
|
|
|
ev.dataTransfer.dropEffect = 'none';
|
|
|
|
|
2017-12-18 15:51:01 +03:00
|
|
|
const items = [...ev.dataTransfer.items];
|
2017-12-18 13:20:18 +03:00
|
|
|
if (items.length >= 1) {
|
2017-12-18 15:51:01 +03:00
|
|
|
const isDraggingFiles = items.every(function(item) {
|
2017-12-18 13:20:18 +03:00
|
|
|
return item.kind == 'file';
|
|
|
|
});
|
|
|
|
|
|
|
|
if (isDraggingFiles) {
|
2017-10-11 19:56:17 +03:00
|
|
|
this.setState({ draggingFile: true });
|
2015-11-30 20:15:57 +03:00
|
|
|
ev.dataTransfer.dropEffect = 'copy';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
onDrop: function(ev) {
|
|
|
|
ev.stopPropagation();
|
|
|
|
ev.preventDefault();
|
2019-04-01 18:42:41 +03:00
|
|
|
ContentMessages.sharedInstance().sendContentListToRoom(
|
2020-03-22 12:41:14 +03:00
|
|
|
ev.dataTransfer.files, this.state.room.roomId, this.context,
|
2019-04-01 18:42:41 +03:00
|
|
|
);
|
2017-10-11 19:56:17 +03:00
|
|
|
this.setState({ draggingFile: false });
|
2020-06-03 04:07:46 +03:00
|
|
|
dis.fire(Action.FocusComposer);
|
2015-11-30 20:15:57 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
onDragLeaveOrEnd: function(ev) {
|
|
|
|
ev.stopPropagation();
|
|
|
|
ev.preventDefault();
|
2017-10-11 19:56:17 +03:00
|
|
|
this.setState({ draggingFile: false });
|
2015-11-30 20:15:57 +03:00
|
|
|
},
|
|
|
|
|
2018-01-04 12:53:26 +03:00
|
|
|
injectSticker: function(url, info, text) {
|
2020-03-22 12:41:14 +03:00
|
|
|
if (this.context.isGuest()) {
|
2019-01-17 12:29:37 +03:00
|
|
|
dis.dispatch({action: 'require_registration'});
|
2018-01-04 12:53:26 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-03-22 12:41:14 +03:00
|
|
|
ContentMessages.sharedInstance().sendStickerContentToRoom(url, this.state.room.roomId, info, text, this.context)
|
2019-11-18 13:03:05 +03:00
|
|
|
.then(undefined, (error) => {
|
2018-03-29 18:46:22 +03:00
|
|
|
if (error.name === "UnknownDeviceError") {
|
|
|
|
// Let the staus bar handle this
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
});
|
2018-01-04 12:53:26 +03:00
|
|
|
},
|
|
|
|
|
2015-11-30 20:15:57 +03:00
|
|
|
onSearch: function(term, scope) {
|
2015-12-18 14:11:41 +03:00
|
|
|
this.setState({
|
|
|
|
searchTerm: term,
|
|
|
|
searchScope: scope,
|
2015-12-22 21:15:32 +03:00
|
|
|
searchResults: {},
|
2015-12-18 14:11:41 +03:00
|
|
|
searchHighlights: [],
|
|
|
|
});
|
2015-11-30 20:15:57 +03:00
|
|
|
|
2015-12-22 18:18:50 +03:00
|
|
|
// if we already have a search panel, we need to tell it to forget
|
|
|
|
// about its scroll state.
|
2019-12-08 15:16:17 +03:00
|
|
|
if (this._searchResultsPanel.current) {
|
|
|
|
this._searchResultsPanel.current.resetScrollState();
|
2015-12-22 18:18:50 +03:00
|
|
|
}
|
|
|
|
|
2015-12-22 21:15:32 +03: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 17:39:26 +03:00
|
|
|
let roomId;
|
2019-11-13 18:21:26 +03:00
|
|
|
if (scope === "Room") roomId = this.state.room.roomId;
|
2015-12-22 21:15:32 +03:00
|
|
|
|
2016-01-05 18:51:16 +03:00
|
|
|
debuglog("sending search request");
|
2019-11-12 17:39:26 +03:00
|
|
|
const searchPromise = eventSearch(term, roomId);
|
2019-11-18 13:03:05 +03:00
|
|
|
this._handleSearchResult(searchPromise);
|
2015-12-18 14:11:41 +03:00
|
|
|
},
|
|
|
|
|
2015-12-22 21:15:32 +03:00
|
|
|
_handleSearchResult: function(searchPromise) {
|
2017-10-11 19:56:17 +03:00
|
|
|
const self = this;
|
2016-01-04 19:54:27 +03: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 19:56:17 +03:00
|
|
|
const localSearchId = this.searchId;
|
2015-12-11 06:22:44 +03:00
|
|
|
|
2015-12-22 21:15:32 +03:00
|
|
|
this.setState({
|
|
|
|
searchInProgress: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
return searchPromise.then(function(results) {
|
2016-01-04 19:28:32 +03:00
|
|
|
debuglog("search complete");
|
2016-01-11 14:38:04 +03:00
|
|
|
if (self.unmounted || !self.state.searching || self.searchId != localSearchId) {
|
2015-12-11 06:22:44 +03:00
|
|
|
console.error("Discarding stale search results");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-01-05 18:28:32 +03: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 19:56:17 +03:00
|
|
|
let highlights = results.highlights;
|
2016-01-05 18:28:32 +03:00
|
|
|
if (highlights.indexOf(self.state.searchTerm) < 0) {
|
|
|
|
highlights = highlights.concat(self.state.searchTerm);
|
|
|
|
}
|
2015-12-18 14:11:41 +03:00
|
|
|
|
2015-12-22 21:15:32 +03:00
|
|
|
// For overlapping highlights,
|
2015-12-18 14:11:41 +03:00
|
|
|
// favour longer (more specific) terms first
|
2016-01-08 16:25:03 +03:00
|
|
|
highlights = highlights.sort(function(a, b) {
|
2017-10-11 19:56:17 +03:00
|
|
|
return b.length - a.length;
|
2019-02-04 23:25:26 +03:00
|
|
|
});
|
2015-11-30 20:15:57 +03:00
|
|
|
|
|
|
|
self.setState({
|
2015-12-18 14:11:41 +03:00
|
|
|
searchHighlights: highlights,
|
2015-12-22 21:15:32 +03:00
|
|
|
searchResults: results,
|
2015-11-30 20:15:57 +03:00
|
|
|
});
|
|
|
|
}, function(error) {
|
2017-10-11 19:56:17 +03:00
|
|
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
2020-04-09 18:04:14 +03:00
|
|
|
console.error("Search failed", error);
|
2017-08-10 17:17:52 +03:00
|
|
|
Modal.createTrackedDialog('Search failed', '', ErrorDialog, {
|
2017-05-23 17:16:31 +03:00
|
|
|
title: _t("Search failed"),
|
|
|
|
description: ((error && error.message) ? error.message : _t("Server may be unavailable, overloaded, or search timed out :(")),
|
2015-11-30 20:15:57 +03:00
|
|
|
});
|
2015-12-11 05:25:33 +03:00
|
|
|
}).finally(function() {
|
|
|
|
self.setState({
|
2017-10-11 19:56:17 +03:00
|
|
|
searchInProgress: false,
|
2015-12-11 05:25:33 +03:00
|
|
|
});
|
2015-12-22 21:15:32 +03:00
|
|
|
});
|
2015-12-18 14:11:41 +03:00
|
|
|
},
|
|
|
|
|
2015-12-22 18:18:50 +03:00
|
|
|
getSearchResultTiles: function() {
|
2017-10-11 19:56:17 +03:00
|
|
|
const SearchResultTile = sdk.getComponent('rooms.SearchResultTile');
|
|
|
|
const Spinner = sdk.getComponent("elements.Spinner");
|
2016-03-21 02:51:43 +03:00
|
|
|
|
2015-12-22 18:18:50 +03:00
|
|
|
// XXX: todo: merge overlapping results somehow?
|
|
|
|
// XXX: why doesn't searching on name work?
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const ret = [];
|
2015-12-22 21:15:32 +03:00
|
|
|
|
2016-03-21 02:51:43 +03:00
|
|
|
if (this.state.searchInProgress) {
|
|
|
|
ret.push(<li key="search-spinner">
|
2020-03-22 12:41:14 +03:00
|
|
|
<Spinner />
|
|
|
|
</li>);
|
2016-03-21 02:51:43 +03:00
|
|
|
}
|
|
|
|
|
2015-12-22 21:15:32 +03:00
|
|
|
if (!this.state.searchResults.next_batch) {
|
|
|
|
if (this.state.searchResults.results.length == 0) {
|
2015-12-22 18:18:50 +03:00
|
|
|
ret.push(<li key="search-top-marker">
|
2020-03-22 12:41:14 +03:00
|
|
|
<h2 className="mx_RoomView_topMarker">{ _t("No results") }</h2>
|
|
|
|
</li>,
|
|
|
|
);
|
2015-12-22 18:18:50 +03:00
|
|
|
} else {
|
|
|
|
ret.push(<li key="search-top-marker">
|
2020-03-22 12:41:14 +03:00
|
|
|
<h2 className="mx_RoomView_topMarker">{ _t("No more results") }</h2>
|
|
|
|
</li>,
|
|
|
|
);
|
2015-12-21 15:39:10 +03:00
|
|
|
}
|
2015-12-22 18:18:50 +03:00
|
|
|
}
|
2015-12-21 15:39:10 +03:00
|
|
|
|
2016-04-02 02:36:19 +03:00
|
|
|
// once dynamic content in the search results load, make the scrollPanel check
|
2016-02-22 20:19:04 +03:00
|
|
|
// the scroll offsets.
|
2019-03-06 14:27:16 +03:00
|
|
|
const onHeightChanged = () => {
|
2019-12-08 15:16:17 +03:00
|
|
|
const scrollPanel = this._searchResultsPanel.current;
|
2016-02-22 20:19:04 +03:00
|
|
|
if (scrollPanel) {
|
|
|
|
scrollPanel.checkScroll();
|
|
|
|
}
|
2017-01-20 17:22:27 +03:00
|
|
|
};
|
2016-02-22 20:19:04 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
let lastRoomId;
|
2015-12-10 16:58:06 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
for (let i = this.state.searchResults.results.length - 1; i >= 0; i--) {
|
|
|
|
const result = this.state.searchResults.results[i];
|
2015-12-22 21:15:32 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const mxEv = result.context.getEvent();
|
|
|
|
const roomId = mxEv.getRoomId();
|
2020-03-22 12:41:14 +03:00
|
|
|
const room = this.context.getRoom(roomId);
|
2020-06-19 00:45:42 +03: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-19 00:49:39 +03:00
|
|
|
// It will make the result count not match the displayed count.
|
2020-06-19 00:45:42 +03:00
|
|
|
console.log("Hiding search result from an unknown room", roomId);
|
|
|
|
continue;
|
|
|
|
}
|
2015-12-18 19:42:46 +03:00
|
|
|
|
2019-12-21 00:43:06 +03:00
|
|
|
if (!haveTileForEvent(mxEv)) {
|
2015-12-22 18:18:50 +03:00
|
|
|
// XXX: can this ever happen? It will make the result count
|
|
|
|
// not match the displayed count.
|
|
|
|
continue;
|
|
|
|
}
|
2015-12-18 19:42:46 +03:00
|
|
|
|
2015-12-22 18:18:50 +03:00
|
|
|
if (this.state.searchScope === 'All') {
|
2020-06-19 00:45:42 +03:00
|
|
|
if (roomId !== lastRoomId) {
|
2016-01-06 19:46:29 +03:00
|
|
|
ret.push(<li key={mxEv.getId() + "-room"}>
|
2020-06-19 00:49:39 +03:00
|
|
|
<h2>{ _t("Room") }: { room.name }</h2>
|
2016-01-06 19:46:29 +03:00
|
|
|
</li>);
|
2015-12-22 18:18:50 +03:00
|
|
|
lastRoomId = roomId;
|
2015-11-30 20:15:57 +03:00
|
|
|
}
|
2015-12-22 18:18:50 +03:00
|
|
|
}
|
2015-11-30 20:15:57 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const resultLink = "#/room/"+roomId+"/"+mxEv.getId();
|
2016-02-17 22:50:04 +03:00
|
|
|
|
2015-12-23 13:10:08 +03:00
|
|
|
ret.push(<SearchResultTile key={mxEv.getId()}
|
|
|
|
searchResult={result}
|
2016-01-29 14:19:27 +03:00
|
|
|
searchHighlights={this.state.searchHighlights}
|
2016-02-22 20:19:04 +03:00
|
|
|
resultLink={resultLink}
|
2019-04-09 21:01:09 +03:00
|
|
|
permalinkCreator={this._getPermalinkCreatorForRoom(room)}
|
2019-03-06 14:27:16 +03:00
|
|
|
onHeightChanged={onHeightChanged} />);
|
2015-11-30 20:15:57 +03:00
|
|
|
}
|
2015-12-22 18:18:50 +03:00
|
|
|
return ret;
|
|
|
|
},
|
|
|
|
|
2017-09-29 00:32:51 +03:00
|
|
|
onPinnedClick: function() {
|
2018-05-27 04:32:23 +03:00
|
|
|
const nowShowingPinned = !this.state.showingPinned;
|
|
|
|
const roomId = this.state.room.roomId;
|
|
|
|
this.setState({showingPinned: nowShowingPinned, searching: false});
|
|
|
|
SettingsStore.setValue("PinnedEvents.isOpen", roomId, SettingLevel.ROOM_DEVICE, nowShowingPinned);
|
2017-09-29 00:32:51 +03:00
|
|
|
},
|
|
|
|
|
2015-11-30 20:15:57 +03:00
|
|
|
onSettingsClick: function() {
|
2019-01-17 12:29:37 +03:00
|
|
|
dis.dispatch({ action: 'open_room_settings' });
|
2015-11-30 20:15:57 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
onCancelClick: function() {
|
2016-04-16 03:00:10 +03:00
|
|
|
console.log("updateTint from onCancelClick");
|
2016-01-08 06:22:38 +03:00
|
|
|
this.updateTint();
|
2017-06-16 18:12:52 +03:00
|
|
|
if (this.state.forwardingEvent) {
|
2019-01-17 12:29:37 +03:00
|
|
|
dis.dispatch({
|
2017-06-16 18:12:52 +03:00
|
|
|
action: 'forward_event',
|
|
|
|
event: null,
|
|
|
|
});
|
|
|
|
}
|
2020-06-03 04:07:46 +03:00
|
|
|
dis.fire(Action.FocusComposer);
|
2015-11-30 20:15:57 +03:00
|
|
|
},
|
|
|
|
|
2015-12-13 16:49:28 +03:00
|
|
|
onLeaveClick: function() {
|
2019-01-17 12:29:37 +03:00
|
|
|
dis.dispatch({
|
2015-12-13 16:49:28 +03:00
|
|
|
action: 'leave_room',
|
2016-04-12 21:25:07 +03:00
|
|
|
room_id: this.state.room.roomId,
|
2015-12-13 16:49:28 +03:00
|
|
|
});
|
2015-12-16 19:06:29 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
onForgetClick: function() {
|
2020-07-13 18:35:03 +03:00
|
|
|
dis.dispatch({
|
|
|
|
action: 'forget_room',
|
|
|
|
room_id: this.state.room.roomId,
|
2015-12-16 19:06:29 +03:00
|
|
|
});
|
2015-12-13 16:49:28 +03:00
|
|
|
},
|
|
|
|
|
2015-11-30 20:15:57 +03:00
|
|
|
onRejectButtonClicked: function(ev) {
|
2017-10-11 19:56:17 +03:00
|
|
|
const self = this;
|
2015-11-30 20:15:57 +03:00
|
|
|
this.setState({
|
2017-10-11 19:56:17 +03:00
|
|
|
rejecting: true,
|
2015-11-30 20:15:57 +03:00
|
|
|
});
|
2020-03-22 12:41:14 +03:00
|
|
|
this.context.leave(this.state.roomId).then(function() {
|
2019-01-17 12:29:37 +03:00
|
|
|
dis.dispatch({ action: 'view_next_room' });
|
2015-11-30 20:15:57 +03:00
|
|
|
self.setState({
|
2017-10-11 19:56:17 +03:00
|
|
|
rejecting: false,
|
2015-11-30 20:15:57 +03:00
|
|
|
});
|
2016-02-15 21:59:44 +03:00
|
|
|
}, function(error) {
|
|
|
|
console.error("Failed to reject invite: %s", error);
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const msg = error.message ? error.message : JSON.stringify(error);
|
|
|
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
2017-08-10 17:17:52 +03:00
|
|
|
Modal.createTrackedDialog('Failed to reject invite', '', ErrorDialog, {
|
2017-05-23 17:16:31 +03:00
|
|
|
title: _t("Failed to reject invite"),
|
|
|
|
description: msg,
|
2016-02-15 21:59:44 +03:00
|
|
|
});
|
|
|
|
|
2015-11-30 20:15:57 +03:00
|
|
|
self.setState({
|
|
|
|
rejecting: false,
|
2017-10-11 19:56:17 +03:00
|
|
|
rejectError: error,
|
2015-11-30 20:15:57 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2020-01-23 14:50:59 +03:00
|
|
|
onRejectAndIgnoreClick: async function() {
|
|
|
|
this.setState({
|
|
|
|
rejecting: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
try {
|
2020-03-22 12:41:14 +03:00
|
|
|
const myMember = this.state.room.getMember(this.context.getUserId());
|
2020-01-23 14:50:59 +03:00
|
|
|
const inviteEvent = myMember.events.member;
|
2020-03-22 12:41:14 +03:00
|
|
|
const ignoredUsers = this.context.getIgnoredUsers();
|
2020-01-23 14:50:59 +03:00
|
|
|
ignoredUsers.push(inviteEvent.getSender()); // de-duped internally in the js-sdk
|
2020-03-22 12:41:14 +03:00
|
|
|
await this.context.setIgnoredUsers(ignoredUsers);
|
2020-01-23 14:50:59 +03:00
|
|
|
|
2020-03-22 12:41:14 +03:00
|
|
|
await this.context.leave(this.state.roomId);
|
2020-01-23 14:50:59 +03:00
|
|
|
dis.dispatch({ action: 'view_next_room' });
|
|
|
|
this.setState({
|
|
|
|
rejecting: false,
|
|
|
|
});
|
|
|
|
} catch (error) {
|
|
|
|
console.error("Failed to reject invite: %s", error);
|
|
|
|
|
|
|
|
const msg = error.message ? error.message : JSON.stringify(error);
|
|
|
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
|
|
|
Modal.createTrackedDialog('Failed to reject invite', '', ErrorDialog, {
|
|
|
|
title: _t("Failed to reject invite"),
|
|
|
|
description: msg,
|
|
|
|
});
|
|
|
|
|
|
|
|
self.setState({
|
|
|
|
rejecting: false,
|
|
|
|
rejectError: error,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-03-10 18:56:58 +03:00
|
|
|
onRejectThreepidInviteButtonClicked: function(ev) {
|
2016-03-11 13:20:52 +03: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-09 05:33:21 +03:00
|
|
|
dis.fire(Action.ViewRoomDirectory);
|
2016-03-10 18:56:58 +03:00
|
|
|
},
|
|
|
|
|
2015-11-30 20:15:57 +03:00
|
|
|
onSearchClick: function() {
|
2019-02-24 05:57:13 +03:00
|
|
|
this.setState({
|
|
|
|
searching: !this.state.searching,
|
|
|
|
showingPinned: false,
|
|
|
|
});
|
2015-11-30 20:15:57 +03:00
|
|
|
},
|
|
|
|
|
2017-01-20 17:22:27 +03:00
|
|
|
onCancelSearchClick: function() {
|
2015-12-18 19:42:46 +03:00
|
|
|
this.setState({
|
|
|
|
searching: false,
|
|
|
|
searchResults: null,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-02-03 11:03:10 +03:00
|
|
|
// jump down to the bottom of this room, where new events are arriving
|
|
|
|
jumpToLiveTimeline: function() {
|
2019-12-08 15:16:17 +03:00
|
|
|
this._messagePanel.jumpToLiveTimeline();
|
2020-06-03 04:07:46 +03:00
|
|
|
dis.fire(Action.FocusComposer);
|
2015-12-18 19:42:46 +03:00
|
|
|
},
|
|
|
|
|
2016-02-24 20:26:34 +03:00
|
|
|
// jump up to wherever our read marker is
|
|
|
|
jumpToReadMarker: function() {
|
2019-12-08 15:16:17 +03:00
|
|
|
this._messagePanel.jumpToReadMarker();
|
2016-02-24 20:26:34 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// update the read marker to match the read-receipt
|
2016-04-13 14:46:36 +03:00
|
|
|
forgetReadMarker: function(ev) {
|
|
|
|
ev.stopPropagation();
|
2019-12-08 15:16:17 +03:00
|
|
|
this._messagePanel.forgetReadMarker();
|
2016-02-24 20:26:34 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// decide whether or not the top 'unread messages' bar should be shown
|
|
|
|
_updateTopUnreadMessagesBar: function() {
|
2019-12-08 15:16:17 +03:00
|
|
|
if (!this._messagePanel) {
|
2016-02-24 20:26:34 +03:00
|
|
|
return;
|
2017-01-20 17:22:27 +03:00
|
|
|
}
|
2016-02-24 20:26:34 +03:00
|
|
|
|
2019-12-08 15:16:17 +03:00
|
|
|
const showBar = this._messagePanel.canJumpToReadMarker();
|
2016-03-10 18:55:03 +03:00
|
|
|
if (this.state.showTopUnreadMessagesBar != showBar) {
|
2019-03-12 18:33:05 +03:00
|
|
|
this.setState({showTopUnreadMessagesBar: showBar});
|
2016-03-10 18:55:03 +03:00
|
|
|
}
|
2016-02-24 20:26:34 +03:00
|
|
|
},
|
|
|
|
|
2015-12-11 00:34:10 +03:00
|
|
|
// get the current scroll position of the room, so that it can be
|
2016-02-01 19:31:12 +03:00
|
|
|
// restored when we switch back to it.
|
|
|
|
//
|
2016-11-04 12:28:35 +03:00
|
|
|
_getScrollState: function() {
|
2019-12-08 15:16:17 +03:00
|
|
|
const messagePanel = this._messagePanel;
|
2015-12-22 18:18:50 +03:00
|
|
|
if (!messagePanel) return null;
|
|
|
|
|
2016-02-04 19:17:03 +03: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 19:56:17 +03:00
|
|
|
const scrollState = messagePanel.getScrollState();
|
2015-12-18 19:42:46 +03:00
|
|
|
|
2019-10-04 01:00:08 +03:00
|
|
|
// getScrollState on TimelinePanel *may* return null, so guard against that
|
|
|
|
if (!scrollState || scrollState.stuckAtBottom) {
|
2016-02-01 19:31:12 +03:00
|
|
|
// we don't really expect to be in this state, but it will
|
2016-02-03 11:03:10 +03: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 19:31:12 +03:00
|
|
|
return null;
|
2015-12-10 19:26:36 +03:00
|
|
|
}
|
2016-02-01 19:31:12 +03:00
|
|
|
|
|
|
|
return {
|
2016-02-03 11:03:10 +03:00
|
|
|
focussedEvent: scrollState.trackedScrollToken,
|
2016-02-01 19:31:12 +03:00
|
|
|
pixelOffset: scrollState.pixelOffset,
|
|
|
|
};
|
2015-12-10 19:26:36 +03:00
|
|
|
},
|
|
|
|
|
2019-03-12 18:33:05 +03:00
|
|
|
onResize: function() {
|
2015-12-13 07:32:48 +03:00
|
|
|
// It seems flexbox doesn't give us a way to constrain the auxPanel height to have
|
|
|
|
// a minimum of the height of the video element, whilst also capping it from pushing out the page
|
|
|
|
// so we have to do it via JS instead. In this implementation we cap the height by putting
|
|
|
|
// a maxHeight on the underlying remote video tag.
|
2016-01-10 16:03:37 +03:00
|
|
|
|
2016-01-15 18:53:53 +03:00
|
|
|
// header + footer + status + give us at least 120px of scrollback at all times.
|
2017-10-11 19:56:17 +03:00
|
|
|
let auxPanelMaxHeight = window.innerHeight -
|
2016-01-15 17:22:17 +03:00
|
|
|
(83 + // height of RoomHeader
|
|
|
|
36 + // height of the status area
|
|
|
|
72 + // minimum height of the message compmoser
|
2019-02-04 23:25:26 +03:00
|
|
|
120); // amount of desired scrollback
|
2016-01-10 16:03:37 +03:00
|
|
|
|
|
|
|
// XXX: this is a bit of a hack and might possibly cause the video to push out the page anyway
|
|
|
|
// but it's better than the video going missing entirely
|
|
|
|
if (auxPanelMaxHeight < 50) auxPanelMaxHeight = 50;
|
|
|
|
|
2016-03-08 15:16:34 +03:00
|
|
|
this.setState({auxPanelMaxHeight: auxPanelMaxHeight});
|
2015-12-13 07:32:48 +03:00
|
|
|
},
|
|
|
|
|
2015-12-15 03:01:47 +03:00
|
|
|
onFullscreenClick: function() {
|
2019-01-17 12:29:37 +03:00
|
|
|
dis.dispatch({
|
2015-12-15 03:01:47 +03:00
|
|
|
action: 'video_fullscreen',
|
2017-10-11 19:56:17 +03:00
|
|
|
fullscreen: true,
|
2015-12-15 03:01:47 +03:00
|
|
|
}, true);
|
|
|
|
},
|
|
|
|
|
2015-12-15 02:37:34 +03:00
|
|
|
onMuteAudioClick: function() {
|
2017-10-11 19:56:17 +03:00
|
|
|
const call = this._getCallForRoom();
|
2015-12-15 02:37:34 +03:00
|
|
|
if (!call) {
|
|
|
|
return;
|
|
|
|
}
|
2017-10-11 19:56:17 +03:00
|
|
|
const newState = !call.isMicrophoneMuted();
|
2015-12-15 02:37:34 +03:00
|
|
|
call.setMicrophoneMuted(newState);
|
2016-10-17 16:03:37 +03:00
|
|
|
this.forceUpdate(); // TODO: just update the voip buttons
|
2015-12-15 02:37:34 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
onMuteVideoClick: function() {
|
2017-10-11 19:56:17 +03:00
|
|
|
const call = this._getCallForRoom();
|
2015-12-15 02:37:34 +03:00
|
|
|
if (!call) {
|
|
|
|
return;
|
|
|
|
}
|
2017-10-11 19:56:17 +03:00
|
|
|
const newState = !call.isLocalVideoMuted();
|
2015-12-15 02:37:34 +03:00
|
|
|
call.setLocalVideoMuted(newState);
|
2016-10-17 16:03:37 +03:00
|
|
|
this.forceUpdate(); // TODO: just update the voip buttons
|
2015-12-15 02:37:34 +03:00
|
|
|
},
|
|
|
|
|
2017-01-23 18:01:39 +03:00
|
|
|
onStatusBarVisible: function() {
|
2017-01-26 20:03:01 +03:00
|
|
|
if (this.unmounted) return;
|
2017-01-23 18:01:39 +03:00
|
|
|
this.setState({
|
|
|
|
statusBarVisible: true,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onStatusBarHidden: function() {
|
2018-01-05 15:03:46 +03:00
|
|
|
// This is currently not desired as it is annoying if it keeps expanding and collapsing
|
2019-01-22 16:50:31 +03:00
|
|
|
if (this.unmounted) return;
|
2017-01-23 18:01:39 +03:00
|
|
|
this.setState({
|
|
|
|
statusBarVisible: false,
|
2019-01-22 16:50:31 +03:00
|
|
|
});
|
2017-01-23 18:01:39 +03:00
|
|
|
},
|
|
|
|
|
2016-04-05 15:14:11 +03:00
|
|
|
/**
|
|
|
|
* called by the parent component when PageUp/Down/etc is pressed.
|
|
|
|
*
|
|
|
|
* We pass it down to the scroll panel.
|
|
|
|
*/
|
|
|
|
handleScrollKey: function(ev) {
|
2017-10-11 19:56:17 +03:00
|
|
|
let panel;
|
2019-12-08 15:16:17 +03:00
|
|
|
if (this._searchResultsPanel.current) {
|
|
|
|
panel = this._searchResultsPanel.current;
|
|
|
|
} else if (this._messagePanel) {
|
|
|
|
panel = this._messagePanel;
|
2016-04-05 15:14:11 +03:00
|
|
|
}
|
|
|
|
|
2017-11-16 16:19:36 +03:00
|
|
|
if (panel) {
|
2016-04-05 15:14:11 +03:00
|
|
|
panel.handleScrollKey(ev);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-04-12 21:25:07 +03:00
|
|
|
/**
|
|
|
|
* get any current call for this room
|
|
|
|
*/
|
|
|
|
_getCallForRoom: function() {
|
|
|
|
if (!this.state.room) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return CallHandler.getCallForRoom(this.state.room.roomId);
|
|
|
|
},
|
|
|
|
|
2016-03-08 15:16:34 +03:00
|
|
|
// this has to be a proper method rather than an unnamed function,
|
|
|
|
// otherwise react calls it with null on each update.
|
|
|
|
_gatherTimelinePanelRef: function(r) {
|
2019-12-08 15:16:17 +03:00
|
|
|
this._messagePanel = r;
|
2017-11-16 16:19:36 +03:00
|
|
|
if (r) {
|
2016-04-16 03:00:10 +03:00
|
|
|
console.log("updateTint from RoomView._gatherTimelinePanelRef");
|
2016-03-08 15:16:34 +03:00
|
|
|
this.updateTint();
|
2016-01-17 06:59:31 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-03-27 04:22:24 +03:00
|
|
|
_getOldRoom: function() {
|
|
|
|
const createEvent = this.state.room.currentState.getStateEvents("m.room.create", "");
|
|
|
|
if (!createEvent || !createEvent.getContent()['predecessor']) return null;
|
|
|
|
|
2020-03-22 12:41:14 +03:00
|
|
|
return this.context.getRoom(createEvent.getContent()['predecessor']['room_id']);
|
2019-03-27 04:22:24 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
_getHiddenHighlightCount: function() {
|
|
|
|
const oldRoom = this._getOldRoom();
|
|
|
|
if (!oldRoom) return 0;
|
|
|
|
return oldRoom.getUnreadNotificationCount('highlight');
|
|
|
|
},
|
|
|
|
|
|
|
|
_onHiddenHighlightsClick: function() {
|
|
|
|
const oldRoom = this._getOldRoom();
|
|
|
|
if (!oldRoom) return;
|
|
|
|
dis.dispatch({action: "view_room", room_id: oldRoom.roomId});
|
|
|
|
},
|
|
|
|
|
2015-11-30 20:15:57 +03:00
|
|
|
render: function() {
|
2017-04-21 14:56:59 +03:00
|
|
|
const RoomHeader = sdk.getComponent('rooms.RoomHeader');
|
|
|
|
const ForwardMessage = sdk.getComponent("rooms.ForwardMessage");
|
|
|
|
const AuxPanel = sdk.getComponent("rooms.AuxPanel");
|
|
|
|
const SearchBar = sdk.getComponent("rooms.SearchBar");
|
2017-09-29 00:32:51 +03:00
|
|
|
const PinnedEventsPanel = sdk.getComponent("rooms.PinnedEventsPanel");
|
2017-04-21 14:56:59 +03:00
|
|
|
const ScrollPanel = sdk.getComponent("structures.ScrollPanel");
|
|
|
|
const TintableSvg = sdk.getComponent("elements.TintableSvg");
|
|
|
|
const RoomPreviewBar = sdk.getComponent("rooms.RoomPreviewBar");
|
|
|
|
const TimelinePanel = sdk.getComponent("structures.TimelinePanel");
|
2018-08-17 16:54:43 +03:00
|
|
|
const RoomUpgradeWarningBar = sdk.getComponent("rooms.RoomUpgradeWarningBar");
|
2018-12-07 00:39:59 +03:00
|
|
|
const RoomRecoveryReminder = sdk.getComponent("rooms.RoomRecoveryReminder");
|
2019-10-02 19:28:03 +03:00
|
|
|
const ErrorBoundary = sdk.getComponent("elements.ErrorBoundary");
|
2015-11-30 20:15:57 +03:00
|
|
|
|
2016-02-10 21:27:40 +03:00
|
|
|
if (!this.state.room) {
|
2020-05-22 13:18:14 +03:00
|
|
|
const loading = !this.state.matrixClientIsReady || this.state.roomLoading || this.state.peekLoading;
|
2019-04-15 19:49:00 +03:00
|
|
|
if (loading) {
|
2020-05-19 15:17:34 +03: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 13:21:33 +03:00
|
|
|
return (
|
|
|
|
<div className="mx_RoomView">
|
2019-10-02 19:28:03 +03:00
|
|
|
<ErrorBoundary>
|
|
|
|
<RoomPreviewBar
|
|
|
|
canPreview={false}
|
2020-05-19 15:17:34 +03:00
|
|
|
previewLoading={previewLoading && !this.state.roomLoadError}
|
2019-10-02 19:28:03 +03:00
|
|
|
error={this.state.roomLoadError}
|
|
|
|
loading={loading}
|
|
|
|
joining={this.state.joining}
|
|
|
|
oobData={this.props.oobData}
|
|
|
|
/>
|
|
|
|
</ErrorBoundary>
|
2017-05-30 13:21:33 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
var inviterName = undefined;
|
|
|
|
if (this.props.oobData) {
|
|
|
|
inviterName = this.props.oobData.inviterName;
|
|
|
|
}
|
|
|
|
var invitedEmail = undefined;
|
|
|
|
if (this.props.thirdPartyInvite) {
|
|
|
|
invitedEmail = this.props.thirdPartyInvite.invitedEmail;
|
2016-01-18 20:39:23 +03:00
|
|
|
}
|
2016-03-01 21:23:57 +03:00
|
|
|
|
2017-05-30 13:21:33 +03: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 13:10:55 +03:00
|
|
|
const roomAlias = this.state.roomAlias;
|
2017-05-30 13:21:33 +03:00
|
|
|
return (
|
|
|
|
<div className="mx_RoomView">
|
2019-10-02 19:28:03 +03:00
|
|
|
<ErrorBoundary>
|
2020-05-19 15:17:34 +03:00
|
|
|
<RoomPreviewBar
|
|
|
|
onJoinClick={this.onJoinButtonClicked}
|
2019-10-02 19:28:03 +03:00
|
|
|
onForgetClick={this.onForgetClick}
|
|
|
|
onRejectClick={this.onRejectThreepidInviteButtonClicked}
|
|
|
|
canPreview={false} error={this.state.roomLoadError}
|
|
|
|
roomAlias={roomAlias}
|
|
|
|
joining={this.state.joining}
|
|
|
|
inviterName={inviterName}
|
|
|
|
invitedEmail={invitedEmail}
|
|
|
|
oobData={this.props.oobData}
|
|
|
|
signUrl={this.props.thirdPartyInvite ? this.props.thirdPartyInvite.inviteSignUrl : null}
|
|
|
|
room={this.state.room}
|
|
|
|
/>
|
|
|
|
</ErrorBoundary>
|
2017-05-30 13:21:33 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2015-11-30 20:15:57 +03:00
|
|
|
}
|
|
|
|
|
2018-08-22 18:35:58 +03:00
|
|
|
const myMembership = this.state.room.getMyMembership();
|
|
|
|
if (myMembership == 'invite') {
|
2015-11-30 20:15:57 +03:00
|
|
|
if (this.state.joining || this.state.rejecting) {
|
|
|
|
return (
|
2019-10-02 19:28:03 +03:00
|
|
|
<ErrorBoundary>
|
|
|
|
<RoomPreviewBar
|
2019-04-15 19:49:00 +03:00
|
|
|
canPreview={false}
|
|
|
|
error={this.state.roomLoadError}
|
|
|
|
joining={this.state.joining}
|
|
|
|
rejecting={this.state.rejecting}
|
|
|
|
/>
|
2019-10-02 19:28:03 +03:00
|
|
|
</ErrorBoundary>
|
2015-11-30 20:15:57 +03:00
|
|
|
);
|
|
|
|
} else {
|
2020-03-22 12:41:14 +03:00
|
|
|
const myUserId = this.context.credentials.userId;
|
2018-08-22 18:35:58 +03:00
|
|
|
const myMember = this.state.room.getMember(myUserId);
|
2020-05-10 13:17:21 +03: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 20:39:23 +03: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 23:15:12 +03:00
|
|
|
|
2016-03-17 21:38:25 +03:00
|
|
|
// We have a regular invite for this room.
|
2015-11-30 20:15:57 +03:00
|
|
|
return (
|
|
|
|
<div className="mx_RoomView">
|
2019-10-02 19:28:03 +03:00
|
|
|
<ErrorBoundary>
|
2020-01-23 14:50:59 +03:00
|
|
|
<RoomPreviewBar
|
|
|
|
onJoinClick={this.onJoinButtonClicked}
|
2019-10-02 19:28:03 +03:00
|
|
|
onForgetClick={this.onForgetClick}
|
|
|
|
onRejectClick={this.onRejectButtonClicked}
|
2020-01-23 14:50:59 +03:00
|
|
|
onRejectAndIgnoreClick={this.onRejectAndIgnoreClick}
|
2019-10-02 19:28:03 +03:00
|
|
|
inviterName={inviterName}
|
|
|
|
canPreview={false}
|
|
|
|
joining={this.state.joining}
|
|
|
|
room={this.state.room}
|
|
|
|
/>
|
|
|
|
</ErrorBoundary>
|
2015-11-30 20:15:57 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2016-02-08 19:43:08 +03:00
|
|
|
}
|
2015-11-30 20:15:57 +03:00
|
|
|
|
2016-02-08 19:43:08 +03:00
|
|
|
// We have successfully loaded this room, and are not previewing.
|
|
|
|
// Display the "normal" room view.
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const call = this._getCallForRoom();
|
|
|
|
let inCall = false;
|
2016-02-08 21:04:54 +03:00
|
|
|
if (call && (this.state.callState !== 'ended' && this.state.callState !== 'ringing')) {
|
|
|
|
inCall = true;
|
|
|
|
}
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const scrollheader_classes = classNames({
|
2016-02-08 19:43:08 +03:00
|
|
|
mx_RoomView_scrollheader: true,
|
|
|
|
});
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
let statusBar;
|
2017-01-26 21:07:42 +03:00
|
|
|
let isStatusAreaExpanded = true;
|
2016-02-08 19:43:08 +03:00
|
|
|
|
2019-04-01 18:42:41 +03:00
|
|
|
if (ContentMessages.sharedInstance().getCurrentUploads().length > 0) {
|
2017-10-11 19:56:17 +03:00
|
|
|
const UploadBar = sdk.getComponent('structures.UploadBar');
|
2017-01-20 17:22:27 +03:00
|
|
|
statusBar = <UploadBar room={this.state.room} />;
|
2016-02-08 19:43:08 +03:00
|
|
|
} else if (!this.state.searchResults) {
|
2017-10-11 19:56:17 +03:00
|
|
|
const RoomStatusBar = sdk.getComponent('structures.RoomStatusBar');
|
2017-01-26 21:07:42 +03:00
|
|
|
isStatusAreaExpanded = this.state.statusBarVisible;
|
2016-02-08 21:04:54 +03:00
|
|
|
statusBar = <RoomStatusBar
|
|
|
|
room={this.state.room}
|
2017-10-12 06:15:00 +03:00
|
|
|
sentMessageAndIsAlone={this.state.isAlone}
|
2016-02-08 21:04:54 +03:00
|
|
|
hasActiveCall={inCall}
|
2018-10-15 23:35:36 +03:00
|
|
|
isPeeking={myMembership !== "join"}
|
2017-10-12 06:15:00 +03:00
|
|
|
onInviteClick={this.onInviteButtonClick}
|
|
|
|
onStopWarningClick={this.onStopAloneWarningClick}
|
2017-01-23 18:01:39 +03:00
|
|
|
onVisible={this.onStatusBarVisible}
|
|
|
|
onHidden={this.onStatusBarHidden}
|
|
|
|
/>;
|
2016-02-08 19:43:08 +03:00
|
|
|
}
|
2015-11-30 20:15:57 +03:00
|
|
|
|
2019-01-29 03:21:33 +03:00
|
|
|
const roomVersionRecommendation = this.state.upgradeRecommendation;
|
2018-08-17 16:54:43 +03:00
|
|
|
const showRoomUpgradeBar = (
|
2019-01-29 03:21:33 +03:00
|
|
|
roomVersionRecommendation &&
|
|
|
|
roomVersionRecommendation.needsUpgrade &&
|
2020-03-22 12:41:14 +03:00
|
|
|
this.state.room.userMayUpgradeRoom(this.context.credentials.userId)
|
2018-08-17 16:54:43 +03:00
|
|
|
);
|
|
|
|
|
2018-12-07 00:39:59 +03:00
|
|
|
const showRoomRecoveryReminder = (
|
2020-07-02 15:19:27 +03:00
|
|
|
this.context.isCryptoEnabled() &&
|
2018-12-07 00:39:59 +03:00
|
|
|
SettingsStore.getValue("showRoomRecoveryReminder") &&
|
2020-03-22 12:41:14 +03:00
|
|
|
this.context.isRoomEncrypted(this.state.room.roomId) &&
|
2020-04-30 17:41:49 +03:00
|
|
|
this.context.getKeyBackupEnabled() === false
|
2018-12-07 00:39:59 +03:00
|
|
|
);
|
|
|
|
|
2019-03-27 04:22:24 +03:00
|
|
|
const hiddenHighlightCount = this._getHiddenHighlightCount();
|
|
|
|
|
2017-04-21 14:56:59 +03:00
|
|
|
let aux = null;
|
2019-04-10 18:49:45 +03:00
|
|
|
let previewBar;
|
2017-05-30 13:20:41 +03:00
|
|
|
let hideCancel = false;
|
2019-12-06 03:47:18 +03:00
|
|
|
let forceHideRightPanel = false;
|
2019-02-04 23:25:26 +03:00
|
|
|
if (this.state.forwardingEvent !== null) {
|
2017-06-16 18:12:52 +03:00
|
|
|
aux = <ForwardMessage onCancelClick={this.onCancelClick} />;
|
2017-04-21 14:56:59 +03:00
|
|
|
} else if (this.state.searching) {
|
2017-05-30 13:20:41 +03:00
|
|
|
hideCancel = true; // has own cancel
|
2019-12-08 15:12:06 +03:00
|
|
|
aux = <SearchBar searchInProgress={this.state.searchInProgress} onCancelClick={this.onCancelSearchClick} onSearch={this.onSearch} />;
|
2018-08-17 16:54:43 +03:00
|
|
|
} else if (showRoomUpgradeBar) {
|
2019-01-29 03:21:33 +03:00
|
|
|
aux = <RoomUpgradeWarningBar room={this.state.room} recommendation={roomVersionRecommendation} />;
|
2018-08-17 16:54:43 +03:00
|
|
|
hideCancel = true;
|
2018-12-07 00:39:59 +03:00
|
|
|
} else if (showRoomRecoveryReminder) {
|
2019-01-09 19:27:41 +03:00
|
|
|
aux = <RoomRecoveryReminder onDontAskAgainSet={this.onRoomRecoveryReminderDontAskAgain} />;
|
2018-12-07 00:39:59 +03:00
|
|
|
hideCancel = true;
|
2017-09-29 00:32:51 +03:00
|
|
|
} else if (this.state.showingPinned) {
|
|
|
|
hideCancel = true; // has own cancel
|
2017-09-29 02:00:26 +03:00
|
|
|
aux = <PinnedEventsPanel room={this.state.room} onCancelClick={this.onPinnedClick} />;
|
2018-08-22 18:35:58 +03:00
|
|
|
} else if (myMembership !== "join") {
|
2016-03-18 19:06:36 +03: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.
|
2016-03-10 18:56:58 +03:00
|
|
|
var inviterName = undefined;
|
|
|
|
if (this.props.oobData) {
|
|
|
|
inviterName = this.props.oobData.inviterName;
|
|
|
|
}
|
2016-03-17 21:38:25 +03:00
|
|
|
var invitedEmail = undefined;
|
|
|
|
if (this.props.thirdPartyInvite) {
|
|
|
|
invitedEmail = this.props.thirdPartyInvite.invitedEmail;
|
|
|
|
}
|
2017-05-30 13:20:41 +03:00
|
|
|
hideCancel = true;
|
2019-04-10 18:49:45 +03:00
|
|
|
previewBar = (
|
2016-06-24 17:34:07 +03:00
|
|
|
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked}
|
2017-10-11 19:56:17 +03:00
|
|
|
onForgetClick={this.onForgetClick}
|
2016-03-17 21:38:25 +03:00
|
|
|
onRejectClick={this.onRejectThreepidInviteButtonClicked}
|
2019-04-15 19:49:00 +03:00
|
|
|
joining={this.state.joining}
|
2016-03-10 18:56:58 +03:00
|
|
|
inviterName={inviterName}
|
2016-03-17 21:38:25 +03:00
|
|
|
invitedEmail={invitedEmail}
|
2019-06-06 16:34:57 +03:00
|
|
|
oobData={this.props.oobData}
|
2016-03-17 21:38:25 +03:00
|
|
|
canPreview={this.state.canPeek}
|
2016-04-12 19:18:32 +03:00
|
|
|
room={this.state.room}
|
2016-02-09 19:55:03 +03:00
|
|
|
/>
|
2016-02-08 19:43:08 +03:00
|
|
|
);
|
2019-04-12 13:47:52 +03:00
|
|
|
if (!this.state.canPeek) {
|
|
|
|
return (
|
|
|
|
<div className="mx_RoomView">
|
|
|
|
{ previewBar }
|
|
|
|
</div>
|
|
|
|
);
|
2019-04-17 20:29:39 +03:00
|
|
|
} else {
|
2019-12-06 03:47:18 +03:00
|
|
|
forceHideRightPanel = true;
|
2019-04-12 13:47:52 +03:00
|
|
|
}
|
2019-03-27 04:22:24 +03:00
|
|
|
} else if (hiddenHighlightCount > 0) {
|
|
|
|
aux = (
|
2019-03-27 22:14:31 +03:00
|
|
|
<AccessibleButton element="div" className="mx_RoomView_auxPanel_hiddenHighlights"
|
|
|
|
onClick={this._onHiddenHighlightsClick}>
|
2019-03-27 04:22:24 +03:00
|
|
|
{_t(
|
|
|
|
"You have %(count)s unread notifications in a prior version of this room.",
|
|
|
|
{count: hiddenHighlightCount},
|
|
|
|
)}
|
2019-03-27 22:14:31 +03:00
|
|
|
</AccessibleButton>
|
2019-03-27 04:22:24 +03:00
|
|
|
);
|
2016-02-08 19:43:08 +03:00
|
|
|
}
|
2015-12-18 20:23:46 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
const auxPanel = (
|
2019-12-08 15:12:06 +03:00
|
|
|
<AuxPanel room={this.state.room}
|
2019-02-04 23:25:26 +03:00
|
|
|
fullHeight={false}
|
2020-03-22 12:41:14 +03:00
|
|
|
userId={this.context.credentials.userId}
|
2016-02-23 18:46:27 +03:00
|
|
|
conferenceHandler={this.props.ConferenceHandler}
|
|
|
|
draggingFile={this.state.draggingFile}
|
|
|
|
displayConfCallNotification={this.state.displayConfCallNotification}
|
|
|
|
maxHeight={this.state.auxPanelMaxHeight}
|
2018-02-09 16:23:34 +03:00
|
|
|
showApps={this.state.showApps}
|
2019-02-04 23:25:26 +03:00
|
|
|
hideAppsDrawer={false} >
|
2016-02-23 18:46:27 +03:00
|
|
|
{ aux }
|
|
|
|
</AuxPanel>
|
|
|
|
);
|
2015-12-15 03:01:47 +03:00
|
|
|
|
2018-10-27 06:50:35 +03:00
|
|
|
let messageComposer; let searchInfo;
|
2017-10-11 19:56:17 +03:00
|
|
|
const canSpeak = (
|
2016-02-08 19:43:08 +03:00
|
|
|
// joined and not showing search results
|
2018-10-15 23:26:02 +03:00
|
|
|
myMembership === 'join' && !this.state.searchResults
|
2016-02-08 19:43:08 +03:00
|
|
|
);
|
|
|
|
if (canSpeak) {
|
2020-01-06 03:13:16 +03:00
|
|
|
const MessageComposer = sdk.getComponent('rooms.MessageComposer');
|
|
|
|
messageComposer =
|
|
|
|
<MessageComposer
|
|
|
|
room={this.state.room}
|
|
|
|
callState={this.state.callState}
|
|
|
|
disabled={this.props.disabled}
|
|
|
|
showApps={this.state.showApps}
|
|
|
|
e2eStatus={this.state.e2eStatus}
|
|
|
|
permalinkCreator={this._getPermalinkCreatorForRoom(this.state.room)}
|
|
|
|
/>;
|
2016-02-08 19:43:08 +03:00
|
|
|
}
|
2015-12-15 02:37:34 +03:00
|
|
|
|
2016-02-08 19:43:08 +03: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 19:56:17 +03:00
|
|
|
searchTerm: this.state.searchTerm,
|
|
|
|
searchScope: this.state.searchScope,
|
|
|
|
searchCount: this.state.searchResults.count,
|
2016-02-08 19:43:08 +03:00
|
|
|
};
|
|
|
|
}
|
2015-12-15 02:37:34 +03:00
|
|
|
|
2016-02-08 21:04:54 +03:00
|
|
|
if (inCall) {
|
2020-07-08 18:30:50 +03:00
|
|
|
let zoomButton; let videoMuteButton;
|
2016-02-08 19:43:08 +03:00
|
|
|
|
|
|
|
if (call.type === "video") {
|
|
|
|
zoomButton = (
|
2017-10-11 19:56:17 +03:00
|
|
|
<div className="mx_RoomView_voipButton" onClick={this.onFullscreenClick} title={_t("Fill screen")}>
|
2020-07-08 18:30:50 +03:00
|
|
|
<TintableSvg src={require("../../../res/img/element-icons/call/fullscreen.svg")} width="29" height="22" style={{ marginTop: 1, marginRight: 4 }} />
|
2016-02-08 19:43:08 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
videoMuteButton =
|
|
|
|
<div className="mx_RoomView_voipButton" onClick={this.onMuteVideoClick}>
|
2020-07-08 18:30:50 +03:00
|
|
|
<TintableSvg src={call.isLocalVideoMuted() ?
|
|
|
|
require("../../../res/img/element-icons/call/video-muted.svg") :
|
|
|
|
require("../../../res/img/element-icons/call/video-call.svg")}
|
2017-05-23 17:16:31 +03:00
|
|
|
alt={call.isLocalVideoMuted() ? _t("Click to unmute video") : _t("Click to mute video")}
|
2020-07-08 18:30:50 +03:00
|
|
|
width="" height="27" />
|
2017-01-20 17:22:27 +03:00
|
|
|
</div>;
|
2015-12-15 02:37:34 +03:00
|
|
|
}
|
2020-07-08 18:30:50 +03:00
|
|
|
const voiceMuteButton =
|
2016-02-08 19:43:08 +03:00
|
|
|
<div className="mx_RoomView_voipButton" onClick={this.onMuteAudioClick}>
|
2020-07-08 18:30:50 +03:00
|
|
|
<TintableSvg src={call.isMicrophoneMuted() ?
|
|
|
|
require("../../../res/img/element-icons/call/voice-muted.svg") :
|
|
|
|
require("../../../res/img/element-icons/call/voice-unmuted.svg")}
|
2017-05-23 17:16:31 +03:00
|
|
|
alt={call.isMicrophoneMuted() ? _t("Click to unmute audio") : _t("Click to mute audio")}
|
2017-10-11 19:56:17 +03:00
|
|
|
width="21" height="26" />
|
2017-01-20 17:22:27 +03:00
|
|
|
</div>;
|
2015-12-15 02:37:34 +03:00
|
|
|
|
2016-02-08 21:04:54 +03:00
|
|
|
// wrap the existing status bar into a 'callStatusBar' which adds more knobs.
|
2016-02-08 19:43:08 +03:00
|
|
|
statusBar =
|
|
|
|
<div className="mx_RoomView_callStatusBar">
|
|
|
|
{ voiceMuteButton }
|
|
|
|
{ videoMuteButton }
|
|
|
|
{ zoomButton }
|
|
|
|
{ statusBar }
|
2017-01-20 17:22:27 +03:00
|
|
|
</div>;
|
2016-02-08 19:43:08 +03:00
|
|
|
}
|
2016-02-01 19:31:12 +03:00
|
|
|
|
2016-02-08 19:43:08 +03:00
|
|
|
// if we have search results, we keep the messagepanel (so that it preserves its
|
|
|
|
// scroll state), but hide it.
|
2017-10-11 19:56:17 +03:00
|
|
|
let searchResultsPanel;
|
|
|
|
let hideMessagePanel = false;
|
2016-02-08 19:43:08 +03:00
|
|
|
|
|
|
|
if (this.state.searchResults) {
|
2019-01-15 20:45:56 +03:00
|
|
|
// show searching spinner
|
|
|
|
if (this.state.searchResults.results === undefined) {
|
|
|
|
searchResultsPanel = (<div className="mx_RoomView_messagePanel mx_RoomView_messagePanelSearchSpinner" />);
|
|
|
|
} else {
|
|
|
|
searchResultsPanel = (
|
2020-06-16 02:51:11 +03:00
|
|
|
<ScrollPanel
|
|
|
|
ref={this._searchResultsPanel}
|
|
|
|
className="mx_RoomView_messagePanel mx_RoomView_searchResultsPanel mx_GroupLayout"
|
2019-01-15 20:45:56 +03:00
|
|
|
onFillRequest={this.onSearchResultsFillRequest}
|
2019-03-18 16:05:56 +03:00
|
|
|
resizeNotifier={this.props.resizeNotifier}
|
2019-01-15 20:45:56 +03:00
|
|
|
>
|
|
|
|
<li className={scrollheader_classes}></li>
|
|
|
|
{ this.getSearchResultTiles() }
|
|
|
|
</ScrollPanel>
|
|
|
|
);
|
|
|
|
}
|
2016-02-08 19:43:08 +03:00
|
|
|
hideMessagePanel = true;
|
|
|
|
}
|
2015-12-22 18:18:50 +03:00
|
|
|
|
2017-06-08 17:47:41 +03:00
|
|
|
const shouldHighlight = this.state.isInitialEventHighlighted;
|
2017-06-08 16:17:49 +03:00
|
|
|
let highlightedEventId = null;
|
|
|
|
if (this.state.forwardingEvent) {
|
|
|
|
highlightedEventId = this.state.forwardingEvent.getId();
|
|
|
|
} else if (shouldHighlight) {
|
2017-06-08 17:47:41 +03:00
|
|
|
highlightedEventId = this.state.initialEventId;
|
2017-06-08 16:17:49 +03:00
|
|
|
}
|
|
|
|
|
2020-05-26 17:56:16 +03:00
|
|
|
const messagePanelClassNames = classNames(
|
|
|
|
"mx_RoomView_messagePanel",
|
|
|
|
{
|
|
|
|
"mx_IRCLayout": this.state.useIRCLayout,
|
|
|
|
"mx_GroupLayout": !this.state.useIRCLayout,
|
|
|
|
});
|
|
|
|
|
2019-11-26 04:14:03 +03:00
|
|
|
// console.info("ShowUrlPreview for %s is %s", this.state.room.roomId, this.state.showUrlPreview);
|
2017-10-11 19:56:17 +03:00
|
|
|
const messagePanel = (
|
2019-12-08 15:16:17 +03:00
|
|
|
<TimelinePanel
|
|
|
|
ref={this._gatherTimelinePanelRef}
|
2017-08-30 15:32:07 +03:00
|
|
|
timelineSet={this.state.room.getUnfilteredTimelineSet()}
|
2020-03-20 12:29:59 +03:00
|
|
|
showReadReceipts={this.state.showReadReceipts}
|
2017-10-12 03:43:24 +03:00
|
|
|
manageReadReceipts={!this.state.isPeeking}
|
|
|
|
manageReadMarkers={!this.state.isPeeking}
|
2017-08-30 15:32:07 +03:00
|
|
|
hidden={hideMessagePanel}
|
|
|
|
highlightedEventId={highlightedEventId}
|
|
|
|
eventId={this.state.initialEventId}
|
|
|
|
eventPixelOffset={this.state.initialEventPixelOffset}
|
2017-10-11 19:56:17 +03:00
|
|
|
onScroll={this.onMessageListScroll}
|
|
|
|
onReadMarkerUpdated={this._updateTopUnreadMessagesBar}
|
|
|
|
showUrlPreview = {this.state.showUrlPreview}
|
2020-05-26 17:56:16 +03:00
|
|
|
className={messagePanelClassNames}
|
2018-09-17 20:27:25 +03:00
|
|
|
membersLoaded={this.state.membersLoaded}
|
2019-04-09 21:01:09 +03:00
|
|
|
permalinkCreator={this._getPermalinkCreatorForRoom(this.state.room)}
|
2019-03-12 18:36:12 +03:00
|
|
|
resizeNotifier={this.props.resizeNotifier}
|
2019-05-21 19:23:19 +03:00
|
|
|
showReactions={true}
|
2020-05-26 17:56:16 +03:00
|
|
|
useIRCLayout={this.state.useIRCLayout}
|
2016-02-10 21:27:40 +03:00
|
|
|
/>);
|
2016-02-08 19:43:08 +03:00
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
let topUnreadMessagesBar = null;
|
2019-12-26 23:32:25 +03:00
|
|
|
// Do not show TopUnreadMessagesBar if we have search results showing, it makes no sense
|
|
|
|
if (this.state.showTopUnreadMessagesBar && !this.state.searchResults) {
|
2017-10-11 19:56:17 +03:00
|
|
|
const TopUnreadMessagesBar = sdk.getComponent('rooms.TopUnreadMessagesBar');
|
2018-12-03 16:55:24 +03:00
|
|
|
topUnreadMessagesBar = (<TopUnreadMessagesBar
|
|
|
|
onScrollUpClick={this.jumpToReadMarker}
|
|
|
|
onCloseClick={this.forgetReadMarker}
|
|
|
|
/>);
|
2016-02-24 20:26:34 +03:00
|
|
|
}
|
2019-01-22 16:50:16 +03:00
|
|
|
let jumpToBottom;
|
2019-12-26 23:32:25 +03: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 16:50:16 +03:00
|
|
|
const JumpToBottomButton = sdk.getComponent('rooms.JumpToBottomButton');
|
|
|
|
jumpToBottom = (<JumpToBottomButton
|
2020-07-03 21:27:55 +03:00
|
|
|
highlight={this.state.room.getUnreadNotificationCount('highlight') > 0}
|
2019-01-22 16:50:16 +03:00
|
|
|
numUnreadMessages={this.state.numUnreadMessages}
|
|
|
|
onScrollToBottomClick={this.jumpToLiveTimeline}
|
|
|
|
/>);
|
|
|
|
}
|
2017-10-25 13:09:48 +03:00
|
|
|
const statusBarAreaClass = classNames(
|
2017-10-25 17:15:49 +03:00
|
|
|
"mx_RoomView_statusArea",
|
2017-10-25 13:09:48 +03:00
|
|
|
{
|
|
|
|
"mx_RoomView_statusArea_expanded": isStatusAreaExpanded,
|
2017-10-25 17:15:49 +03:00
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
const fadableSectionClasses = classNames(
|
|
|
|
"mx_RoomView_body", "mx_fadable",
|
|
|
|
{
|
2017-10-25 13:09:48 +03:00
|
|
|
"mx_fadable_faded": this.props.disabled,
|
|
|
|
},
|
|
|
|
);
|
2016-02-24 20:26:34 +03:00
|
|
|
|
2020-03-20 03:18:24 +03:00
|
|
|
const showRightPanel = !forceHideRightPanel && this.state.room && this.state.showRightPanel;
|
2019-12-06 03:47:18 +03:00
|
|
|
const rightPanel = showRightPanel
|
|
|
|
? <RightPanel roomId={this.state.room.roomId} resizeNotifier={this.props.resizeNotifier} />
|
|
|
|
: null;
|
2018-10-30 20:13:17 +03:00
|
|
|
|
2020-03-20 12:29:59 +03:00
|
|
|
const timelineClasses = classNames("mx_RoomView_timeline", {
|
|
|
|
mx_RoomView_timeline_rr_enabled: this.state.showReadReceipts,
|
|
|
|
});
|
|
|
|
|
2020-04-14 17:24:41 +03:00
|
|
|
const mainClasses = classNames("mx_RoomView", {
|
|
|
|
mx_RoomView_inCall: inCall,
|
|
|
|
});
|
|
|
|
|
2016-02-08 19:43:08 +03:00
|
|
|
return (
|
2019-12-17 20:26:12 +03:00
|
|
|
<RoomContext.Provider value={this.state}>
|
2020-04-14 17:24:41 +03:00
|
|
|
<main className={mainClasses} ref={this._roomView} onKeyDown={this.onReactKeyDown}>
|
2019-12-17 20:26:12 +03:00
|
|
|
<ErrorBoundary>
|
|
|
|
<RoomHeader
|
|
|
|
room={this.state.room}
|
|
|
|
searchInfo={searchInfo}
|
|
|
|
oobData={this.props.oobData}
|
|
|
|
inRoom={myMembership === 'join'}
|
|
|
|
onSearchClick={this.onSearchClick}
|
|
|
|
onSettingsClick={this.onSettingsClick}
|
|
|
|
onPinnedClick={this.onPinnedClick}
|
|
|
|
onCancelClick={(aux && !hideCancel) ? this.onCancelClick : null}
|
|
|
|
onForgetClick={(myMembership === "leave") ? this.onForgetClick : null}
|
|
|
|
onLeaveClick={(myMembership === "join") ? this.onLeaveClick : null}
|
|
|
|
e2eStatus={this.state.e2eStatus}
|
|
|
|
/>
|
|
|
|
<MainSplit
|
|
|
|
panel={rightPanel}
|
|
|
|
resizeNotifier={this.props.resizeNotifier}
|
|
|
|
>
|
|
|
|
<div className={fadableSectionClasses}>
|
|
|
|
{auxPanel}
|
2020-03-20 12:29:59 +03:00
|
|
|
<div className={timelineClasses}>
|
2019-12-17 20:26:12 +03:00
|
|
|
{topUnreadMessagesBar}
|
|
|
|
{jumpToBottom}
|
|
|
|
{messagePanel}
|
|
|
|
{searchResultsPanel}
|
2019-10-02 19:28:03 +03:00
|
|
|
</div>
|
2019-12-17 20:26:12 +03:00
|
|
|
<div className={statusBarAreaClass}>
|
|
|
|
<div className="mx_RoomView_statusAreaBox">
|
|
|
|
<div className="mx_RoomView_statusAreaBox_line" />
|
|
|
|
{statusBar}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{previewBar}
|
|
|
|
{messageComposer}
|
2018-10-30 20:13:17 +03:00
|
|
|
</div>
|
2019-12-17 20:26:12 +03:00
|
|
|
</MainSplit>
|
|
|
|
</ErrorBoundary>
|
|
|
|
</main>
|
|
|
|
</RoomContext.Provider>
|
2016-02-08 19:43:08 +03:00
|
|
|
);
|
2015-11-30 20:15:57 +03:00
|
|
|
},
|
|
|
|
});
|