mirror of https://github.com/vector-im/riot-web
Merge pull request #597 from matrix-org/dbkr/delete_threepid
Add support for deleting threepidspull/21833/head
commit
fd44d9f4d6
|
@ -248,6 +248,31 @@ module.exports = React.createClass({
|
||||||
this.setState({email_add_pending: true});
|
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) {
|
onEmailDialogFinished: function(ok) {
|
||||||
if (ok) {
|
if (ok) {
|
||||||
this.verifyEmailAddress();
|
this.verifyEmailAddress();
|
||||||
|
@ -488,7 +513,6 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var self = this;
|
|
||||||
var Loader = sdk.getComponent("elements.Spinner");
|
var Loader = sdk.getComponent("elements.Spinner");
|
||||||
switch (this.state.phase) {
|
switch (this.state.phase) {
|
||||||
case "UserSettings.LOADING":
|
case "UserSettings.LOADING":
|
||||||
|
@ -512,8 +536,8 @@ module.exports = React.createClass({
|
||||||
this.state.avatarUrl ? MatrixClientPeg.get().mxcUrlToHttp(this.state.avatarUrl) : null
|
this.state.avatarUrl ? MatrixClientPeg.get().mxcUrlToHttp(this.state.avatarUrl) : null
|
||||||
);
|
);
|
||||||
|
|
||||||
var threepidsSection = this.state.threepids.map(function(val, pidIndex) {
|
var threepidsSection = this.state.threepids.map((val, pidIndex) => {
|
||||||
var id = "email-" + val.address;
|
const id = "3pid-" + val.address;
|
||||||
return (
|
return (
|
||||||
<div className="mx_UserSettings_profileTableRow" key={pidIndex}>
|
<div className="mx_UserSettings_profileTableRow" key={pidIndex}>
|
||||||
<div className="mx_UserSettings_profileLabelCell">
|
<div className="mx_UserSettings_profileLabelCell">
|
||||||
|
@ -522,6 +546,9 @@ module.exports = React.createClass({
|
||||||
<div className="mx_UserSettings_profileInputCell">
|
<div className="mx_UserSettings_profileInputCell">
|
||||||
<input key={val.address} id={id} value={val.address} disabled />
|
<input key={val.address} id={id} value={val.address} disabled />
|
||||||
</div>
|
</div>
|
||||||
|
<div className="mx_UserSettings_threepidButton">
|
||||||
|
<img src="img/icon_context_delete.svg" width="14" height="14" alt="Remove" onClick={this.onRemoveThreepidClicked.bind(this, val)} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -542,7 +569,7 @@ module.exports = React.createClass({
|
||||||
blurToCancel={ false }
|
blurToCancel={ false }
|
||||||
onValueChanged={ this.onAddThreepidClicked } />
|
onValueChanged={ this.onAddThreepidClicked } />
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_UserSettings_addThreepid">
|
<div className="mx_UserSettings_threepidButton">
|
||||||
<img src="img/plus.svg" width="14" height="14" alt="Add" onClick={ this.onAddThreepidClicked.bind(this, undefined, true) }/>
|
<img src="img/plus.svg" width="14" height="14" alt="Add" onClick={ this.onAddThreepidClicked.bind(this, undefined, true) }/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue