2015-11-30 17:15:57 +00:00
|
|
|
/*
|
2016-01-07 04:06:39 +00:00
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
2017-02-17 11:44:56 +00:00
|
|
|
Copyright 2017 Vector Creations Ltd
|
2015-11-30 17:15:57 +00:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TODO: This component is enormous! There's several things which could stand-alone:
|
|
|
|
// - Search results component
|
|
|
|
// - Drag and drop
|
|
|
|
// - File uploading - uploadFile()
|
|
|
|
|
2017-08-28 12:46:09 +00:00
|
|
|
import shouldHideEvent from "../../shouldHideEvent";
|
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const React = require("react");
|
|
|
|
const ReactDOM = require("react-dom");
|
2017-12-26 01:03:18 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2017-07-12 12:58:14 +00:00
|
|
|
import Promise from 'bluebird';
|
2017-10-11 16:56:17 +00:00
|
|
|
const classNames = require("classnames");
|
2017-05-25 10:39:08 +00:00
|
|
|
import { _t } from '../../languageHandler';
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const MatrixClientPeg = require("../../MatrixClientPeg");
|
|
|
|
const ContentMessages = require("../../ContentMessages");
|
|
|
|
const Modal = require("../../Modal");
|
|
|
|
const sdk = require('../../index');
|
|
|
|
const CallHandler = require('../../CallHandler');
|
|
|
|
const dis = require("../../dispatcher");
|
|
|
|
const Tinter = require("../../Tinter");
|
|
|
|
const rate_limited_func = require('../../ratelimitedfunc');
|
|
|
|
const ObjectUtils = require('../../ObjectUtils');
|
|
|
|
const Rooms = require('../../Rooms');
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2017-12-01 10:44:00 +00:00
|
|
|
import { KeyCode, isOnlyCtrlOrCmdKeyEvent } from '../../Keyboard';
|
2016-10-17 13:03:37 +00:00
|
|
|
|
2017-05-24 15:56:13 +00:00
|
|
|
import RoomViewStore from '../../stores/RoomViewStore';
|
2017-09-07 16:08:36 +00:00
|
|
|
import RoomScrollStateStore from '../../stores/RoomScrollStateStore';
|
2017-10-29 07:43:52 +00:00
|
|
|
import SettingsStore from "../../settings/SettingsStore";
|
2017-05-24 15:56:13 +00:00
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const DEBUG = false;
|
2017-06-27 16:39:29 +00:00
|
|
|
let debuglog = function() {};
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2017-07-12 09:21:43 +00:00
|
|
|
const BROWSER_SUPPORTS_SANDBOX = 'sandbox' in document.createElement('iframe');
|
|
|
|
|
2016-02-10 18:27:40 +00:00
|
|
|
if (DEBUG) {
|
2016-01-04 16:28:32 +00:00
|
|
|
// using bind means that we get to keep useful line numbers in the console
|
2017-06-27 16:39:29 +00:00
|
|
|
debuglog = console.log.bind(console);
|
2016-01-04 16:28:32 +00:00
|
|
|
}
|
|
|
|
|
2015-11-30 17:15:57 +00:00
|
|
|
module.exports = React.createClass({
|
|
|
|
displayName: 'RoomView',
|
|
|
|
propTypes: {
|
2017-12-26 01:03:18 +00:00
|
|
|
ConferenceHandler: PropTypes.any,
|
2016-02-03 15:18:18 +00:00
|
|
|
|
2017-04-28 12:22:55 +00:00
|
|
|
// Called with the credentials of a registered user (if they were a ROU that
|
|
|
|
// transitioned to PWLU)
|
2017-12-26 01:03:18 +00:00
|
|
|
onRegistered: PropTypes.func,
|
2016-06-14 11:56:37 +00:00
|
|
|
|
2016-03-17 18:38:25 +00: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 01:03:18 +00:00
|
|
|
thirdPartyInvite: PropTypes.object,
|
2016-02-23 10:15:07 +00:00
|
|
|
|
2016-03-01 18:23:57 +00:00
|
|
|
// Any data about the room that would normally come from the Home Server
|
|
|
|
// 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 11:51:47 +00:00
|
|
|
// Fields:
|
|
|
|
// * name (string) The room's name
|
|
|
|
// * avatarUrl (string) The mxc:// avatar URL for the room
|
2016-03-02 14:04:51 +00:00
|
|
|
// * inviterName (string) The display name of the person who
|
|
|
|
// * invited us tovthe room
|
2017-12-26 01:03:18 +00:00
|
|
|
oobData: PropTypes.object,
|
2016-03-01 18:23:57 +00:00
|
|
|
|
2016-04-15 17:45:40 +00:00
|
|
|
// is the RightPanel collapsed?
|
2017-12-26 01:03:18 +00:00
|
|
|
collapsedRhs: PropTypes.bool,
|
2015-11-30 17:15:57 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
getInitialState: function() {
|
|
|
|
return {
|
2016-06-14 13:38:45 +00:00
|
|
|
room: null,
|
|
|
|
roomId: null,
|
|
|
|
roomLoading: true,
|
2017-06-05 08:52:39 +00:00
|
|
|
peekLoading: false,
|
2017-06-16 17:24:07 +00:00
|
|
|
shouldPeek: true,
|
2017-04-21 11:56:59 +00:00
|
|
|
|
2017-06-08 14:37:30 +00:00
|
|
|
// The event to be scrolled to initially
|
2017-06-08 16:26:08 +00:00
|
|
|
initialEventId: null,
|
2017-06-08 14:37:30 +00:00
|
|
|
// The offset in pixels from the event with which to scroll vertically
|
2017-06-08 16:26:08 +00:00
|
|
|
initialEventPixelOffset: null,
|
2017-06-08 14:37:30 +00:00
|
|
|
// Whether to highlight the event scrolled to
|
2017-06-08 16:26:08 +00:00
|
|
|
isInitialEventHighlighted: null,
|
2017-04-21 11:56:59 +00:00
|
|
|
|
2017-05-19 00:29:11 +00:00
|
|
|
forwardingEvent: null,
|
2015-11-30 17:15:57 +00:00
|
|
|
editingRoomSettings: false,
|
|
|
|
uploadingRoomSettings: false,
|
|
|
|
numUnreadMessages: 0,
|
|
|
|
draggingFile: false,
|
|
|
|
searching: false,
|
|
|
|
searchResults: null,
|
2015-12-14 23:37:34 +00:00
|
|
|
callState: null,
|
2016-01-13 13:22:58 +00:00
|
|
|
guestsCanJoin: false,
|
2016-01-18 17:39:23 +00:00
|
|
|
canPeek: false,
|
2017-05-17 20:15:57 +00:00
|
|
|
showApps: false,
|
2017-10-12 03:15:00 +00:00
|
|
|
isAlone: false,
|
2017-10-12 00:43:24 +00:00
|
|
|
isPeeking: false,
|
2016-02-03 08:03:10 +00:00
|
|
|
|
2016-06-28 16:11:47 +00:00
|
|
|
// error object, as from the matrix client/server API
|
2016-06-28 13:59:45 +00:00
|
|
|
// If we failed to load information about the room,
|
|
|
|
// store the error here.
|
2016-06-24 14:34:07 +00:00
|
|
|
roomLoadError: null,
|
2016-02-03 08:03:10 +00:00
|
|
|
|
2017-09-15 14:07:09 +00:00
|
|
|
// Have we sent a request to join the room that we're waiting to complete?
|
|
|
|
joining: false,
|
|
|
|
|
2016-02-03 08:03:10 +00: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,
|
2016-02-23 15:46:27 +00:00
|
|
|
|
2016-02-24 17:26:34 +00:00
|
|
|
showTopUnreadMessagesBar: false,
|
|
|
|
|
2016-02-23 15:46:27 +00:00
|
|
|
auxPanelMaxHeight: undefined,
|
2017-01-23 15:01:39 +00:00
|
|
|
|
|
|
|
statusBarVisible: false,
|
2017-01-20 14:22:27 +00:00
|
|
|
};
|
2015-11-30 17:15:57 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
componentWillMount: function() {
|
2016-07-15 15:14:05 +00:00
|
|
|
this.dispatcherRef = dis.register(this.onAction);
|
|
|
|
MatrixClientPeg.get().on("Room", this.onRoom);
|
|
|
|
MatrixClientPeg.get().on("Room.timeline", this.onRoomTimeline);
|
2017-02-17 11:44:56 +00:00
|
|
|
MatrixClientPeg.get().on("Room.name", this.onRoomName);
|
2016-07-15 15:14:05 +00:00
|
|
|
MatrixClientPeg.get().on("Room.accountData", this.onRoomAccountData);
|
|
|
|
MatrixClientPeg.get().on("RoomState.members", this.onRoomStateMember);
|
2017-02-17 15:50:30 +00:00
|
|
|
MatrixClientPeg.get().on("RoomMember.membership", this.onRoomMemberMembership);
|
2016-07-20 17:14:16 +00:00
|
|
|
MatrixClientPeg.get().on("accountData", this.onAccountData);
|
2016-07-15 15:14:05 +00:00
|
|
|
|
2017-05-24 15:56:13 +00:00
|
|
|
// Start listening for RoomViewStore updates
|
2017-06-01 17:01:30 +00:00
|
|
|
this._roomStoreToken = RoomViewStore.addListener(this._onRoomViewStoreUpdate);
|
2017-05-24 15:56:13 +00:00
|
|
|
this._onRoomViewStoreUpdate(true);
|
|
|
|
},
|
|
|
|
|
|
|
|
_onRoomViewStoreUpdate: function(initial) {
|
|
|
|
if (this.unmounted) {
|
|
|
|
return;
|
2016-06-14 10:37:04 +00:00
|
|
|
}
|
2017-09-11 16:57:52 +00:00
|
|
|
|
|
|
|
if (!initial && this.state.roomId !== RoomViewStore.getRoomId()) {
|
|
|
|
// 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 17:39:30 +00: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 16:57:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-06-08 13:17:49 +00:00
|
|
|
const newState = {
|
2017-05-24 15:56:13 +00:00
|
|
|
roomId: RoomViewStore.getRoomId(),
|
|
|
|
roomAlias: RoomViewStore.getRoomAlias(),
|
2017-06-01 17:01:30 +00:00
|
|
|
roomLoading: RoomViewStore.isRoomLoading(),
|
|
|
|
roomLoadError: RoomViewStore.getRoomLoadError(),
|
2017-05-24 15:56:13 +00:00
|
|
|
joining: RoomViewStore.isJoining(),
|
2017-06-08 14:47:41 +00:00
|
|
|
initialEventId: RoomViewStore.getInitialEventId(),
|
|
|
|
isInitialEventHighlighted: RoomViewStore.isInitialEventHighlighted(),
|
2017-06-16 15:12:52 +00:00
|
|
|
forwardingEvent: RoomViewStore.getForwardingEvent(),
|
2017-06-16 17:24:07 +00:00
|
|
|
shouldPeek: RoomViewStore.shouldPeek(),
|
2017-06-08 13:17:49 +00:00
|
|
|
};
|
|
|
|
|
2017-06-14 15:53:21 +00:00
|
|
|
// Temporary logging to diagnose https://github.com/vector-im/riot-web/issues/4307
|
|
|
|
console.log(
|
|
|
|
'RVS update:',
|
|
|
|
newState.roomId,
|
|
|
|
newState.roomAlias,
|
|
|
|
'loading?', newState.roomLoading,
|
|
|
|
'joining?', newState.joining,
|
2017-06-16 17:24:07 +00:00
|
|
|
'initial?', initial,
|
|
|
|
'shouldPeek?', newState.shouldPeek,
|
2017-06-14 15:53:21 +00:00
|
|
|
);
|
|
|
|
|
2017-06-14 15:48:34 +00:00
|
|
|
// NB: This does assume that the roomID will not change for the lifetime of
|
|
|
|
// the RoomView instance
|
|
|
|
if (initial) {
|
|
|
|
newState.room = MatrixClientPeg.get().getRoom(newState.roomId);
|
2017-09-08 17:11:13 +00:00
|
|
|
if (newState.room) {
|
|
|
|
newState.showApps = this._shouldShowApps(newState.room);
|
|
|
|
this._onRoomLoaded(newState.room);
|
|
|
|
}
|
2017-06-14 15:48:34 +00:00
|
|
|
}
|
|
|
|
|
2017-09-08 12:39:22 +00:00
|
|
|
if (this.state.roomId === null && newState.roomId !== null) {
|
|
|
|
// Get the scroll state for the new room
|
2017-09-07 16:08:36 +00:00
|
|
|
|
|
|
|
// If an event ID wasn't specified, default to the one saved for this room
|
2017-09-07 16:16:32 +00:00
|
|
|
// in the scroll state store. Assume initialEventPixelOffset should be set.
|
2017-09-07 16:08:36 +00:00
|
|
|
if (!newState.initialEventId) {
|
|
|
|
const roomScrollState = RoomScrollStateStore.getScrollState(newState.roomId);
|
|
|
|
if (roomScrollState) {
|
|
|
|
newState.initialEventId = roomScrollState.focussedEvent;
|
|
|
|
newState.initialEventPixelOffset = roomScrollState.pixelOffset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-08 14:38:58 +00:00
|
|
|
// Clear the search results when clicking a search result (which changes the
|
2017-06-08 14:47:41 +00:00
|
|
|
// currently scrolled to event, this.state.initialEventId).
|
|
|
|
if (this.state.initialEventId !== newState.initialEventId) {
|
2017-06-08 13:17:49 +00:00
|
|
|
newState.searchResults = null;
|
|
|
|
}
|
|
|
|
|
2017-09-08 16:06:46 +00: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 16:39:10 +00:00
|
|
|
|
2017-09-08 16:06:46 +00: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 17:11:13 +00:00
|
|
|
this._setupRoom(newState.room, newState.roomId, newState.joining, newState.shouldPeek);
|
2017-09-08 16:06:46 +00:00
|
|
|
}
|
2016-06-14 10:37:04 +00:00
|
|
|
},
|
|
|
|
|
2017-09-08 17:11:13 +00:00
|
|
|
_setupRoom: function(room, roomId, joining, shouldPeek) {
|
2016-01-07 16:22:17 +00:00
|
|
|
// if this is an unknown room then we're in one of three states:
|
|
|
|
// - This is a room we can peek into (search engine) (we can /peek)
|
|
|
|
// - This is a room we can publicly join or were invited to. (we can /join)
|
|
|
|
// - This is a room we cannot join at all. (no action can help us)
|
|
|
|
// We can't try to /join because this may implicitly accept invites (!)
|
|
|
|
// We can /peek though. If it fails then we present the join UI. If it
|
|
|
|
// succeeds then great, show the preview (but we still may be able to /join!).
|
2016-06-14 10:37:04 +00:00
|
|
|
// Note that peeking works by room ID and room ID only, as opposed to joining
|
|
|
|
// which must be by alias or invite wherever possible (peeking currently does
|
|
|
|
// not work over federation).
|
2016-01-27 07:54:15 +00:00
|
|
|
|
2017-06-15 10:49:16 +00: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 16:56:53 +00:00
|
|
|
if (!joining && roomId) {
|
2016-06-20 15:30:51 +00:00
|
|
|
if (this.props.autoJoin) {
|
|
|
|
this.onJoinButtonClicked();
|
2017-09-08 16:56:53 +00:00
|
|
|
} else if (!room && shouldPeek) {
|
|
|
|
console.log("Attempting to peek into room %s", roomId);
|
2017-06-05 08:52:39 +00:00
|
|
|
this.setState({
|
|
|
|
peekLoading: true,
|
2017-10-12 00:43:24 +00:00
|
|
|
isPeeking: true, // this will change to false if peeking fails
|
2017-06-05 08:52:39 +00:00
|
|
|
});
|
2017-09-08 16:56:53 +00:00
|
|
|
MatrixClientPeg.get().peekInRoom(roomId).then((room) => {
|
2016-02-10 18:27:40 +00:00
|
|
|
this.setState({
|
2016-06-20 15:30:51 +00:00
|
|
|
room: room,
|
2017-06-05 08:52:39 +00:00
|
|
|
peekLoading: false,
|
2016-02-10 18:27:40 +00:00
|
|
|
});
|
2016-06-20 15:30:51 +00:00
|
|
|
this._onRoomLoaded(room);
|
|
|
|
}, (err) => {
|
2017-10-12 13:24:20 +00:00
|
|
|
// Stop peeking if anything went wrong
|
|
|
|
this.setState({
|
|
|
|
isPeeking: false,
|
|
|
|
});
|
2017-10-25 10:09:48 +00:00
|
|
|
|
2016-06-20 15:30:51 +00: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.
|
|
|
|
if (err.errcode == "M_GUEST_ACCESS_FORBIDDEN") {
|
|
|
|
// This is fine: the room just isn't peekable (we assume).
|
|
|
|
this.setState({
|
2017-06-05 08:52:39 +00:00
|
|
|
peekLoading: false,
|
2016-06-20 15:30:51 +00:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
throw err;
|
|
|
|
}
|
|
|
|
}).done();
|
|
|
|
}
|
2017-06-15 13:21:23 +00:00
|
|
|
} else if (room) {
|
|
|
|
// Stop peeking because we have joined this room previously
|
2016-03-18 19:23:30 +00:00
|
|
|
MatrixClientPeg.get().stopPeeking();
|
2017-10-12 00:43:24 +00:00
|
|
|
this.setState({isPeeking: false});
|
2016-02-10 18:27:40 +00:00
|
|
|
}
|
2015-11-30 17:15:57 +00:00
|
|
|
},
|
|
|
|
|
2017-06-13 13:19:06 +00:00
|
|
|
_shouldShowApps: function(room) {
|
2017-07-12 09:21:43 +00:00
|
|
|
if (!BROWSER_SUPPORTS_SANDBOX) return false;
|
|
|
|
|
2017-10-26 18:17:13 +00:00
|
|
|
// Check if user has previously chosen to hide the app drawer for this
|
|
|
|
// room. If so, do not show apps
|
2017-11-16 13:19:36 +00:00
|
|
|
const hideWidgetDrawer = localStorage.getItem(
|
2017-10-26 18:17:13 +00:00
|
|
|
room.roomId + "_hide_widget_drawer");
|
2017-10-24 23:21:46 +00:00
|
|
|
|
2017-10-26 18:17:13 +00:00
|
|
|
if (hideWidgetDrawer === "true") {
|
2017-10-24 23:21:46 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-07-11 11:15:27 +00:00
|
|
|
const appsStateEvents = room.currentState.getStateEvents('im.vector.modular.widgets');
|
|
|
|
// any valid widget = show apps
|
|
|
|
for (let i = 0; i < appsStateEvents.length; i++) {
|
|
|
|
if (appsStateEvents[i].getContent().type && appsStateEvents[i].getContent().url) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2017-06-13 13:19:06 +00:00
|
|
|
},
|
|
|
|
|
2016-10-17 13:03:37 +00:00
|
|
|
componentDidMount: function() {
|
2017-10-11 16:56:17 +00:00
|
|
|
const call = this._getCallForRoom();
|
|
|
|
const callState = call ? call.call_state : "ended";
|
2016-10-17 13:03:37 +00:00
|
|
|
this.setState({
|
2017-10-11 16:56:17 +00:00
|
|
|
callState: callState,
|
2016-10-17 13:03:37 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
this._updateConfCallNotification();
|
|
|
|
|
2017-04-29 05:25:30 +00:00
|
|
|
window.addEventListener('beforeunload', this.onPageUnload);
|
2016-10-17 13:03:37 +00:00
|
|
|
window.addEventListener('resize', this.onResize);
|
|
|
|
this.onResize();
|
|
|
|
|
|
|
|
document.addEventListener("keydown", this.onKeyDown);
|
|
|
|
|
|
|
|
// XXX: EVIL HACK to autofocus inviting on empty rooms.
|
|
|
|
// We use the setTimeout to avoid racing with focus_composer.
|
|
|
|
if (this.state.room &&
|
|
|
|
this.state.room.getJoinedMembers().length == 1 &&
|
|
|
|
this.state.room.getLiveTimeline() &&
|
|
|
|
this.state.room.getLiveTimeline().getEvents() &&
|
2017-10-11 16:56:17 +00:00
|
|
|
this.state.room.getLiveTimeline().getEvents().length <= 6) {
|
|
|
|
const inviteBox = document.getElementById("mx_SearchableEntityList_query");
|
2016-10-17 13:03:37 +00:00
|
|
|
setTimeout(function() {
|
|
|
|
if (inviteBox) {
|
|
|
|
inviteBox.focus();
|
|
|
|
}
|
|
|
|
}, 50);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-03-07 22:27:35 +00:00
|
|
|
shouldComponentUpdate: function(nextProps, nextState) {
|
|
|
|
return (!ObjectUtils.shallowEqual(this.props, nextProps) ||
|
|
|
|
!ObjectUtils.shallowEqual(this.state, nextState));
|
|
|
|
},
|
|
|
|
|
2016-10-17 13:03:37 +00:00
|
|
|
componentDidUpdate: function() {
|
|
|
|
if (this.refs.roomView) {
|
2017-10-11 16:56:17 +00:00
|
|
|
const roomView = ReactDOM.findDOMNode(this.refs.roomView);
|
2016-10-17 13:03:37 +00:00
|
|
|
if (!roomView.ondrop) {
|
|
|
|
roomView.addEventListener('drop', this.onDrop);
|
|
|
|
roomView.addEventListener('dragover', this.onDragOver);
|
|
|
|
roomView.addEventListener('dragleave', this.onDragLeaveOrEnd);
|
|
|
|
roomView.addEventListener('dragend', this.onDragLeaveOrEnd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-11-30 17:15:57 +00:00
|
|
|
componentWillUnmount: function() {
|
2016-01-11 11:38:04 +00:00
|
|
|
// set a boolean to say we've been unmounted, which any pending
|
|
|
|
// promises can use to throw away their results.
|
|
|
|
//
|
|
|
|
// (We could use isMounted, but facebook have deprecated that.)
|
|
|
|
this.unmounted = true;
|
|
|
|
|
2016-11-04 09:28:35 +00:00
|
|
|
// update the scroll map before we get unmounted
|
2017-09-08 12:39:22 +00:00
|
|
|
if (this.state.roomId) {
|
|
|
|
RoomScrollStateStore.setScrollState(this.state.roomId, this._getScrollState());
|
|
|
|
}
|
2016-11-04 09:28:35 +00:00
|
|
|
|
2016-01-15 15:23:02 +00:00
|
|
|
if (this.refs.roomView) {
|
|
|
|
// disconnect the D&D event listeners from the room view. This
|
|
|
|
// is really just for hygiene - we're going to be
|
2015-12-18 10:19:07 +00:00
|
|
|
// deleted anyway, so it doesn't matter if the event listeners
|
|
|
|
// don't get cleaned up.
|
2017-10-11 16:56:17 +00:00
|
|
|
const roomView = ReactDOM.findDOMNode(this.refs.roomView);
|
2016-01-15 15:23:02 +00:00
|
|
|
roomView.removeEventListener('drop', this.onDrop);
|
|
|
|
roomView.removeEventListener('dragover', this.onDragOver);
|
|
|
|
roomView.removeEventListener('dragleave', this.onDragLeaveOrEnd);
|
|
|
|
roomView.removeEventListener('dragend', this.onDragLeaveOrEnd);
|
2015-11-30 17:15:57 +00:00
|
|
|
}
|
|
|
|
dis.unregister(this.dispatcherRef);
|
|
|
|
if (MatrixClientPeg.get()) {
|
2016-02-04 13:06:59 +00:00
|
|
|
MatrixClientPeg.get().removeListener("Room", this.onRoom);
|
2015-11-30 17:15:57 +00:00
|
|
|
MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline);
|
2017-02-17 11:44:56 +00:00
|
|
|
MatrixClientPeg.get().removeListener("Room.name", this.onRoomName);
|
2016-01-08 03:22:38 +00:00
|
|
|
MatrixClientPeg.get().removeListener("Room.accountData", this.onRoomAccountData);
|
2015-11-30 17:15:57 +00:00
|
|
|
MatrixClientPeg.get().removeListener("RoomState.members", this.onRoomStateMember);
|
2017-02-17 15:50:30 +00:00
|
|
|
MatrixClientPeg.get().removeListener("RoomMember.membership", this.onRoomMemberMembership);
|
2016-07-21 12:49:31 +00:00
|
|
|
MatrixClientPeg.get().removeListener("accountData", this.onAccountData);
|
2015-11-30 17:15:57 +00:00
|
|
|
}
|
2015-12-13 04:32:48 +00:00
|
|
|
|
2017-04-29 05:25:30 +00:00
|
|
|
window.removeEventListener('beforeunload', this.onPageUnload);
|
2016-04-22 16:05:48 +00:00
|
|
|
window.removeEventListener('resize', this.onResize);
|
2016-01-08 03:22:38 +00:00
|
|
|
|
2016-10-17 13:03:37 +00:00
|
|
|
document.removeEventListener("keydown", this.onKeyDown);
|
|
|
|
|
2017-06-01 17:01:30 +00:00
|
|
|
// Remove RoomStore listener
|
|
|
|
if (this._roomStoreToken) {
|
|
|
|
this._roomStoreToken.remove();
|
|
|
|
}
|
|
|
|
|
2016-08-10 12:39:47 +00:00
|
|
|
// cancel any pending calls to the rate_limited_funcs
|
|
|
|
this._updateRoomMembers.cancelPendingCall();
|
|
|
|
|
2016-04-16 00:00:10 +00: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
|
2015-11-30 17:15:57 +00:00
|
|
|
},
|
|
|
|
|
2017-04-29 05:25:30 +00:00
|
|
|
onPageUnload(event) {
|
|
|
|
if (ContentMessages.getCurrentUploads().length > 0) {
|
|
|
|
return event.returnValue =
|
2017-05-23 14:16:31 +00:00
|
|
|
_t("You seem to be uploading files, are you sure you want to quit?");
|
2017-05-03 15:36:57 +00:00
|
|
|
} else if (this._getCallForRoom() && this.state.callState !== 'ended') {
|
|
|
|
return event.returnValue =
|
2017-05-23 14:16:31 +00:00
|
|
|
_t("You seem to be in a call, are you sure you want to quit?");
|
2017-04-29 05:25:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
|
2016-10-17 13:03:37 +00:00
|
|
|
onKeyDown: function(ev) {
|
2016-11-08 18:04:22 +00:00
|
|
|
let handled = false;
|
2017-12-01 10:44:00 +00:00
|
|
|
const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev);
|
2016-10-17 13:03:37 +00:00
|
|
|
|
|
|
|
switch (ev.keyCode) {
|
|
|
|
case KeyCode.KEY_D:
|
2016-11-08 18:04:22 +00:00
|
|
|
if (ctrlCmdOnly) {
|
2016-10-17 13:03:37 +00:00
|
|
|
this.onMuteAudioClick();
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KeyCode.KEY_E:
|
2016-11-08 18:04:22 +00:00
|
|
|
if (ctrlCmdOnly) {
|
2016-10-17 13:03:37 +00:00
|
|
|
this.onMuteVideoClick();
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (handled) {
|
|
|
|
ev.stopPropagation();
|
|
|
|
ev.preventDefault();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-11-30 17:15:57 +00:00
|
|
|
onAction: function(payload) {
|
|
|
|
switch (payload.action) {
|
|
|
|
case 'message_send_failed':
|
|
|
|
case 'message_sent':
|
2017-10-12 03:15:00 +00:00
|
|
|
this._checkIfAlone(this.state.room);
|
2015-11-30 17:15:57 +00:00
|
|
|
break;
|
|
|
|
case 'notifier_enabled':
|
2015-12-02 18:16:16 +00:00
|
|
|
case 'upload_failed':
|
|
|
|
case 'upload_started':
|
|
|
|
case 'upload_finished':
|
2015-11-30 17:15:57 +00:00
|
|
|
this.forceUpdate();
|
|
|
|
break;
|
|
|
|
case 'call_state':
|
2015-12-14 23:37:34 +00: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 18:25:07 +00:00
|
|
|
var call = this._getCallForRoom();
|
2015-12-14 23:37:34 +00:00
|
|
|
var callState;
|
|
|
|
|
|
|
|
if (call) {
|
|
|
|
callState = call.call_state;
|
2017-10-11 16:56:17 +00:00
|
|
|
} else {
|
2015-12-14 23:37:34 +00:00
|
|
|
callState = "ended";
|
2015-11-30 17:15:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// possibly remove the conf call notification if we're now in
|
|
|
|
// the conf
|
|
|
|
this._updateConfCallNotification();
|
2015-12-14 23:37:34 +00:00
|
|
|
|
|
|
|
this.setState({
|
2017-05-17 20:15:57 +00:00
|
|
|
callState: callState,
|
2015-12-14 23:37:34 +00:00
|
|
|
});
|
|
|
|
|
2017-05-17 20:15:57 +00:00
|
|
|
break;
|
|
|
|
case 'appsDrawer':
|
|
|
|
this.setState({
|
2017-06-28 11:21:05 +00:00
|
|
|
showApps: payload.show,
|
2017-05-17 20:15:57 +00:00
|
|
|
});
|
2015-11-30 17:15:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-01-27 07:54:15 +00:00
|
|
|
onRoomTimeline: function(ev, room, toStartOfTimeline, removed, data) {
|
2016-01-11 11:38:04 +00:00
|
|
|
if (this.unmounted) return;
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2016-01-27 07:54:15 +00:00
|
|
|
// ignore events for other rooms
|
2016-09-09 01:09:12 +00:00
|
|
|
if (!room) return;
|
2016-04-12 18:25:07 +00:00
|
|
|
if (!this.state.room || room.roomId != this.state.room.roomId) return;
|
2016-01-27 07:54:15 +00:00
|
|
|
|
2016-09-08 21:48:44 +00:00
|
|
|
// ignore events from filtered timelines
|
|
|
|
if (data.timeline.getTimelineSet() !== room.getUnfilteredTimelineSet()) return;
|
|
|
|
|
2016-07-18 09:47:03 +00:00
|
|
|
if (ev.getType() === "org.matrix.room.preview_urls") {
|
|
|
|
this._updatePreviewUrlVisibility(room);
|
2016-07-18 00:35:42 +00:00
|
|
|
}
|
|
|
|
|
2016-01-27 07:54:15 +00:00
|
|
|
// ignore anything but real-time updates at the end of the room:
|
|
|
|
// updates from pagination will happen when the paginate completes.
|
|
|
|
if (toStartOfTimeline || !data || !data.liveEvent) return;
|
2015-11-30 17:15:57 +00:00
|
|
|
|
|
|
|
// no point handling anything while we're waiting for the join to finish:
|
|
|
|
// we'll only be showing a spinner.
|
|
|
|
if (this.state.joining) return;
|
|
|
|
|
2016-01-27 07:54:15 +00:00
|
|
|
if (ev.getSender() !== MatrixClientPeg.get().credentials.userId) {
|
2015-11-30 17:15:57 +00:00
|
|
|
// update unread count when scrolled up
|
2016-02-03 08:03:10 +00:00
|
|
|
if (!this.state.searchResults && this.state.atEndOfLiveTimeline) {
|
2016-01-27 07:54:15 +00:00
|
|
|
// no change
|
2017-10-29 07:43:52 +00:00
|
|
|
} else if (!shouldHideEvent(ev)) {
|
2016-04-18 00:34:45 +00:00
|
|
|
this.setState((state, props) => {
|
2016-01-27 07:54:15 +00:00
|
|
|
return {numUnreadMessages: state.numUnreadMessages + 1};
|
|
|
|
});
|
2015-11-30 17:15:57 +00:00
|
|
|
}
|
|
|
|
}
|
2016-01-18 20:05:33 +00:00
|
|
|
},
|
2016-01-18 19:56:35 +00:00
|
|
|
|
2017-02-17 11:44:56 +00:00
|
|
|
onRoomName: function(room) {
|
|
|
|
if (this.state.room && room.roomId == this.state.room.roomId) {
|
|
|
|
this.forceUpdate();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-03-22 15:06:52 +00:00
|
|
|
canResetTimeline: function() {
|
|
|
|
if (!this.refs.messagePanel) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return this.refs.messagePanel.canResetTimeline();
|
|
|
|
},
|
|
|
|
|
2016-02-10 18:27:40 +00:00
|
|
|
// called when state.room is first initialised (either at initial load,
|
|
|
|
// after a successful peek, or after we join the room).
|
|
|
|
_onRoomLoaded: function(room) {
|
2017-03-01 15:41:13 +00:00
|
|
|
this._warnAboutEncryption(room);
|
2016-02-10 18:27:40 +00:00
|
|
|
this._calculatePeekRules(room);
|
2016-07-20 11:03:13 +00:00
|
|
|
this._updatePreviewUrlVisibility(room);
|
2016-02-16 16:05:27 +00:00
|
|
|
},
|
|
|
|
|
2017-05-24 15:56:13 +00:00
|
|
|
_warnAboutEncryption: function(room) {
|
2017-03-01 15:41:13 +00:00
|
|
|
if (!MatrixClientPeg.get().isRoomEncrypted(room.roomId)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
let userHasUsedEncryption = false;
|
|
|
|
if (localStorage) {
|
|
|
|
userHasUsedEncryption = localStorage.getItem('mx_user_has_used_encryption');
|
|
|
|
}
|
|
|
|
if (!userHasUsedEncryption) {
|
2017-03-01 15:55:15 +00:00
|
|
|
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
2017-07-27 16:19:18 +00:00
|
|
|
Modal.createTrackedDialog('E2E Warning', '', QuestionDialog, {
|
2017-05-25 17:20:48 +00:00
|
|
|
title: _t("Warning!"),
|
2017-03-01 15:41:13 +00:00
|
|
|
hasCancelButton: false,
|
|
|
|
description: (
|
|
|
|
<div>
|
2017-05-23 14:16:31 +00:00
|
|
|
<p>{ _t("End-to-end encryption is in beta and may not be reliable") }.</p>
|
2017-05-25 19:04:28 +00:00
|
|
|
<p>{ _t("You should not yet trust it to secure data") }.</p>
|
|
|
|
<p>{ _t("Devices will not yet be able to decrypt history from before they joined the room") }.</p>
|
2017-05-23 14:16:31 +00:00
|
|
|
<p>{ _t("Encrypted messages will not be visible on clients that do not yet implement encryption") }.</p>
|
2017-03-01 15:41:13 +00:00
|
|
|
</div>
|
|
|
|
),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (localStorage) {
|
|
|
|
localStorage.setItem('mx_user_has_used_encryption', true);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-01-18 20:05:33 +00:00
|
|
|
_calculatePeekRules: function(room) {
|
2017-10-11 16:56:17 +00:00
|
|
|
const guestAccessEvent = room.currentState.getStateEvents("m.room.guest_access", "");
|
2016-01-18 20:05:33 +00:00
|
|
|
if (guestAccessEvent && guestAccessEvent.getContent().guest_access === "can_join") {
|
|
|
|
this.setState({
|
2017-10-11 16:56:17 +00:00
|
|
|
guestsCanJoin: true,
|
2016-01-18 20:05:33 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const historyVisibility = room.currentState.getStateEvents("m.room.history_visibility", "");
|
2016-01-18 20:05:33 +00:00
|
|
|
if (historyVisibility && historyVisibility.getContent().history_visibility === "world_readable") {
|
|
|
|
this.setState({
|
2017-10-11 16:56:17 +00:00
|
|
|
canPeek: true,
|
2016-01-18 20:05:33 +00:00
|
|
|
});
|
2016-01-18 17:39:23 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-07-18 00:35:42 +00:00
|
|
|
_updatePreviewUrlVisibility: function(room) {
|
|
|
|
this.setState({
|
2017-10-30 03:48:29 +00:00
|
|
|
showUrlPreview: SettingsStore.getValue("urlPreviewsEnabled", room.roomId),
|
2016-07-18 00:35:42 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-02-04 11:29:00 +00:00
|
|
|
onRoom: function(room) {
|
2017-05-24 15:56:13 +00:00
|
|
|
if (!room || room.roomId !== this.state.roomId) {
|
|
|
|
return;
|
2016-02-04 11:29:00 +00:00
|
|
|
}
|
2017-05-24 15:56:13 +00:00
|
|
|
this.setState({
|
|
|
|
room: room,
|
|
|
|
}, () => {
|
|
|
|
this._onRoomLoaded(room);
|
|
|
|
});
|
2016-02-04 11:29:00 +00:00
|
|
|
},
|
|
|
|
|
2016-01-08 03:22:38 +00:00
|
|
|
updateTint: function() {
|
2017-10-11 16:56:17 +00:00
|
|
|
const room = this.state.room;
|
2016-01-08 03:22:38 +00:00
|
|
|
if (!room) return;
|
|
|
|
|
2017-11-04 22:10:25 +00:00
|
|
|
const color_scheme = SettingsStore.getValue("roomColor", room.room_id);
|
2016-04-16 00:00:10 +00:00
|
|
|
console.log("Tinter.tint from updateTint");
|
2016-01-08 03:22:38 +00:00
|
|
|
Tinter.tint(color_scheme.primary_color, color_scheme.secondary_color);
|
|
|
|
},
|
|
|
|
|
2016-07-20 17:14:16 +00:00
|
|
|
onAccountData: function(event) {
|
|
|
|
if (event.getType() === "org.matrix.preview_urls" && this.state.room) {
|
|
|
|
this._updatePreviewUrlVisibility(this.state.room);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-07-20 11:03:13 +00:00
|
|
|
onRoomAccountData: function(event, room) {
|
|
|
|
if (room.roomId == this.state.roomId) {
|
2016-07-18 00:35:42 +00:00
|
|
|
if (event.getType() === "org.matrix.room.color_scheme") {
|
2017-10-11 16:56:17 +00:00
|
|
|
const color_scheme = event.getContent();
|
2016-01-08 03:22:38 +00:00
|
|
|
// XXX: we should validate the event
|
2016-04-16 00:00:10 +00:00
|
|
|
console.log("Tinter.tint from onRoomAccountData");
|
2016-01-08 03:22:38 +00:00
|
|
|
Tinter.tint(color_scheme.primary_color, color_scheme.secondary_color);
|
2017-10-11 16:56:17 +00:00
|
|
|
} else if (event.getType() === "org.matrix.room.preview_urls") {
|
2016-07-20 11:03:13 +00:00
|
|
|
this._updatePreviewUrlVisibility(room);
|
2016-07-18 00:35:42 +00:00
|
|
|
}
|
2016-01-08 03:22:38 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-07-26 17:15:26 +00:00
|
|
|
onRoomStateMember: function(ev, state, member) {
|
2016-04-12 18:25:07 +00:00
|
|
|
// ignore if we don't have a room yet
|
|
|
|
if (!this.state.room) {
|
|
|
|
return;
|
2015-12-22 15:38:23 +00:00
|
|
|
}
|
|
|
|
|
2016-04-12 18:25:07 +00:00
|
|
|
// ignore members in other rooms
|
|
|
|
if (member.roomId !== this.state.room.roomId) {
|
2015-11-30 17:15:57 +00:00
|
|
|
return;
|
|
|
|
}
|
2016-04-12 18:25:07 +00:00
|
|
|
|
2016-07-26 17:15:26 +00:00
|
|
|
this._updateRoomMembers();
|
|
|
|
},
|
|
|
|
|
2017-02-17 15:50:30 +00:00
|
|
|
onRoomMemberMembership: function(ev, member, oldMembership) {
|
|
|
|
if (member.userId == MatrixClientPeg.get().credentials.userId) {
|
2017-09-15 14:07:09 +00:00
|
|
|
this.forceUpdate();
|
2017-02-17 15:50:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-07-26 17:19:25 +00:00
|
|
|
// rate limited because a power level change will emit an event for every
|
|
|
|
// member in the room.
|
2016-07-26 17:15:26 +00:00
|
|
|
_updateRoomMembers: new rate_limited_func(function() {
|
2016-10-26 12:09:53 +00:00
|
|
|
// a member state changed in this room
|
2016-10-26 14:32:09 +00:00
|
|
|
// refresh the conf call notification state
|
2016-10-26 12:09:53 +00:00
|
|
|
this._updateConfCallNotification();
|
|
|
|
|
2016-04-12 18:25:07 +00:00
|
|
|
// if we are now a member of the room, where we were not before, that
|
|
|
|
// means we have finished joining a room we were previously peeking
|
|
|
|
// into.
|
2017-10-11 16:56:17 +00:00
|
|
|
const me = MatrixClientPeg.get().credentials.userId;
|
2016-04-12 18:25:07 +00:00
|
|
|
if (this.state.joining && this.state.room.hasMembershipState(me, "join")) {
|
2016-09-20 16:59:46 +00:00
|
|
|
// Having just joined a room, check to see if it looks like a DM room, and if so,
|
|
|
|
// mark it as one. This is to work around the fact that some clients don't support
|
|
|
|
// is_direct. We should remove this once they do.
|
|
|
|
const me = this.state.room.getMember(MatrixClientPeg.get().credentials.userId);
|
|
|
|
if (Rooms.looksLikeDirectMessageRoom(this.state.room, me)) {
|
|
|
|
// XXX: There's not a whole lot we can really do if this fails: at best
|
|
|
|
// perhaps we could try a couple more times, but since it's a temporary
|
|
|
|
// compatability workaround, let's not bother.
|
|
|
|
Rooms.setDMRoom(this.state.room.roomId, me.events.member.getSender()).done();
|
|
|
|
}
|
2016-04-12 18:25:07 +00:00
|
|
|
}
|
2016-07-26 16:58:19 +00:00
|
|
|
}, 500),
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2017-10-12 03:15:00 +00:00
|
|
|
_checkIfAlone: function(room) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2017-11-16 13:19:36 +00:00
|
|
|
const joinedMembers = room.currentState.getMembers().filter((m) => m.membership === "join" || m.membership === "invite");
|
2017-10-12 03:15:00 +00:00
|
|
|
this.setState({isAlone: joinedMembers.length === 1});
|
|
|
|
},
|
|
|
|
|
2015-11-30 17:15:57 +00:00
|
|
|
_updateConfCallNotification: function() {
|
2017-10-11 16:56:17 +00:00
|
|
|
const room = this.state.room;
|
2015-11-30 17:15:57 +00:00
|
|
|
if (!room || !this.props.ConferenceHandler) {
|
|
|
|
return;
|
|
|
|
}
|
2017-10-11 16:56:17 +00:00
|
|
|
const confMember = room.getMember(
|
|
|
|
this.props.ConferenceHandler.getConferenceUserIdForRoom(room.roomId),
|
2015-11-30 17:15:57 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
if (!confMember) {
|
|
|
|
return;
|
|
|
|
}
|
2017-10-11 16:56:17 +00:00
|
|
|
const confCall = this.props.ConferenceHandler.getConferenceCallForRoom(confMember.roomId);
|
2015-11-30 17:15:57 +00: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 16:56:17 +00:00
|
|
|
),
|
2015-11-30 17:15:57 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-03-24 00:13:32 +00:00
|
|
|
onSearchResultsResize: function() {
|
2016-03-24 02:14:16 +00:00
|
|
|
dis.dispatch({ action: 'timeline_resize' }, true);
|
2016-03-24 00:13:32 +00:00
|
|
|
},
|
|
|
|
|
2015-12-22 15:18:50 +00:00
|
|
|
onSearchResultsFillRequest: function(backwards) {
|
2017-01-20 14:22:27 +00:00
|
|
|
if (!backwards) {
|
2017-07-12 13:02:00 +00:00
|
|
|
return Promise.resolve(false);
|
2017-01-20 14:22:27 +00:00
|
|
|
}
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2015-12-22 18:15:32 +00:00
|
|
|
if (this.state.searchResults.next_batch) {
|
2016-01-04 16:28:32 +00:00
|
|
|
debuglog("requesting more search results");
|
2017-10-11 16:56:17 +00:00
|
|
|
const searchPromise = MatrixClientPeg.get().backPaginateRoomEventsSearch(
|
2016-01-05 15:51:16 +00:00
|
|
|
this.state.searchResults);
|
|
|
|
return this._handleSearchResult(searchPromise);
|
2015-12-22 15:18:50 +00:00
|
|
|
} else {
|
2016-01-04 16:28:32 +00:00
|
|
|
debuglog("no more search results");
|
2017-07-12 13:02:00 +00:00
|
|
|
return Promise.resolve(false);
|
2015-12-22 15:18:50 +00:00
|
|
|
}
|
|
|
|
},
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2017-10-12 03:15:00 +00:00
|
|
|
onInviteButtonClick: function() {
|
|
|
|
// call AddressPickerDialog
|
|
|
|
dis.dispatch({
|
|
|
|
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 17:15:57 +00:00
|
|
|
onJoinButtonClicked: function(ev) {
|
2017-05-24 15:56:13 +00:00
|
|
|
const cli = MatrixClientPeg.get();
|
2017-04-28 12:22:55 +00:00
|
|
|
|
|
|
|
// If the user is a ROU, allow them to transition to a PWLU
|
2017-04-28 12:38:35 +00:00
|
|
|
if (cli && cli.isGuest()) {
|
2017-05-24 15:56:13 +00:00
|
|
|
// Join this room once the user has registered and logged in
|
2017-06-02 15:25:14 +00:00
|
|
|
const signUrl = this.props.thirdPartyInvite ?
|
|
|
|
this.props.thirdPartyInvite.inviteSignUrl : undefined;
|
2017-05-24 15:56:13 +00:00
|
|
|
dis.dispatch({
|
|
|
|
action: 'do_after_sync_prepared',
|
|
|
|
deferred_action: {
|
|
|
|
action: 'join_room',
|
2017-06-02 15:25:14 +00:00
|
|
|
opts: { inviteSignUrl: signUrl },
|
2017-05-24 15:56:13 +00:00
|
|
|
},
|
|
|
|
});
|
2016-02-04 11:49:10 +00:00
|
|
|
|
2017-05-25 16:04:42 +00:00
|
|
|
// Don't peek whilst registering otherwise getPendingEventList complains
|
|
|
|
// Do this by indicating our intention to join
|
|
|
|
dis.dispatch({
|
|
|
|
action: 'will_join',
|
2016-02-04 11:49:10 +00:00
|
|
|
});
|
2017-05-25 16:04:42 +00:00
|
|
|
|
2017-04-28 12:22:55 +00:00
|
|
|
const SetMxIdDialog = sdk.getComponent('views.dialogs.SetMxIdDialog');
|
2017-07-27 16:19:18 +00:00
|
|
|
const close = Modal.createTrackedDialog('Set MXID', '', SetMxIdDialog, {
|
2017-05-10 13:22:17 +00:00
|
|
|
homeserverUrl: cli.getHomeserverUrl(),
|
2017-04-28 12:22:55 +00:00
|
|
|
onFinished: (submitted, credentials) => {
|
2017-05-24 15:56:13 +00:00
|
|
|
if (submitted) {
|
|
|
|
this.props.onRegistered(credentials);
|
2017-05-25 16:04:42 +00:00
|
|
|
} else {
|
2017-06-07 10:55:24 +00:00
|
|
|
dis.dispatch({
|
|
|
|
action: 'cancel_after_sync_prepared',
|
|
|
|
});
|
2017-05-25 16:04:42 +00:00
|
|
|
dis.dispatch({
|
|
|
|
action: 'cancel_join',
|
|
|
|
});
|
2017-04-28 12:22:55 +00:00
|
|
|
}
|
2017-05-10 13:22:17 +00:00
|
|
|
},
|
|
|
|
onDifferentServerClicked: (ev) => {
|
|
|
|
dis.dispatch({action: 'start_registration'});
|
|
|
|
close();
|
|
|
|
},
|
2017-05-29 00:32:31 +00:00
|
|
|
onLoginClick: (ev) => {
|
|
|
|
dis.dispatch({action: 'start_login'});
|
|
|
|
close();
|
|
|
|
},
|
2017-05-10 13:22:17 +00:00
|
|
|
}).close;
|
2017-05-24 15:56:13 +00:00
|
|
|
return;
|
2016-02-04 11:49:10 +00:00
|
|
|
}
|
|
|
|
|
2017-07-12 13:02:00 +00:00
|
|
|
Promise.resolve().then(() => {
|
2017-05-24 15:56:13 +00:00
|
|
|
const signUrl = this.props.thirdPartyInvite ?
|
|
|
|
this.props.thirdPartyInvite.inviteSignUrl : undefined;
|
|
|
|
dis.dispatch({
|
|
|
|
action: 'join_room',
|
|
|
|
opts: { inviteSignUrl: signUrl },
|
2017-04-28 12:22:55 +00:00
|
|
|
});
|
2017-05-24 15:56:13 +00:00
|
|
|
|
2016-09-12 17:32:44 +00:00
|
|
|
// if this is an invite and has the 'direct' hint set, mark it as a DM room now.
|
|
|
|
if (this.state.room) {
|
|
|
|
const me = this.state.room.getMember(MatrixClientPeg.get().credentials.userId);
|
2016-09-16 15:45:35 +00:00
|
|
|
if (me && me.membership == 'invite') {
|
2016-09-12 17:32:44 +00:00
|
|
|
if (me.events.member.getContent().is_direct) {
|
2016-09-20 15:08:11 +00:00
|
|
|
// The 'direct' hint is there, so declare that this is a DM room for
|
|
|
|
// whoever invited us.
|
2016-09-12 17:32:44 +00:00
|
|
|
return Rooms.setDMRoom(this.state.room.roomId, me.events.member.getSender());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-07-12 13:02:00 +00:00
|
|
|
return Promise.resolve();
|
2015-11-30 17:15:57 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onMessageListScroll: function(ev) {
|
2016-02-10 18:27:40 +00:00
|
|
|
if (this.refs.messagePanel.isAtEndOfLiveTimeline()) {
|
|
|
|
this.setState({
|
|
|
|
numUnreadMessages: 0,
|
|
|
|
atEndOfLiveTimeline: true,
|
|
|
|
});
|
2017-10-11 16:56:17 +00:00
|
|
|
} else {
|
2016-02-10 18:27:40 +00:00
|
|
|
this.setState({
|
|
|
|
atEndOfLiveTimeline: false,
|
|
|
|
});
|
2015-12-17 23:04:32 +00:00
|
|
|
}
|
2016-02-24 17:26:34 +00:00
|
|
|
this._updateTopUnreadMessagesBar();
|
2015-11-30 17:15:57 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
onDragOver: function(ev) {
|
|
|
|
ev.stopPropagation();
|
|
|
|
ev.preventDefault();
|
|
|
|
|
|
|
|
ev.dataTransfer.dropEffect = 'none';
|
|
|
|
|
2017-12-18 12:51:01 +00:00
|
|
|
const items = [...ev.dataTransfer.items];
|
2017-12-18 10:20:18 +00:00
|
|
|
if (items.length >= 1) {
|
2017-12-18 12:51:01 +00:00
|
|
|
const isDraggingFiles = items.every(function(item) {
|
2017-12-18 10:20:18 +00:00
|
|
|
return item.kind == 'file';
|
|
|
|
});
|
|
|
|
|
|
|
|
if (isDraggingFiles) {
|
2017-10-11 16:56:17 +00:00
|
|
|
this.setState({ draggingFile: true });
|
2015-11-30 17:15:57 +00:00
|
|
|
ev.dataTransfer.dropEffect = 'copy';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
onDrop: function(ev) {
|
|
|
|
ev.stopPropagation();
|
|
|
|
ev.preventDefault();
|
2017-10-11 16:56:17 +00:00
|
|
|
this.setState({ draggingFile: false });
|
2017-12-18 10:20:18 +00:00
|
|
|
const files = [...ev.dataTransfer.files];
|
|
|
|
files.forEach(this.uploadFile);
|
2015-11-30 17:15:57 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
onDragLeaveOrEnd: function(ev) {
|
|
|
|
ev.stopPropagation();
|
|
|
|
ev.preventDefault();
|
2017-10-11 16:56:17 +00:00
|
|
|
this.setState({ draggingFile: false });
|
2015-11-30 17:15:57 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
uploadFile: function(file) {
|
2016-05-31 22:59:36 +00:00
|
|
|
if (MatrixClientPeg.get().isGuest()) {
|
2017-05-15 16:31:26 +00:00
|
|
|
dis.dispatch({action: 'view_set_mxid'});
|
2016-05-31 22:59:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-11-30 17:15:57 +00:00
|
|
|
ContentMessages.sendContentToRoom(
|
2017-10-11 16:56:17 +00:00
|
|
|
file, this.state.room.roomId, MatrixClientPeg.get(),
|
2017-03-09 10:44:09 +00:00
|
|
|
).done(undefined, (error) => {
|
|
|
|
if (error.name === "UnknownDeviceError") {
|
2017-11-09 16:09:12 +00:00
|
|
|
// Let the staus bar handle this
|
2017-03-09 10:44:09 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
2017-03-12 22:59:41 +00:00
|
|
|
console.error("Failed to upload file " + file + " " + error);
|
2017-08-10 14:17:52 +00:00
|
|
|
Modal.createTrackedDialog('Failed to upload file', '', ErrorDialog, {
|
2017-05-23 14:16:31 +00:00
|
|
|
title: _t('Failed to upload file'),
|
|
|
|
description: ((error && error.message) ? error.message : _t("Server may be unavailable, overloaded, or the file too big")),
|
2015-11-30 17:15:57 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onSearch: function(term, scope) {
|
2015-12-18 11:11:41 +00:00
|
|
|
this.setState({
|
|
|
|
searchTerm: term,
|
|
|
|
searchScope: scope,
|
2015-12-22 18:15:32 +00:00
|
|
|
searchResults: {},
|
2015-12-18 11:11:41 +00:00
|
|
|
searchHighlights: [],
|
|
|
|
});
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2015-12-22 15:18:50 +00:00
|
|
|
// if we already have a search panel, we need to tell it to forget
|
|
|
|
// about its scroll state.
|
|
|
|
if (this.refs.searchResultsPanel) {
|
|
|
|
this.refs.searchResultsPanel.resetScrollState();
|
|
|
|
}
|
|
|
|
|
2015-12-22 18:15:32 +00:00
|
|
|
// make sure that we don't end up showing results from
|
|
|
|
// an aborted search by keeping a unique id.
|
|
|
|
//
|
|
|
|
// todo: should cancel any previous search requests.
|
|
|
|
this.searchId = new Date().getTime();
|
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
let filter;
|
2015-12-22 18:15:32 +00:00
|
|
|
if (scope === "Room") {
|
|
|
|
filter = {
|
|
|
|
// XXX: it's unintuitive that the filter for searching doesn't have the same shape as the v2 filter API :(
|
|
|
|
rooms: [
|
2017-10-11 16:56:17 +00:00
|
|
|
this.state.room.roomId,
|
|
|
|
],
|
2015-12-22 18:15:32 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-01-05 15:51:16 +00:00
|
|
|
debuglog("sending search request");
|
2015-12-22 18:15:32 +00:00
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const searchPromise = MatrixClientPeg.get().searchRoomEvents({
|
2016-01-04 16:54:27 +00:00
|
|
|
filter: filter,
|
|
|
|
term: term,
|
|
|
|
});
|
|
|
|
this._handleSearchResult(searchPromise).done();
|
2015-12-18 11:11:41 +00:00
|
|
|
},
|
|
|
|
|
2015-12-22 18:15:32 +00:00
|
|
|
_handleSearchResult: function(searchPromise) {
|
2017-10-11 16:56:17 +00:00
|
|
|
const self = this;
|
2016-01-04 16:54:27 +00:00
|
|
|
|
|
|
|
// keep a record of the current search id, so that if the search terms
|
|
|
|
// change before we get a response, we can ignore the results.
|
2017-10-11 16:56:17 +00:00
|
|
|
const localSearchId = this.searchId;
|
2015-12-11 03:22:44 +00:00
|
|
|
|
2015-12-22 18:15:32 +00:00
|
|
|
this.setState({
|
|
|
|
searchInProgress: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
return searchPromise.then(function(results) {
|
2016-01-04 16:28:32 +00:00
|
|
|
debuglog("search complete");
|
2016-01-11 11:38:04 +00:00
|
|
|
if (self.unmounted || !self.state.searching || self.searchId != localSearchId) {
|
2015-12-11 03:22:44 +00:00
|
|
|
console.error("Discarding stale search results");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-01-05 15:28:32 +00:00
|
|
|
// postgres on synapse returns us precise details of the strings
|
|
|
|
// which actually got matched for highlighting.
|
|
|
|
//
|
|
|
|
// In either case, we want to highlight the literal search term
|
|
|
|
// whether it was used by the search engine or not.
|
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
let highlights = results.highlights;
|
2016-01-05 15:28:32 +00:00
|
|
|
if (highlights.indexOf(self.state.searchTerm) < 0) {
|
|
|
|
highlights = highlights.concat(self.state.searchTerm);
|
|
|
|
}
|
2015-12-18 11:11:41 +00:00
|
|
|
|
2015-12-22 18:15:32 +00:00
|
|
|
// For overlapping highlights,
|
2015-12-18 11:11:41 +00:00
|
|
|
// favour longer (more specific) terms first
|
2016-01-08 13:25:03 +00:00
|
|
|
highlights = highlights.sort(function(a, b) {
|
2017-10-11 16:56:17 +00:00
|
|
|
return b.length - a.length;
|
|
|
|
});
|
2015-11-30 17:15:57 +00:00
|
|
|
|
|
|
|
self.setState({
|
2015-12-18 11:11:41 +00:00
|
|
|
searchHighlights: highlights,
|
2015-12-22 18:15:32 +00:00
|
|
|
searchResults: results,
|
2015-11-30 17:15:57 +00:00
|
|
|
});
|
|
|
|
}, function(error) {
|
2017-10-11 16:56:17 +00:00
|
|
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
2017-03-12 22:59:41 +00:00
|
|
|
console.error("Search failed: " + error);
|
2017-08-10 14:17:52 +00:00
|
|
|
Modal.createTrackedDialog('Search failed', '', ErrorDialog, {
|
2017-05-23 14:16:31 +00:00
|
|
|
title: _t("Search failed"),
|
|
|
|
description: ((error && error.message) ? error.message : _t("Server may be unavailable, overloaded, or search timed out :(")),
|
2015-11-30 17:15:57 +00:00
|
|
|
});
|
2015-12-11 02:25:33 +00:00
|
|
|
}).finally(function() {
|
|
|
|
self.setState({
|
2017-10-11 16:56:17 +00:00
|
|
|
searchInProgress: false,
|
2015-12-11 02:25:33 +00:00
|
|
|
});
|
2015-12-22 18:15:32 +00:00
|
|
|
});
|
2015-12-18 11:11:41 +00:00
|
|
|
},
|
|
|
|
|
2015-12-22 15:18:50 +00:00
|
|
|
getSearchResultTiles: function() {
|
2017-10-11 16:56:17 +00:00
|
|
|
const EventTile = sdk.getComponent('rooms.EventTile');
|
|
|
|
const SearchResultTile = sdk.getComponent('rooms.SearchResultTile');
|
|
|
|
const Spinner = sdk.getComponent("elements.Spinner");
|
2016-03-20 23:51:43 +00:00
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const cli = MatrixClientPeg.get();
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2015-12-22 15:18:50 +00:00
|
|
|
// XXX: todo: merge overlapping results somehow?
|
|
|
|
// XXX: why doesn't searching on name work?
|
|
|
|
|
2015-12-22 18:15:32 +00:00
|
|
|
if (this.state.searchResults.results === undefined) {
|
|
|
|
// awaiting results
|
|
|
|
return [];
|
|
|
|
}
|
2015-12-22 15:18:50 +00:00
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const ret = [];
|
2015-12-22 18:15:32 +00:00
|
|
|
|
2016-03-20 23:51:43 +00:00
|
|
|
if (this.state.searchInProgress) {
|
|
|
|
ret.push(<li key="search-spinner">
|
|
|
|
<Spinner />
|
|
|
|
</li>);
|
|
|
|
}
|
|
|
|
|
2015-12-22 18:15:32 +00:00
|
|
|
if (!this.state.searchResults.next_batch) {
|
|
|
|
if (this.state.searchResults.results.length == 0) {
|
2015-12-22 15:18:50 +00:00
|
|
|
ret.push(<li key="search-top-marker">
|
2017-05-23 14:16:31 +00:00
|
|
|
<h2 className="mx_RoomView_topMarker">{ _t("No results") }</h2>
|
2017-10-11 16:56:17 +00:00
|
|
|
</li>,
|
2015-12-22 15:18:50 +00:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
ret.push(<li key="search-top-marker">
|
2017-05-23 14:16:31 +00:00
|
|
|
<h2 className="mx_RoomView_topMarker">{ _t("No more results") }</h2>
|
2017-10-11 16:56:17 +00:00
|
|
|
</li>,
|
2015-12-22 15:18:50 +00:00
|
|
|
);
|
2015-12-21 12:39:10 +00:00
|
|
|
}
|
2015-12-22 15:18:50 +00:00
|
|
|
}
|
2015-12-21 12:39:10 +00:00
|
|
|
|
2016-04-01 23:36:19 +00:00
|
|
|
// once dynamic content in the search results load, make the scrollPanel check
|
2016-02-22 17:19:04 +00:00
|
|
|
// the scroll offsets.
|
2017-10-11 16:56:17 +00:00
|
|
|
const onWidgetLoad = () => {
|
|
|
|
const scrollPanel = this.refs.searchResultsPanel;
|
2016-02-22 17:19:04 +00:00
|
|
|
if (scrollPanel) {
|
|
|
|
scrollPanel.checkScroll();
|
|
|
|
}
|
2017-01-20 14:22:27 +00:00
|
|
|
};
|
2016-02-22 17:19:04 +00:00
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
let lastRoomId;
|
2015-12-10 13:58:06 +00:00
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
for (let i = this.state.searchResults.results.length - 1; i >= 0; i--) {
|
|
|
|
const result = this.state.searchResults.results[i];
|
2015-12-22 18:15:32 +00:00
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const mxEv = result.context.getEvent();
|
|
|
|
const roomId = mxEv.getRoomId();
|
2015-12-18 16:42:46 +00:00
|
|
|
|
2015-12-22 15:18:50 +00:00
|
|
|
if (!EventTile.haveTileForEvent(mxEv)) {
|
|
|
|
// XXX: can this ever happen? It will make the result count
|
|
|
|
// not match the displayed count.
|
|
|
|
continue;
|
|
|
|
}
|
2015-12-18 16:42:46 +00:00
|
|
|
|
2015-12-22 15:18:50 +00:00
|
|
|
if (this.state.searchScope === 'All') {
|
2017-11-16 13:19:36 +00:00
|
|
|
if (roomId != lastRoomId) {
|
2017-10-11 16:56:17 +00:00
|
|
|
const room = cli.getRoom(roomId);
|
2016-01-06 16:46:29 +00:00
|
|
|
|
|
|
|
// XXX: if we've left the room, we might not know about
|
|
|
|
// it. We should tell the js sdk to go and find out about
|
|
|
|
// it. But that's not an issue currently, as synapse only
|
|
|
|
// returns results for rooms we're joined to.
|
2017-10-11 16:56:17 +00:00
|
|
|
const roomName = room ? room.name : _t("Unknown room %(roomId)s", { roomId: roomId });
|
2016-01-06 16:46:29 +00:00
|
|
|
|
|
|
|
ret.push(<li key={mxEv.getId() + "-room"}>
|
2017-05-23 14:16:31 +00:00
|
|
|
<h1>{ _t("Room") }: { roomName }</h1>
|
2016-01-06 16:46:29 +00:00
|
|
|
</li>);
|
2015-12-22 15:18:50 +00:00
|
|
|
lastRoomId = roomId;
|
2015-11-30 17:15:57 +00:00
|
|
|
}
|
2015-12-22 15:18:50 +00:00
|
|
|
}
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const resultLink = "#/room/"+roomId+"/"+mxEv.getId();
|
2016-02-17 19:50:04 +00:00
|
|
|
|
2015-12-23 10:10:08 +00:00
|
|
|
ret.push(<SearchResultTile key={mxEv.getId()}
|
|
|
|
searchResult={result}
|
2016-01-29 11:19:27 +00:00
|
|
|
searchHighlights={this.state.searchHighlights}
|
2016-02-22 17:19:04 +00:00
|
|
|
resultLink={resultLink}
|
2017-10-11 16:56:17 +00:00
|
|
|
onWidgetLoad={onWidgetLoad} />);
|
2015-11-30 17:15:57 +00:00
|
|
|
}
|
2015-12-22 15:18:50 +00:00
|
|
|
return ret;
|
|
|
|
},
|
|
|
|
|
2017-09-28 21:32:51 +00:00
|
|
|
onPinnedClick: function() {
|
|
|
|
this.setState({showingPinned: !this.state.showingPinned, searching: false});
|
|
|
|
},
|
|
|
|
|
2015-11-30 17:15:57 +00:00
|
|
|
onSettingsClick: function() {
|
2016-01-20 23:09:36 +00:00
|
|
|
this.showSettings(true);
|
2015-11-30 17:15:57 +00:00
|
|
|
},
|
|
|
|
|
2016-02-04 15:26:12 +00:00
|
|
|
onSettingsSaveClick: function() {
|
2016-04-12 17:01:49 +00:00
|
|
|
if (!this.refs.room_settings) return;
|
|
|
|
|
2015-11-30 17:15:57 +00:00
|
|
|
this.setState({
|
|
|
|
uploadingRoomSettings: true,
|
|
|
|
});
|
2016-04-22 16:05:48 +00:00
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const newName = this.refs.header.getEditedName();
|
2016-03-29 14:21:16 +00:00
|
|
|
if (newName !== undefined) {
|
|
|
|
this.refs.room_settings.setName(newName);
|
|
|
|
}
|
2017-10-11 16:56:17 +00:00
|
|
|
const newTopic = this.refs.header.getEditedTopic();
|
2016-03-29 14:21:16 +00:00
|
|
|
if (newTopic !== undefined) {
|
|
|
|
this.refs.room_settings.setTopic(newTopic);
|
|
|
|
}
|
2016-04-22 16:05:48 +00:00
|
|
|
|
2016-02-04 15:26:12 +00:00
|
|
|
this.refs.room_settings.save().then((results) => {
|
2017-10-11 16:56:17 +00:00
|
|
|
const fails = results.filter(function(result) { return result.state !== "fulfilled"; });
|
2016-02-05 14:38:28 +00:00
|
|
|
console.log("Settings saved with %s errors", fails.length);
|
2016-02-04 15:26:12 +00:00
|
|
|
if (fails.length) {
|
|
|
|
fails.forEach(function(result) {
|
|
|
|
console.error(result.reason);
|
|
|
|
});
|
2017-10-11 16:56:17 +00:00
|
|
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
2017-07-27 16:19:18 +00:00
|
|
|
Modal.createTrackedDialog('Failed to save room settings', '', ErrorDialog, {
|
2017-05-23 14:16:31 +00:00
|
|
|
title: _t("Failed to save settings"),
|
2017-01-20 14:22:27 +00:00
|
|
|
description: fails.map(function(result) { return result.reason; }).join("\n"),
|
2016-02-04 15:26:12 +00:00
|
|
|
});
|
|
|
|
// still editing room settings
|
2017-10-11 16:56:17 +00:00
|
|
|
} else {
|
2016-02-04 15:26:12 +00:00
|
|
|
this.setState({
|
2017-10-11 16:56:17 +00:00
|
|
|
editingRoomSettings: false,
|
2016-02-04 15:26:12 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}).finally(() => {
|
|
|
|
this.setState({
|
|
|
|
uploadingRoomSettings: false,
|
2017-10-11 16:56:17 +00:00
|
|
|
editingRoomSettings: false,
|
2016-02-04 15:26:12 +00:00
|
|
|
});
|
2016-02-05 11:59:19 +00:00
|
|
|
}).done();
|
2015-11-30 17:15:57 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
onCancelClick: function() {
|
2016-04-16 00:00:10 +00:00
|
|
|
console.log("updateTint from onCancelClick");
|
2016-01-08 03:22:38 +00:00
|
|
|
this.updateTint();
|
2017-04-21 11:56:59 +00:00
|
|
|
this.setState({
|
|
|
|
editingRoomSettings: false,
|
|
|
|
});
|
2017-06-16 15:12:52 +00:00
|
|
|
if (this.state.forwardingEvent) {
|
|
|
|
dis.dispatch({
|
|
|
|
action: 'forward_event',
|
|
|
|
event: null,
|
|
|
|
});
|
|
|
|
}
|
2017-04-21 17:45:28 +00:00
|
|
|
dis.dispatch({action: 'focus_composer'});
|
2015-11-30 17:15:57 +00:00
|
|
|
},
|
|
|
|
|
2015-12-13 13:49:28 +00:00
|
|
|
onLeaveClick: function() {
|
|
|
|
dis.dispatch({
|
|
|
|
action: 'leave_room',
|
2016-04-12 18:25:07 +00:00
|
|
|
room_id: this.state.room.roomId,
|
2015-12-13 13:49:28 +00:00
|
|
|
});
|
2015-12-16 16:06:29 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
onForgetClick: function() {
|
2016-04-12 18:25:07 +00:00
|
|
|
MatrixClientPeg.get().forget(this.state.room.roomId).done(function() {
|
2015-12-16 16:06:29 +00:00
|
|
|
dis.dispatch({ action: 'view_next_room' });
|
|
|
|
}, function(err) {
|
2017-10-11 16:56:17 +00:00
|
|
|
const errCode = err.errcode || _t("unknown error code");
|
|
|
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
2017-08-10 12:49:11 +00:00
|
|
|
Modal.createTrackedDialog('Failed to forget room', '', ErrorDialog, {
|
2017-05-23 14:16:31 +00:00
|
|
|
title: _t("Error"),
|
|
|
|
description: _t("Failed to forget room %(errCode)s", { errCode: errCode }),
|
2015-12-18 16:56:37 +00:00
|
|
|
});
|
2015-12-16 16:06:29 +00:00
|
|
|
});
|
2015-12-13 13:49:28 +00:00
|
|
|
},
|
|
|
|
|
2015-11-30 17:15:57 +00:00
|
|
|
onRejectButtonClicked: function(ev) {
|
2017-10-11 16:56:17 +00:00
|
|
|
const self = this;
|
2015-11-30 17:15:57 +00:00
|
|
|
this.setState({
|
2017-10-11 16:56:17 +00:00
|
|
|
rejecting: true,
|
2015-11-30 17:15:57 +00:00
|
|
|
});
|
2016-06-20 17:05:58 +00:00
|
|
|
MatrixClientPeg.get().leave(this.state.roomId).done(function() {
|
2015-11-30 17:15:57 +00:00
|
|
|
dis.dispatch({ action: 'view_next_room' });
|
|
|
|
self.setState({
|
2017-10-11 16:56:17 +00:00
|
|
|
rejecting: false,
|
2015-11-30 17:15:57 +00:00
|
|
|
});
|
2016-02-15 18:59:44 +00:00
|
|
|
}, function(error) {
|
|
|
|
console.error("Failed to reject invite: %s", error);
|
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const msg = error.message ? error.message : JSON.stringify(error);
|
|
|
|
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
2017-08-10 14:17:52 +00:00
|
|
|
Modal.createTrackedDialog('Failed to reject invite', '', ErrorDialog, {
|
2017-05-23 14:16:31 +00:00
|
|
|
title: _t("Failed to reject invite"),
|
|
|
|
description: msg,
|
2016-02-15 18:59:44 +00:00
|
|
|
});
|
|
|
|
|
2015-11-30 17:15:57 +00:00
|
|
|
self.setState({
|
|
|
|
rejecting: false,
|
2017-10-11 16:56:17 +00:00
|
|
|
rejectError: error,
|
2015-11-30 17:15:57 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-03-10 15:56:58 +00:00
|
|
|
onRejectThreepidInviteButtonClicked: function(ev) {
|
2016-03-11 10:20:52 +00:00
|
|
|
// We can reject 3pid invites in the same way that we accept them,
|
|
|
|
// using /leave rather than /join. In the short term though, we
|
|
|
|
// just ignore them.
|
|
|
|
// https://github.com/vector-im/vector-web/issues/1134
|
2016-03-10 15:56:58 +00:00
|
|
|
dis.dispatch({
|
|
|
|
action: 'view_room_directory',
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2015-11-30 17:15:57 +00:00
|
|
|
onSearchClick: function() {
|
2017-09-28 21:32:51 +00:00
|
|
|
this.setState({ searching: true, showingPinned: false });
|
2015-11-30 17:15:57 +00:00
|
|
|
},
|
|
|
|
|
2017-01-20 14:22:27 +00:00
|
|
|
onCancelSearchClick: function() {
|
2015-12-18 16:42:46 +00:00
|
|
|
this.setState({
|
|
|
|
searching: false,
|
|
|
|
searchResults: null,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-02-03 08:03:10 +00:00
|
|
|
// jump down to the bottom of this room, where new events are arriving
|
|
|
|
jumpToLiveTimeline: function() {
|
2016-02-10 18:27:40 +00:00
|
|
|
this.refs.messagePanel.jumpToLiveTimeline();
|
2017-04-21 00:06:00 +00:00
|
|
|
dis.dispatch({action: 'focus_composer'});
|
2015-12-18 16:42:46 +00:00
|
|
|
},
|
|
|
|
|
2016-02-24 17:26:34 +00:00
|
|
|
// jump up to wherever our read marker is
|
|
|
|
jumpToReadMarker: function() {
|
|
|
|
this.refs.messagePanel.jumpToReadMarker();
|
|
|
|
},
|
|
|
|
|
|
|
|
// update the read marker to match the read-receipt
|
2016-04-13 11:46:36 +00:00
|
|
|
forgetReadMarker: function(ev) {
|
|
|
|
ev.stopPropagation();
|
2016-02-24 17:26:34 +00:00
|
|
|
this.refs.messagePanel.forgetReadMarker();
|
|
|
|
},
|
|
|
|
|
|
|
|
// decide whether or not the top 'unread messages' bar should be shown
|
|
|
|
_updateTopUnreadMessagesBar: function() {
|
2017-01-20 14:22:27 +00:00
|
|
|
if (!this.refs.messagePanel) {
|
2016-02-24 17:26:34 +00:00
|
|
|
return;
|
2017-01-20 14:22:27 +00:00
|
|
|
}
|
2016-02-24 17:26:34 +00:00
|
|
|
|
2017-04-27 13:03:54 +00:00
|
|
|
const showBar = this.refs.messagePanel.canJumpToReadMarker();
|
2016-03-10 15:55:03 +00:00
|
|
|
if (this.state.showTopUnreadMessagesBar != showBar) {
|
|
|
|
this.setState({showTopUnreadMessagesBar: showBar},
|
|
|
|
this.onChildResize);
|
|
|
|
}
|
2016-02-24 17:26:34 +00:00
|
|
|
},
|
|
|
|
|
2015-12-10 21:34:10 +00:00
|
|
|
// get the current scroll position of the room, so that it can be
|
2016-02-01 16:31:12 +00:00
|
|
|
// restored when we switch back to it.
|
|
|
|
//
|
2016-11-04 09:28:35 +00:00
|
|
|
_getScrollState: function() {
|
2017-10-11 16:56:17 +00:00
|
|
|
const messagePanel = this.refs.messagePanel;
|
2015-12-22 15:18:50 +00:00
|
|
|
if (!messagePanel) return null;
|
|
|
|
|
2016-02-04 16:17:03 +00:00
|
|
|
// if we're following the live timeline, we want to return null; that
|
|
|
|
// means that, if we switch back, we will jump to the read-up-to mark.
|
|
|
|
//
|
|
|
|
// That should be more intuitive than slavishly preserving the current
|
|
|
|
// scroll state, in the case where the room advances in the meantime
|
|
|
|
// (particularly in the case that the user reads some stuff on another
|
|
|
|
// device).
|
|
|
|
//
|
|
|
|
if (this.state.atEndOfLiveTimeline) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const scrollState = messagePanel.getScrollState();
|
2015-12-18 16:42:46 +00:00
|
|
|
|
2016-02-03 08:03:10 +00:00
|
|
|
if (scrollState.stuckAtBottom) {
|
2016-02-01 16:31:12 +00:00
|
|
|
// we don't really expect to be in this state, but it will
|
2016-02-03 08:03:10 +00:00
|
|
|
// occasionally happen when no scroll state has been set on the
|
|
|
|
// messagePanel (ie, we didn't have an initial event (so it's
|
|
|
|
// probably a new room), there has been no user-initiated scroll, and
|
|
|
|
// no read-receipts have arrived to update the scroll position).
|
|
|
|
//
|
|
|
|
// Return null, which will cause us to scroll to last unread on
|
|
|
|
// reload.
|
2016-02-01 16:31:12 +00:00
|
|
|
return null;
|
2015-12-10 16:26:36 +00:00
|
|
|
}
|
2016-02-01 16:31:12 +00:00
|
|
|
|
|
|
|
return {
|
2016-02-03 08:03:10 +00:00
|
|
|
focussedEvent: scrollState.trackedScrollToken,
|
2016-02-01 16:31:12 +00:00
|
|
|
pixelOffset: scrollState.pixelOffset,
|
|
|
|
};
|
2015-12-10 16:26:36 +00:00
|
|
|
},
|
|
|
|
|
2015-12-13 04:32:48 +00:00
|
|
|
onResize: function(e) {
|
|
|
|
// 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 13:03:37 +00:00
|
|
|
|
2016-01-15 15:53:53 +00:00
|
|
|
// header + footer + status + give us at least 120px of scrollback at all times.
|
2017-10-11 16:56:17 +00:00
|
|
|
let auxPanelMaxHeight = window.innerHeight -
|
2016-01-15 14:22:17 +00:00
|
|
|
(83 + // height of RoomHeader
|
|
|
|
36 + // height of the status area
|
|
|
|
72 + // minimum height of the message compmoser
|
2016-01-20 23:09:36 +00:00
|
|
|
(this.state.editingRoomSettings ? (window.innerHeight * 0.3) : 120)); // amount of desired scrollback
|
2016-01-10 13:03:37 +00: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 12:16:34 +00:00
|
|
|
this.setState({auxPanelMaxHeight: auxPanelMaxHeight});
|
|
|
|
|
|
|
|
// changing the maxHeight on the auxpanel will trigger a callback go
|
|
|
|
// onChildResize, so no need to worry about that here.
|
2015-12-13 04:32:48 +00:00
|
|
|
},
|
|
|
|
|
2015-12-15 00:01:47 +00:00
|
|
|
onFullscreenClick: function() {
|
|
|
|
dis.dispatch({
|
|
|
|
action: 'video_fullscreen',
|
2017-10-11 16:56:17 +00:00
|
|
|
fullscreen: true,
|
2015-12-15 00:01:47 +00:00
|
|
|
}, true);
|
|
|
|
},
|
|
|
|
|
2015-12-14 23:37:34 +00:00
|
|
|
onMuteAudioClick: function() {
|
2017-10-11 16:56:17 +00:00
|
|
|
const call = this._getCallForRoom();
|
2015-12-14 23:37:34 +00:00
|
|
|
if (!call) {
|
|
|
|
return;
|
|
|
|
}
|
2017-10-11 16:56:17 +00:00
|
|
|
const newState = !call.isMicrophoneMuted();
|
2015-12-14 23:37:34 +00:00
|
|
|
call.setMicrophoneMuted(newState);
|
2016-10-17 13:03:37 +00:00
|
|
|
this.forceUpdate(); // TODO: just update the voip buttons
|
2015-12-14 23:37:34 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
onMuteVideoClick: function() {
|
2017-10-11 16:56:17 +00:00
|
|
|
const call = this._getCallForRoom();
|
2015-12-14 23:37:34 +00:00
|
|
|
if (!call) {
|
|
|
|
return;
|
|
|
|
}
|
2017-10-11 16:56:17 +00:00
|
|
|
const newState = !call.isLocalVideoMuted();
|
2015-12-14 23:37:34 +00:00
|
|
|
call.setLocalVideoMuted(newState);
|
2016-10-17 13:03:37 +00:00
|
|
|
this.forceUpdate(); // TODO: just update the voip buttons
|
2015-12-14 23:37:34 +00:00
|
|
|
},
|
|
|
|
|
2016-01-11 15:28:59 +00:00
|
|
|
onChildResize: function() {
|
2016-03-14 12:46:13 +00:00
|
|
|
// no longer anything to do here
|
2016-01-11 15:28:59 +00:00
|
|
|
},
|
|
|
|
|
2017-01-23 15:01:39 +00:00
|
|
|
onStatusBarVisible: function() {
|
2017-01-26 17:03:01 +00:00
|
|
|
if (this.unmounted) return;
|
2017-01-23 15:01:39 +00:00
|
|
|
this.setState({
|
|
|
|
statusBarVisible: true,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onStatusBarHidden: function() {
|
2017-01-26 17:03:01 +00:00
|
|
|
if (this.unmounted) return;
|
2017-01-23 15:01:39 +00:00
|
|
|
this.setState({
|
|
|
|
statusBarVisible: false,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-01-17 03:59:31 +00:00
|
|
|
showSettings: function(show) {
|
|
|
|
// XXX: this is a bit naughty; we should be doing this via props
|
|
|
|
if (show) {
|
|
|
|
this.setState({editingRoomSettings: true});
|
2016-03-08 12:16:34 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-04-05 12:14:11 +00: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 16:56:17 +00:00
|
|
|
let panel;
|
2017-11-16 13:19:36 +00:00
|
|
|
if (this.refs.searchResultsPanel) {
|
2016-04-05 12:14:11 +00:00
|
|
|
panel = this.refs.searchResultsPanel;
|
2017-11-16 13:19:36 +00:00
|
|
|
} else if (this.refs.messagePanel) {
|
2016-04-05 12:14:11 +00:00
|
|
|
panel = this.refs.messagePanel;
|
|
|
|
}
|
|
|
|
|
2017-11-16 13:19:36 +00:00
|
|
|
if (panel) {
|
2016-04-05 12:14:11 +00:00
|
|
|
panel.handleScrollKey(ev);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-04-12 18:25:07 +00: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 12:16:34 +00:00
|
|
|
// this has to be a proper method rather than an unnamed function,
|
|
|
|
// otherwise react calls it with null on each update.
|
|
|
|
_gatherTimelinePanelRef: function(r) {
|
|
|
|
this.refs.messagePanel = r;
|
2017-11-16 13:19:36 +00:00
|
|
|
if (r) {
|
2016-04-16 00:00:10 +00:00
|
|
|
console.log("updateTint from RoomView._gatherTimelinePanelRef");
|
2016-03-08 12:16:34 +00:00
|
|
|
this.updateTint();
|
2016-01-17 03:59:31 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-11-30 17:15:57 +00:00
|
|
|
render: function() {
|
2017-04-21 11:56:59 +00:00
|
|
|
const RoomHeader = sdk.getComponent('rooms.RoomHeader');
|
|
|
|
const MessageComposer = sdk.getComponent('rooms.MessageComposer');
|
|
|
|
const ForwardMessage = sdk.getComponent("rooms.ForwardMessage");
|
|
|
|
const RoomSettings = sdk.getComponent("rooms.RoomSettings");
|
|
|
|
const AuxPanel = sdk.getComponent("rooms.AuxPanel");
|
|
|
|
const SearchBar = sdk.getComponent("rooms.SearchBar");
|
2017-09-28 21:32:51 +00:00
|
|
|
const PinnedEventsPanel = sdk.getComponent("rooms.PinnedEventsPanel");
|
2017-04-21 11:56:59 +00:00
|
|
|
const ScrollPanel = sdk.getComponent("structures.ScrollPanel");
|
|
|
|
const TintableSvg = sdk.getComponent("elements.TintableSvg");
|
|
|
|
const RoomPreviewBar = sdk.getComponent("rooms.RoomPreviewBar");
|
|
|
|
const Loader = sdk.getComponent("elements.Spinner");
|
|
|
|
const TimelinePanel = sdk.getComponent("structures.TimelinePanel");
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2016-02-10 18:27:40 +00:00
|
|
|
if (!this.state.room) {
|
2017-06-05 08:52:39 +00:00
|
|
|
if (this.state.roomLoading || this.state.peekLoading) {
|
2017-05-30 10:21:33 +00:00
|
|
|
return (
|
|
|
|
<div className="mx_RoomView">
|
|
|
|
<Loader />
|
|
|
|
</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 17:39:23 +00:00
|
|
|
}
|
2016-03-01 18:23:57 +00:00
|
|
|
|
2017-05-30 10:21:33 +00: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 10:10:55 +00:00
|
|
|
const roomAlias = this.state.roomAlias;
|
2017-05-30 10:21:33 +00:00
|
|
|
return (
|
|
|
|
<div className="mx_RoomView">
|
|
|
|
<RoomHeader ref="header"
|
|
|
|
room={this.state.room}
|
|
|
|
oobData={this.props.oobData}
|
2017-10-11 16:56:17 +00:00
|
|
|
collapsedRhs={this.props.collapsedRhs}
|
2017-05-30 10:21:33 +00:00
|
|
|
/>
|
|
|
|
<div className="mx_RoomView_auxPanel">
|
2017-10-11 16:56:17 +00:00
|
|
|
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked}
|
|
|
|
onForgetClick={this.onForgetClick}
|
|
|
|
onRejectClick={this.onRejectThreepidInviteButtonClicked}
|
|
|
|
canPreview={false} error={this.state.roomLoadError}
|
2017-06-16 10:10:55 +00:00
|
|
|
roomAlias={roomAlias}
|
2017-09-15 14:07:09 +00:00
|
|
|
spinner={this.state.joining}
|
2017-05-30 10:21:33 +00:00
|
|
|
inviterName={inviterName}
|
|
|
|
invitedEmail={invitedEmail}
|
|
|
|
room={this.state.room}
|
2016-04-15 17:45:40 +00:00
|
|
|
/>
|
2016-01-18 17:39:23 +00:00
|
|
|
</div>
|
2017-05-30 10:21:33 +00:00
|
|
|
<div className="mx_RoomView_messagePanel"></div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2015-11-30 17:15:57 +00:00
|
|
|
}
|
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const myUserId = MatrixClientPeg.get().credentials.userId;
|
|
|
|
const myMember = this.state.room.getMember(myUserId);
|
2015-12-14 15:36:34 +00:00
|
|
|
if (myMember && myMember.membership == 'invite') {
|
2015-11-30 17:15:57 +00:00
|
|
|
if (this.state.joining || this.state.rejecting) {
|
|
|
|
return (
|
|
|
|
<div className="mx_RoomView">
|
|
|
|
<Loader />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
} else {
|
2017-10-11 16:56:17 +00:00
|
|
|
const inviteEvent = myMember.events.member;
|
2015-12-14 15:36:34 +00:00
|
|
|
var inviterName = inviteEvent.sender ? inviteEvent.sender.name : inviteEvent.getSender();
|
2016-01-18 17:39:23 +00:00
|
|
|
|
|
|
|
// We deliberately don't try to peek into invites, even if we have permission to peek
|
|
|
|
// as they could be a spam vector.
|
|
|
|
// XXX: in future we could give the option of a 'Preview' button which lets them view anyway.
|
2016-01-18 20:15:12 +00:00
|
|
|
|
2016-03-17 18:38:25 +00:00
|
|
|
// We have a regular invite for this room.
|
2015-11-30 17:15:57 +00:00
|
|
|
return (
|
|
|
|
<div className="mx_RoomView">
|
2016-09-13 18:00:35 +00:00
|
|
|
<RoomHeader
|
|
|
|
ref="header"
|
|
|
|
room={this.state.room}
|
2017-10-11 16:56:17 +00:00
|
|
|
collapsedRhs={this.props.collapsedRhs}
|
2016-09-13 18:00:35 +00:00
|
|
|
/>
|
2016-01-18 17:39:23 +00:00
|
|
|
<div className="mx_RoomView_auxPanel">
|
2017-10-11 16:56:17 +00:00
|
|
|
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked}
|
|
|
|
onForgetClick={this.onForgetClick}
|
|
|
|
onRejectClick={this.onRejectButtonClicked}
|
|
|
|
inviterName={inviterName}
|
|
|
|
canPreview={false}
|
2017-09-15 14:07:09 +00:00
|
|
|
spinner={this.state.joining}
|
2016-04-12 16:18:32 +00:00
|
|
|
room={this.state.room}
|
2016-02-09 16:55:03 +00:00
|
|
|
/>
|
2015-11-30 17:15:57 +00:00
|
|
|
</div>
|
2016-01-18 20:15:12 +00:00
|
|
|
<div className="mx_RoomView_messagePanel"></div>
|
2015-11-30 17:15:57 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2016-02-08 16:43:08 +00:00
|
|
|
}
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2016-02-08 16:43:08 +00:00
|
|
|
// We have successfully loaded this room, and are not previewing.
|
|
|
|
// Display the "normal" room view.
|
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const call = this._getCallForRoom();
|
|
|
|
let inCall = false;
|
2016-02-08 18:04:54 +00:00
|
|
|
if (call && (this.state.callState !== 'ended' && this.state.callState !== 'ringing')) {
|
|
|
|
inCall = true;
|
|
|
|
}
|
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const scrollheader_classes = classNames({
|
2016-02-08 16:43:08 +00:00
|
|
|
mx_RoomView_scrollheader: true,
|
|
|
|
});
|
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
let statusBar;
|
2017-01-26 18:07:42 +00:00
|
|
|
let isStatusAreaExpanded = true;
|
2016-02-08 16:43:08 +00:00
|
|
|
|
|
|
|
if (ContentMessages.getCurrentUploads().length > 0) {
|
2017-10-11 16:56:17 +00:00
|
|
|
const UploadBar = sdk.getComponent('structures.UploadBar');
|
2017-01-20 14:22:27 +00:00
|
|
|
statusBar = <UploadBar room={this.state.room} />;
|
2016-02-08 16:43:08 +00:00
|
|
|
} else if (!this.state.searchResults) {
|
2017-10-11 16:56:17 +00:00
|
|
|
const RoomStatusBar = sdk.getComponent('structures.RoomStatusBar');
|
2017-01-26 18:07:42 +00:00
|
|
|
isStatusAreaExpanded = this.state.statusBarVisible;
|
2016-02-08 18:04:54 +00:00
|
|
|
statusBar = <RoomStatusBar
|
|
|
|
room={this.state.room}
|
|
|
|
numUnreadMessages={this.state.numUnreadMessages}
|
|
|
|
atEndOfLiveTimeline={this.state.atEndOfLiveTimeline}
|
2017-10-12 03:15:00 +00:00
|
|
|
sentMessageAndIsAlone={this.state.isAlone}
|
2016-02-08 18:04:54 +00:00
|
|
|
hasActiveCall={inCall}
|
2017-10-12 03:15:00 +00:00
|
|
|
onInviteClick={this.onInviteButtonClick}
|
|
|
|
onStopWarningClick={this.onStopAloneWarningClick}
|
2016-02-09 11:36:57 +00:00
|
|
|
onScrollToBottomClick={this.jumpToLiveTimeline}
|
2016-02-23 11:06:16 +00:00
|
|
|
onResize={this.onChildResize}
|
2017-01-23 15:01:39 +00:00
|
|
|
onVisible={this.onStatusBarVisible}
|
|
|
|
onHidden={this.onStatusBarHidden}
|
2017-02-09 10:30:06 +00:00
|
|
|
whoIsTypingLimit={3}
|
2017-01-23 15:01:39 +00:00
|
|
|
/>;
|
2016-02-08 16:43:08 +00:00
|
|
|
}
|
2015-11-30 17:15:57 +00:00
|
|
|
|
2017-04-21 11:56:59 +00:00
|
|
|
let aux = null;
|
2017-05-30 10:20:41 +00:00
|
|
|
let hideCancel = false;
|
2016-02-08 16:43:08 +00:00
|
|
|
if (this.state.editingRoomSettings) {
|
|
|
|
aux = <RoomSettings ref="room_settings" onSaveClick={this.onSettingsSaveClick} onCancelClick={this.onCancelClick} room={this.state.room} />;
|
2017-04-21 11:56:59 +00:00
|
|
|
} else if (this.state.uploadingRoomSettings) {
|
2017-10-11 16:56:17 +00:00
|
|
|
aux = <Loader />;
|
2017-05-30 10:22:27 +00:00
|
|
|
} else if (this.state.forwardingEvent !== null) {
|
2017-06-16 15:12:52 +00:00
|
|
|
aux = <ForwardMessage onCancelClick={this.onCancelClick} />;
|
2017-04-21 11:56:59 +00:00
|
|
|
} else if (this.state.searching) {
|
2017-05-30 10:20:41 +00:00
|
|
|
hideCancel = true; // has own cancel
|
2017-10-11 16:56:17 +00:00
|
|
|
aux = <SearchBar ref="search_bar" searchInProgress={this.state.searchInProgress} onCancelClick={this.onCancelSearchClick} onSearch={this.onSearch} />;
|
2017-09-28 21:32:51 +00:00
|
|
|
} else if (this.state.showingPinned) {
|
|
|
|
hideCancel = true; // has own cancel
|
2017-09-28 23:00:26 +00:00
|
|
|
aux = <PinnedEventsPanel room={this.state.room} onCancelClick={this.onPinnedClick} />;
|
2017-04-21 11:56:59 +00:00
|
|
|
} else if (!myMember || myMember.membership !== "join") {
|
2016-03-18 16:06:36 +00:00
|
|
|
// We do have a room object for this room, but we're not currently in it.
|
|
|
|
// We may have a 3rd party invite to it.
|
2016-03-10 15:56:58 +00:00
|
|
|
var inviterName = undefined;
|
|
|
|
if (this.props.oobData) {
|
|
|
|
inviterName = this.props.oobData.inviterName;
|
|
|
|
}
|
2016-03-17 18:38:25 +00:00
|
|
|
var invitedEmail = undefined;
|
|
|
|
if (this.props.thirdPartyInvite) {
|
|
|
|
invitedEmail = this.props.thirdPartyInvite.invitedEmail;
|
|
|
|
}
|
2017-05-30 10:20:41 +00:00
|
|
|
hideCancel = true;
|
2016-02-08 16:43:08 +00:00
|
|
|
aux = (
|
2016-06-24 14:34:07 +00:00
|
|
|
<RoomPreviewBar onJoinClick={this.onJoinButtonClicked}
|
2017-10-11 16:56:17 +00:00
|
|
|
onForgetClick={this.onForgetClick}
|
2016-03-17 18:38:25 +00:00
|
|
|
onRejectClick={this.onRejectThreepidInviteButtonClicked}
|
2017-09-15 14:07:09 +00:00
|
|
|
spinner={this.state.joining}
|
2016-03-10 15:56:58 +00:00
|
|
|
inviterName={inviterName}
|
2016-03-17 18:38:25 +00:00
|
|
|
invitedEmail={invitedEmail}
|
|
|
|
canPreview={this.state.canPeek}
|
2016-04-12 16:18:32 +00:00
|
|
|
room={this.state.room}
|
2016-02-09 16:55:03 +00:00
|
|
|
/>
|
2016-02-08 16:43:08 +00:00
|
|
|
);
|
|
|
|
}
|
2015-12-18 17:23:46 +00:00
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
const auxPanel = (
|
2016-02-23 15:46:27 +00:00
|
|
|
<AuxPanel ref="auxPanel" room={this.state.room}
|
2017-06-13 13:19:38 +00:00
|
|
|
userId={MatrixClientPeg.get().credentials.userId}
|
2016-02-23 15:46:27 +00:00
|
|
|
conferenceHandler={this.props.ConferenceHandler}
|
|
|
|
draggingFile={this.state.draggingFile}
|
|
|
|
displayConfCallNotification={this.state.displayConfCallNotification}
|
|
|
|
maxHeight={this.state.auxPanelMaxHeight}
|
2017-05-17 20:15:57 +00:00
|
|
|
onResize={this.onChildResize}
|
2017-06-27 16:39:29 +00:00
|
|
|
showApps={this.state.showApps && !this.state.editingRoomSettings} >
|
2016-02-23 15:46:27 +00:00
|
|
|
{ aux }
|
|
|
|
</AuxPanel>
|
|
|
|
);
|
2015-12-15 00:01:47 +00:00
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
let messageComposer, searchInfo;
|
|
|
|
const canSpeak = (
|
2016-02-08 16:43:08 +00:00
|
|
|
// joined and not showing search results
|
|
|
|
myMember && (myMember.membership == 'join') && !this.state.searchResults
|
|
|
|
);
|
|
|
|
if (canSpeak) {
|
|
|
|
messageComposer =
|
|
|
|
<MessageComposer
|
2017-05-17 20:15:57 +00:00
|
|
|
room={this.state.room}
|
|
|
|
onResize={this.onChildResize}
|
|
|
|
uploadFile={this.uploadFile}
|
|
|
|
callState={this.state.callState}
|
2017-10-25 10:09:48 +00:00
|
|
|
disabled={this.props.disabled}
|
2017-10-11 16:56:17 +00:00
|
|
|
showApps={this.state.showApps}
|
2017-05-17 20:15:57 +00:00
|
|
|
/>;
|
2016-02-08 16:43:08 +00:00
|
|
|
}
|
2015-12-14 23:37:34 +00:00
|
|
|
|
2016-02-08 16:43:08 +00:00
|
|
|
// TODO: Why aren't we storing the term/scope/count in this format
|
|
|
|
// in this.state if this is what RoomHeader desires?
|
|
|
|
if (this.state.searchResults) {
|
|
|
|
searchInfo = {
|
2017-10-11 16:56:17 +00:00
|
|
|
searchTerm: this.state.searchTerm,
|
|
|
|
searchScope: this.state.searchScope,
|
|
|
|
searchCount: this.state.searchResults.count,
|
2016-02-08 16:43:08 +00:00
|
|
|
};
|
|
|
|
}
|
2015-12-14 23:37:34 +00:00
|
|
|
|
2016-02-08 18:04:54 +00:00
|
|
|
if (inCall) {
|
2017-10-11 16:56:17 +00:00
|
|
|
let zoomButton, voiceMuteButton, videoMuteButton;
|
2016-02-08 16:43:08 +00:00
|
|
|
|
|
|
|
if (call.type === "video") {
|
|
|
|
zoomButton = (
|
2017-10-11 16:56:17 +00:00
|
|
|
<div className="mx_RoomView_voipButton" onClick={this.onFullscreenClick} title={_t("Fill screen")}>
|
|
|
|
<TintableSvg src="img/fullscreen.svg" width="29" height="22" style={{ marginTop: 1, marginRight: 4 }} />
|
2016-02-08 16:43:08 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
videoMuteButton =
|
|
|
|
<div className="mx_RoomView_voipButton" onClick={this.onMuteVideoClick}>
|
2017-02-19 23:43:55 +00:00
|
|
|
<TintableSvg src={call.isLocalVideoMuted() ? "img/video-unmute.svg" : "img/video-mute.svg"}
|
2017-05-23 14:16:31 +00:00
|
|
|
alt={call.isLocalVideoMuted() ? _t("Click to unmute video") : _t("Click to mute video")}
|
2017-10-11 16:56:17 +00:00
|
|
|
width="31" height="27" />
|
2017-01-20 14:22:27 +00:00
|
|
|
</div>;
|
2015-12-14 23:37:34 +00:00
|
|
|
}
|
2016-02-08 16:43:08 +00:00
|
|
|
voiceMuteButton =
|
|
|
|
<div className="mx_RoomView_voipButton" onClick={this.onMuteAudioClick}>
|
2017-02-19 23:43:55 +00:00
|
|
|
<TintableSvg src={call.isMicrophoneMuted() ? "img/voice-unmute.svg" : "img/voice-mute.svg"}
|
2017-05-23 14:16:31 +00:00
|
|
|
alt={call.isMicrophoneMuted() ? _t("Click to unmute audio") : _t("Click to mute audio")}
|
2017-10-11 16:56:17 +00:00
|
|
|
width="21" height="26" />
|
2017-01-20 14:22:27 +00:00
|
|
|
</div>;
|
2015-12-14 23:37:34 +00:00
|
|
|
|
2016-02-08 18:04:54 +00:00
|
|
|
// wrap the existing status bar into a 'callStatusBar' which adds more knobs.
|
2016-02-08 16:43:08 +00:00
|
|
|
statusBar =
|
|
|
|
<div className="mx_RoomView_callStatusBar">
|
|
|
|
{ voiceMuteButton }
|
|
|
|
{ videoMuteButton }
|
|
|
|
{ zoomButton }
|
|
|
|
{ statusBar }
|
2017-10-11 16:56:17 +00:00
|
|
|
<TintableSvg className="mx_RoomView_voipChevron" src="img/voip-chevron.svg" width="22" height="17" />
|
2017-01-20 14:22:27 +00:00
|
|
|
</div>;
|
2016-02-08 16:43:08 +00:00
|
|
|
}
|
2016-02-01 16:31:12 +00:00
|
|
|
|
2016-02-08 16:43:08 +00:00
|
|
|
// if we have search results, we keep the messagepanel (so that it preserves its
|
|
|
|
// scroll state), but hide it.
|
2017-10-11 16:56:17 +00:00
|
|
|
let searchResultsPanel;
|
|
|
|
let hideMessagePanel = false;
|
2016-02-08 16:43:08 +00:00
|
|
|
|
|
|
|
if (this.state.searchResults) {
|
|
|
|
searchResultsPanel = (
|
2016-04-12 16:18:32 +00:00
|
|
|
<ScrollPanel ref="searchResultsPanel"
|
2017-10-25 14:15:49 +00:00
|
|
|
className="mx_RoomView_messagePanel mx_RoomView_searchResultsPanel"
|
2017-10-11 16:56:17 +00:00
|
|
|
onFillRequest={this.onSearchResultsFillRequest}
|
|
|
|
onResize={this.onSearchResultsResize}
|
2016-04-12 16:18:32 +00:00
|
|
|
>
|
2016-02-08 16:43:08 +00:00
|
|
|
<li className={scrollheader_classes}></li>
|
2017-10-11 16:56:17 +00:00
|
|
|
{ this.getSearchResultTiles() }
|
2016-02-08 16:43:08 +00:00
|
|
|
</ScrollPanel>
|
|
|
|
);
|
|
|
|
hideMessagePanel = true;
|
|
|
|
}
|
2015-12-22 15:18:50 +00:00
|
|
|
|
2017-06-08 14:47:41 +00:00
|
|
|
const shouldHighlight = this.state.isInitialEventHighlighted;
|
2017-06-08 13:17:49 +00:00
|
|
|
let highlightedEventId = null;
|
|
|
|
if (this.state.forwardingEvent) {
|
|
|
|
highlightedEventId = this.state.forwardingEvent.getId();
|
|
|
|
} else if (shouldHighlight) {
|
2017-06-08 14:47:41 +00:00
|
|
|
highlightedEventId = this.state.initialEventId;
|
2017-06-08 13:17:49 +00:00
|
|
|
}
|
|
|
|
|
2016-07-20 17:16:54 +00:00
|
|
|
// console.log("ShowUrlPreview for %s is %s", this.state.room.roomId, this.state.showUrlPreview);
|
2017-10-11 16:56:17 +00:00
|
|
|
const messagePanel = (
|
2016-03-08 12:16:34 +00:00
|
|
|
<TimelinePanel ref={this._gatherTimelinePanelRef}
|
2017-08-30 12:32:07 +00:00
|
|
|
timelineSet={this.state.room.getUnfilteredTimelineSet()}
|
2017-10-29 07:43:52 +00:00
|
|
|
showReadReceipts={!SettingsStore.getValue('hideReadReceipts')}
|
2017-10-12 00:43:24 +00:00
|
|
|
manageReadReceipts={!this.state.isPeeking}
|
|
|
|
manageReadMarkers={!this.state.isPeeking}
|
2017-08-30 12:32:07 +00:00
|
|
|
hidden={hideMessagePanel}
|
|
|
|
highlightedEventId={highlightedEventId}
|
|
|
|
eventId={this.state.initialEventId}
|
|
|
|
eventPixelOffset={this.state.initialEventPixelOffset}
|
2017-10-11 16:56:17 +00:00
|
|
|
onScroll={this.onMessageListScroll}
|
|
|
|
onReadMarkerUpdated={this._updateTopUnreadMessagesBar}
|
|
|
|
showUrlPreview = {this.state.showUrlPreview}
|
2017-08-30 12:32:07 +00:00
|
|
|
className="mx_RoomView_messagePanel"
|
2016-02-10 18:27:40 +00:00
|
|
|
/>);
|
2016-02-08 16:43:08 +00:00
|
|
|
|
2017-10-11 16:56:17 +00:00
|
|
|
let topUnreadMessagesBar = null;
|
2016-02-24 17:26:34 +00:00
|
|
|
if (this.state.showTopUnreadMessagesBar) {
|
2017-10-11 16:56:17 +00:00
|
|
|
const TopUnreadMessagesBar = sdk.getComponent('rooms.TopUnreadMessagesBar');
|
2016-02-24 17:26:34 +00:00
|
|
|
topUnreadMessagesBar = (
|
2017-10-25 14:15:49 +00:00
|
|
|
<div className="mx_RoomView_topUnreadMessagesBar">
|
2016-02-24 17:26:34 +00:00
|
|
|
<TopUnreadMessagesBar
|
|
|
|
onScrollUpClick={this.jumpToReadMarker}
|
|
|
|
onCloseClick={this.forgetReadMarker}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-10-25 10:09:48 +00:00
|
|
|
const statusBarAreaClass = classNames(
|
2017-10-25 14:15:49 +00:00
|
|
|
"mx_RoomView_statusArea",
|
2017-10-25 10:09:48 +00:00
|
|
|
{
|
|
|
|
"mx_RoomView_statusArea_expanded": isStatusAreaExpanded,
|
2017-10-25 14:15:49 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
const fadableSectionClasses = classNames(
|
|
|
|
"mx_RoomView_body", "mx_fadable",
|
|
|
|
{
|
2017-10-25 10:09:48 +00:00
|
|
|
"mx_fadable_faded": this.props.disabled,
|
|
|
|
},
|
|
|
|
);
|
2016-02-24 17:26:34 +00:00
|
|
|
|
2016-02-08 16:43:08 +00:00
|
|
|
return (
|
2017-10-11 16:56:17 +00:00
|
|
|
<div className={"mx_RoomView" + (inCall ? " mx_RoomView_inCall" : "")} ref="roomView">
|
2016-02-08 16:43:08 +00:00
|
|
|
<RoomHeader ref="header" room={this.state.room} searchInfo={searchInfo}
|
2016-03-02 11:56:18 +00:00
|
|
|
oobData={this.props.oobData}
|
2016-02-08 16:43:08 +00:00
|
|
|
editing={this.state.editingRoomSettings}
|
2016-04-12 17:01:49 +00:00
|
|
|
saving={this.state.uploadingRoomSettings}
|
2017-05-11 16:35:06 +00:00
|
|
|
inRoom={myMember && myMember.membership === 'join'}
|
2017-10-11 16:56:17 +00:00
|
|
|
collapsedRhs={this.props.collapsedRhs}
|
2016-02-08 16:43:08 +00:00
|
|
|
onSearchClick={this.onSearchClick}
|
|
|
|
onSettingsClick={this.onSettingsClick}
|
2017-09-28 21:32:51 +00:00
|
|
|
onPinnedClick={this.onPinnedClick}
|
2016-02-08 16:43:08 +00:00
|
|
|
onSaveClick={this.onSettingsSaveClick}
|
2017-05-30 10:20:41 +00:00
|
|
|
onCancelClick={(aux && !hideCancel) ? this.onCancelClick : null}
|
|
|
|
onForgetClick={(myMember && myMember.membership === "leave") ? this.onForgetClick : null}
|
|
|
|
onLeaveClick={(myMember && myMember.membership === "join") ? this.onLeaveClick : null}
|
|
|
|
/>
|
2016-02-23 15:46:27 +00:00
|
|
|
{ auxPanel }
|
2017-10-25 14:15:49 +00:00
|
|
|
<div className={fadableSectionClasses}>
|
|
|
|
{ topUnreadMessagesBar }
|
|
|
|
{ messagePanel }
|
|
|
|
{ searchResultsPanel }
|
|
|
|
<div className={statusBarAreaClass}>
|
|
|
|
<div className="mx_RoomView_statusAreaBox">
|
|
|
|
<div className="mx_RoomView_statusAreaBox_line"></div>
|
|
|
|
{ statusBar }
|
|
|
|
</div>
|
2016-02-08 16:43:08 +00:00
|
|
|
</div>
|
2017-10-25 14:15:49 +00:00
|
|
|
{ messageComposer }
|
2016-02-08 16:43:08 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
2015-11-30 17:15:57 +00:00
|
|
|
},
|
|
|
|
});
|