This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 830
Add support for deleting threepids #597
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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((e) => { | ||
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(); | ||
|
@@ -483,7 +508,6 @@ module.exports = React.createClass({ | |
}, | ||
|
||
render: function() { | ||
var self = this; | ||
var Loader = sdk.getComponent("elements.Spinner"); | ||
switch (this.state.phase) { | ||
case "UserSettings.LOADING": | ||
|
@@ -507,7 +531,7 @@ module.exports = React.createClass({ | |
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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return ( | ||
<div className="mx_UserSettings_profileTableRow" key={pidIndex}> | ||
|
@@ -517,6 +541,9 @@ module.exports = React.createClass({ | |
<div className="mx_UserSettings_profileInputCell"> | ||
<input key={val.address} id={id} value={val.address} disabled /> | ||
</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> | ||
); | ||
}); | ||
|
@@ -537,7 +564,7 @@ module.exports = React.createClass({ | |
blurToCancel={ false } | ||
onValueChanged={ this.onAddThreepidClicked } /> | ||
</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) }/> | ||
</div> | ||
</div> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will creating a modal from within an existing modal work? I vaguely remember having to put the second create into a setTimeout(0) to let the other one first disappear...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empirically it seems to be fine (although I did get the variable name wrong)