diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 45f42fea54..a41eab3a76 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -248,6 +248,31 @@ module.exports = React.createClass({ this.setState({email_add_pending: true}); }, + onRemoveThreepidClicked: function(threepid) { + const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); + Modal.createDialog(QuestionDialog, { + title: "Remove Contact Information?", + description: "Remove " + threepid.address + "?", + button: 'Remove', + onFinished: (submit) => { + if (submit) { + this.setState({ + phase: "UserSettings.LOADING", + }); + MatrixClientPeg.get().deleteThreePid(threepid.medium, threepid.address).then(() => { + return this._refreshFromServer(); + }).catch((err) => { + const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + Modal.createDialog(ErrorDialog, { + title: "Unable to remove contact information", + description: err.toString(), + }); + }).done(); + } + }, + }); + }, + onEmailDialogFinished: function(ok) { if (ok) { this.verifyEmailAddress(); @@ -488,7 +513,6 @@ module.exports = React.createClass({ }, render: function() { - var self = this; var Loader = sdk.getComponent("elements.Spinner"); switch (this.state.phase) { case "UserSettings.LOADING": @@ -512,8 +536,8 @@ module.exports = React.createClass({ this.state.avatarUrl ? MatrixClientPeg.get().mxcUrlToHttp(this.state.avatarUrl) : null ); - var threepidsSection = this.state.threepids.map(function(val, pidIndex) { - var id = "email-" + val.address; + var threepidsSection = this.state.threepids.map((val, pidIndex) => { + const id = "3pid-" + val.address; return (