mirror of https://github.com/vector-im/riot-web
consolidate call onPageUnload handler into RoomView
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
356d29939c
commit
9d92f93fcb
|
@ -100,10 +100,6 @@ module.exports = React.createClass({
|
|||
this._checkSize();
|
||||
},
|
||||
|
||||
componentDidMount: function() {
|
||||
window.addEventListener('beforeunload', this.onPageUnload);
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
this._checkSize();
|
||||
},
|
||||
|
@ -115,7 +111,6 @@ module.exports = React.createClass({
|
|||
client.removeListener("sync", this.onSyncStateChange);
|
||||
client.removeListener("RoomMember.typing", this.onRoomMemberTyping);
|
||||
}
|
||||
window.removeEventListener('beforeunload', this.onPageUnload);
|
||||
},
|
||||
|
||||
onSyncStateChange: function(state, prevState) {
|
||||
|
@ -133,13 +128,6 @@ module.exports = React.createClass({
|
|||
});
|
||||
},
|
||||
|
||||
onPageUnload(event) {
|
||||
if (this.props.hasActiveCall) {
|
||||
return event.returnValue =
|
||||
'You seem to be in a call, are you sure you want to quit?';
|
||||
}
|
||||
},
|
||||
|
||||
// Check whether current size is greater than 0, if yes call props.onVisible
|
||||
_checkSize: function () {
|
||||
if (this.props.onVisible && this._getSize()) {
|
||||
|
|
|
@ -371,6 +371,9 @@ module.exports = React.createClass({
|
|||
if (ContentMessages.getCurrentUploads().length > 0) {
|
||||
return event.returnValue =
|
||||
'You seem to be uploading files, are you sure you want to quit?';
|
||||
} else if (this._getCallForRoom() && this.state.callState !== 'ended') {
|
||||
return event.returnValue =
|
||||
'You seem to be in a call, are you sure you want to quit?';
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue