Migrate away from Legacy React Contexts

This commit is contained in:
Michael Telatynski 2019-12-17 17:26:12 +00:00
parent 2e8d66fa36
commit 937b32663c
55 changed files with 651 additions and 750 deletions

View file

@ -22,6 +22,7 @@ import { Draggable, Droppable } from 'react-beautiful-dnd';
import sdk from '../../../index';
import dis from '../../../dispatcher';
import FlairStore from '../../../stores/FlairStore';
import MatrixClientContext from "../../../contexts/MatrixClientContext";
function nop() {}
@ -37,8 +38,8 @@ const GroupTile = createReactClass({
draggable: PropTypes.bool,
},
contextTypes: {
matrixClient: PropTypes.instanceOf(MatrixClient).isRequired,
statics: {
contextType: MatrixClientContext,
},
getInitialState() {
@ -56,7 +57,7 @@ const GroupTile = createReactClass({
},
componentWillMount: function() {
FlairStore.getGroupProfileCached(this.context.matrixClient, this.props.groupId).then((profile) => {
FlairStore.getGroupProfileCached(this.context, this.props.groupId).then((profile) => {
this.setState({profile});
}).catch((err) => {
console.error('Error whilst getting cached profile for GroupTile', err);
@ -80,7 +81,7 @@ const GroupTile = createReactClass({
const descElement = this.props.showDescription ?
<div className="mx_GroupTile_desc">{ profile.shortDescription }</div> :
<div />;
const httpUrl = profile.avatarUrl ? this.context.matrixClient.mxcUrlToHttp(
const httpUrl = profile.avatarUrl ? this.context.mxcUrlToHttp(
profile.avatarUrl, avatarHeight, avatarHeight, "crop") : null;
let avatarElement = (