Fix some stuff

This commit is contained in:
Michael Telatynski 2020-08-29 12:51:37 +01:00
parent 34b960d8cb
commit 78812b6f85
9 changed files with 51 additions and 42 deletions

View file

@ -43,8 +43,8 @@ export default class EmbeddedPage extends React.PureComponent {
static contextType = MatrixClientContext;
constructor(props) {
super(props);
constructor(props, context) {
super(props, context);
this._dispatcherRef = null;

View file

@ -42,8 +42,8 @@ export default class RightPanel extends React.Component {
static contextType = MatrixClientContext;
constructor(props) {
super(props);
constructor(props, context) {
super(props, context);
this.state = {
phase: this._getPhaseFromProps(),
isUserPrivilegedInGroup: null,

View file

@ -99,8 +99,8 @@ export default class RoomView extends React.Component {
static contextType = MatrixClientContext;
constructor(props) {
super(props);
constructor(props, context) {
super(props, context);
const llMembers = this.context.hasLazyLoadMembersEnabled();
this.state = {
@ -186,7 +186,6 @@ export default class RoomView extends React.Component {
// Start listening for RoomViewStore updates
this._roomStoreToken = RoomViewStore.addListener(this._onRoomViewStoreUpdate);
this._rightPanelStoreToken = RightPanelStore.getSharedInstance().addListener(this._onRightPanelStoreUpdate);
this._onRoomViewStoreUpdate(true);
WidgetEchoStore.on('update', this._onWidgetEchoStoreUpdate);
this._showReadReceiptsWatchRef = SettingsStore.watchSetting("showReadReceipts", null,
@ -198,6 +197,11 @@ export default class RoomView extends React.Component {
this._layoutWatcherRef = SettingsStore.watchSetting("useIRCLayout", null, this.onLayoutChange);
}
// TODO: [REACT-WARNING] Move into constructor
UNSAFE_componentWillMount() {
this._onRoomViewStoreUpdate(true);
}
_onReadReceiptsChange = () => {
this.setState({
showReadReceipts: SettingsStore.getValue("showReadReceipts", this.state.roomId),

View file

@ -134,13 +134,6 @@ class TimelinePanel extends React.Component {
this._messagePanel = createRef();
if (this.props.manageReadReceipts) {
this.updateReadReceiptOnUserActivity();
}
if (this.props.manageReadMarkers) {
this.updateReadMarkerOnUserActivity();
}
// XXX: we could track RM per TimelineSet rather than per Room.
// but for now we just do it per room for simplicity.
let initialReadMarker = null;
@ -225,6 +218,16 @@ class TimelinePanel extends React.Component {
MatrixClientPeg.get().on("Event.decrypted", this.onEventDecrypted);
MatrixClientPeg.get().on("Event.replaced", this.onEventReplaced);
MatrixClientPeg.get().on("sync", this.onSync);
}
// TODO: [REACT-WARNING] Move into constructor
UNSAFE_componentWillMount() {
if (this.props.manageReadReceipts) {
this.updateReadReceiptOnUserActivity();
}
if (this.props.manageReadMarkers) {
this.updateReadMarkerOnUserActivity();
}
this._initTimeline(this.props);
}
@ -1360,9 +1363,7 @@ class TimelinePanel extends React.Component {
});
}
getRelationsForEvent(...args) {
return this.props.timelineSet.getRelationsForEvent(...args);
}
getRelationsForEvent = (...args) => this.props.timelineSet.getRelationsForEvent(...args);
render() {
const MessagePanel = sdk.getComponent("structures.MessagePanel");