Pass around MatrixClients instead of using MatrixClientPeg (#11000)
This commit is contained in:
parent
aa5a2e1363
commit
938aefc51c
28 changed files with 176 additions and 141 deletions
|
@ -181,7 +181,7 @@ export default class EmailAddresses extends React.Component<IProps, IState> {
|
|||
return;
|
||||
}
|
||||
|
||||
const task = new AddThreepid();
|
||||
const task = new AddThreepid(MatrixClientPeg.get());
|
||||
this.setState({ verifying: true, continueDisabled: true, addTask: task });
|
||||
|
||||
task.addEmailAddress(email)
|
||||
|
|
|
@ -182,7 +182,7 @@ export default class PhoneNumbers extends React.Component<IProps, IState> {
|
|||
const phoneNumber = this.state.newPhoneNumber;
|
||||
const phoneCountry = this.state.phoneCountry;
|
||||
|
||||
const task = new AddThreepid();
|
||||
const task = new AddThreepid(MatrixClientPeg.get());
|
||||
this.setState({ verifying: true, continueDisabled: true, addTask: task });
|
||||
|
||||
task.addMsisdn(phoneCountry, phoneNumber)
|
||||
|
|
|
@ -86,7 +86,7 @@ export class EmailAddress extends React.Component<IEmailAddressProps, IEmailAddr
|
|||
|
||||
try {
|
||||
if (bind) {
|
||||
const task = new AddThreepid();
|
||||
const task = new AddThreepid(MatrixClientPeg.get());
|
||||
this.setState({
|
||||
verifying: true,
|
||||
continueDisabled: true,
|
||||
|
@ -117,7 +117,7 @@ export class EmailAddress extends React.Component<IEmailAddressProps, IEmailAddr
|
|||
private async changeBindingTangledAddBind({ bind, label, errorTitle }: Binding): Promise<void> {
|
||||
const { medium, address } = this.props.email;
|
||||
|
||||
const task = new AddThreepid();
|
||||
const task = new AddThreepid(MatrixClientPeg.get());
|
||||
this.setState({
|
||||
verifying: true,
|
||||
continueDisabled: true,
|
||||
|
|
|
@ -82,7 +82,7 @@ export class PhoneNumber extends React.Component<IPhoneNumberProps, IPhoneNumber
|
|||
|
||||
try {
|
||||
if (bind) {
|
||||
const task = new AddThreepid();
|
||||
const task = new AddThreepid(MatrixClientPeg.get());
|
||||
this.setState({
|
||||
verifying: true,
|
||||
continueDisabled: true,
|
||||
|
@ -118,7 +118,7 @@ export class PhoneNumber extends React.Component<IPhoneNumberProps, IPhoneNumber
|
|||
private async changeBindingTangledAddBind({ bind, label, errorTitle }: Binding): Promise<void> {
|
||||
const { medium, address } = this.props.msisdn;
|
||||
|
||||
const task = new AddThreepid();
|
||||
const task = new AddThreepid(MatrixClientPeg.get());
|
||||
this.setState({
|
||||
verifying: true,
|
||||
continueDisabled: true,
|
||||
|
|
|
@ -215,7 +215,7 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
|
|||
|
||||
const [shouldCreate, opts] = await modal.finished;
|
||||
if (shouldCreate) {
|
||||
await createRoom(opts);
|
||||
await createRoom(this.context, opts);
|
||||
}
|
||||
return shouldCreate;
|
||||
};
|
||||
|
|
|
@ -35,6 +35,7 @@ import SettingsTab from "../SettingsTab";
|
|||
import { SettingsSection } from "../../shared/SettingsSection";
|
||||
import SettingsSubsection, { SettingsSubsectionText } from "../../shared/SettingsSubsection";
|
||||
import ExternalLink from "../../../elements/ExternalLink";
|
||||
import MatrixClientContext from "../../../../../contexts/MatrixClientContext";
|
||||
|
||||
interface IProps {
|
||||
closeSettingsFn: () => void;
|
||||
|
@ -46,6 +47,9 @@ interface IState {
|
|||
}
|
||||
|
||||
export default class HelpUserSettingsTab extends React.Component<IProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
|
@ -104,7 +108,7 @@ export default class HelpUserSettingsTab extends React.Component<IProps, IState>
|
|||
|
||||
private onStartBotChat = (): void => {
|
||||
this.props.closeSettingsFn();
|
||||
createRoom({
|
||||
createRoom(this.context, {
|
||||
dmUserId: SdkConfig.get("welcome_user_id"),
|
||||
andView: true,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue