Merge pull request #708 from matrix-org/kegan/clear-cache

Add a 'Clear Cache' button
pull/21833/head
Kegsay 2017-02-17 15:51:08 +00:00 committed by GitHub
commit 5abcb91e0d
1 changed files with 22 additions and 0 deletions

View File

@ -418,6 +418,14 @@ module.exports = React.createClass({
Modal.createDialog(BugReportDialog, {}); Modal.createDialog(BugReportDialog, {});
}, },
_onClearCacheClicked: function() {
MatrixClientPeg.get().store.deleteAllData().done(() => {
// forceReload=false since we don't really need new HTML/JS files
// we just need to restart the JS runtime.
window.location.reload(false);
});
},
_onInviteStateChange: function(event, member, oldMembership) { _onInviteStateChange: function(event, member, oldMembership) {
if (member.userId === this._me && oldMembership === "invite") { if (member.userId === this._me && oldMembership === "invite") {
this.forceUpdate(); this.forceUpdate();
@ -690,6 +698,18 @@ module.exports = React.createClass({
</div>; </div>;
}, },
_renderClearCache: function() {
return <div>
<h3>Clear Cache</h3>
<div className="mx_UserSettings_section">
<AccessibleButton className="mx_UserSettings_button danger"
onClick={this._onClearCacheClicked}>
Clear Cache and Reload
</AccessibleButton>
</div>
</div>;
},
_renderBulkOptions: function() { _renderBulkOptions: function() {
let invitedRooms = MatrixClientPeg.get().getRooms().filter((r) => { let invitedRooms = MatrixClientPeg.get().getRooms().filter((r) => {
return r.hasMembershipState(this._me, "invite"); return r.hasMembershipState(this._me, "invite");
@ -913,6 +933,8 @@ module.exports = React.createClass({
</div> </div>
</div> </div>
{this._renderClearCache()}
{this._renderDeactivateAccount()} {this._renderDeactivateAccount()}
</GeminiScrollbar> </GeminiScrollbar>