Add UI in UserSettings for bulk rejecting invites

This commit is contained in:
Kegan Dougal 2016-12-14 15:01:50 +00:00
parent 1fbc938f87
commit 1d4591ce68

View file

@ -280,6 +280,10 @@ module.exports = React.createClass({
Modal.createDialog(DeactivateAccountDialog, {}); Modal.createDialog(DeactivateAccountDialog, {});
}, },
_onRejectAllInvitesClicked: function() {
console.log("yup");
},
_renderUserInterfaceSettings: function() { _renderUserInterfaceSettings: function() {
var client = MatrixClientPeg.get(); var client = MatrixClientPeg.get();
@ -418,6 +422,24 @@ module.exports = React.createClass({
</div>; </div>;
}, },
_renderBulkOptions: function() {
let invitedRooms = MatrixClientPeg.get().getRooms().filter((r) => {
return r.hasMembershipState(this._me, "invite");
});
if (invitedRooms.length === 0) {
return null;
}
return <div>
<h3>Bulk Options</h3>
<div className="mx_UserSettings_section">
<button className="mx_UserSettings_button danger"
onClick={this._onRejectAllInvitesClicked}>
Reject all {invitedRooms.length} invites
</button>
</div>
</div>;
},
render: function() { render: function() {
var self = this; var self = this;
var Loader = sdk.getComponent("elements.Spinner"); var Loader = sdk.getComponent("elements.Spinner");
@ -580,6 +602,7 @@ module.exports = React.createClass({
{this._renderLabs()} {this._renderLabs()}
{this._renderDevicesPanel()} {this._renderDevicesPanel()}
{this._renderCryptoInfo()} {this._renderCryptoInfo()}
{this._renderBulkOptions()}
<h3>Advanced</h3> <h3>Advanced</h3>