mirror of https://github.com/vector-im/riot-web
Initialise the messagepanel correctly after accepting an invite
This should fix vector-im/vector-web#538. I'm sorry.pull/21833/head
parent
6ee0c72340
commit
e0d05d4f4b
|
@ -77,13 +77,6 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
if (this.refs.messagePanel) {
|
|
||||||
var messagePanel = ReactDOM.findDOMNode(this.refs.messagePanel);
|
|
||||||
messagePanel.removeEventListener('drop', this.onDrop);
|
|
||||||
messagePanel.removeEventListener('dragover', this.onDragOver);
|
|
||||||
messagePanel.removeEventListener('dragleave', this.onDragLeaveOrEnd);
|
|
||||||
messagePanel.removeEventListener('dragend', this.onDragLeaveOrEnd);
|
|
||||||
}
|
|
||||||
dis.unregister(this.dispatcherRef);
|
dis.unregister(this.dispatcherRef);
|
||||||
if (MatrixClientPeg.get()) {
|
if (MatrixClientPeg.get()) {
|
||||||
MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline);
|
MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline);
|
||||||
|
@ -285,16 +278,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
if (this.refs.messagePanel) {
|
if (this.refs.messagePanel) {
|
||||||
var messagePanel = ReactDOM.findDOMNode(this.refs.messagePanel);
|
this._initialiseMessagePanel();
|
||||||
|
|
||||||
messagePanel.addEventListener('drop', this.onDrop);
|
|
||||||
messagePanel.addEventListener('dragover', this.onDragOver);
|
|
||||||
messagePanel.addEventListener('dragleave', this.onDragLeaveOrEnd);
|
|
||||||
messagePanel.addEventListener('dragend', this.onDragLeaveOrEnd);
|
|
||||||
|
|
||||||
this.scrollToBottom();
|
|
||||||
this.sendReadReceipt();
|
|
||||||
this.fillSpace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var call = CallHandler.getCallForRoom(this.props.roomId);
|
var call = CallHandler.getCallForRoom(this.props.roomId);
|
||||||
|
@ -309,19 +293,37 @@ module.exports = React.createClass({
|
||||||
this.onResize();
|
this.onResize();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_initialiseMessagePanel: function() {
|
||||||
|
var messagePanel = ReactDOM.findDOMNode(this.refs.messagePanel);
|
||||||
|
this.refs.messagePanel.initialised = true;
|
||||||
|
|
||||||
|
messagePanel.addEventListener('drop', this.onDrop);
|
||||||
|
messagePanel.addEventListener('dragover', this.onDragOver);
|
||||||
|
messagePanel.addEventListener('dragleave', this.onDragLeaveOrEnd);
|
||||||
|
messagePanel.addEventListener('dragend', this.onDragLeaveOrEnd);
|
||||||
|
|
||||||
|
this.scrollToBottom();
|
||||||
|
this.sendReadReceipt();
|
||||||
|
this.fillSpace();
|
||||||
|
},
|
||||||
|
|
||||||
componentDidUpdate: function() {
|
componentDidUpdate: function() {
|
||||||
|
// we need to initialise the messagepanel if we've just joined the
|
||||||
|
// room. TODO: we really really ought to factor out messagepanel to a
|
||||||
|
// separate component to avoid this ridiculous dance.
|
||||||
|
if (!this.refs.messagePanel) return;
|
||||||
|
|
||||||
|
if (!this.refs.messagePanel.initialised) {
|
||||||
|
this._initialiseMessagePanel();
|
||||||
|
}
|
||||||
|
|
||||||
// after adding event tiles, we may need to tweak the scroll (either to
|
// after adding event tiles, we may need to tweak the scroll (either to
|
||||||
// keep at the bottom of the timeline, or to maintain the view after
|
// keep at the bottom of the timeline, or to maintain the view after
|
||||||
// adding events to the top).
|
// adding events to the top).
|
||||||
|
|
||||||
if (!this.refs.messagePanel) return;
|
|
||||||
|
|
||||||
if (this.state.searchResults) return;
|
if (this.state.searchResults) return;
|
||||||
|
|
||||||
this._restoreSavedScrollState();
|
this._restoreSavedScrollState();
|
||||||
|
|
||||||
// have to fill space in case we're accepting an invite
|
|
||||||
if (!this.state.paginating) this.fillSpace();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_paginateCompleted: function() {
|
_paginateCompleted: function() {
|
||||||
|
|
Loading…
Reference in New Issue