ManageEventIndex: Remove the enable button, that one goes somewhere else.

pull/21833/head
Damir Jelić 2020-01-23 14:26:35 +01:00
parent c251031dfb
commit 5ac37c8694
1 changed files with 25 additions and 61 deletions

View File

@ -45,8 +45,6 @@ export default class ManageEventIndex extends React.Component {
eventCount: 0, eventCount: 0,
roomCount: 0, roomCount: 0,
currentRoom: null, currentRoom: null,
eventIndexingEnabled:
SettingsStore.getValueAt(SettingLevel.DEVICE, 'enableEventIndexing'),
}; };
} }
@ -108,22 +106,14 @@ export default class ManageEventIndex extends React.Component {
); );
} }
_onEnable = async () => {
this.props.onFinished(false);
}
_onDone = () => { _onDone = () => {
this.props.onFinished(true); this.props.onFinished(true);
} }
render() { render() {
let eventIndexingSettings = null;
let buttons;
let crawlerState; let crawlerState;
if (!this.state.eventIndexingEnabled) { if (this.state.currentRoom === null) {
crawlerState = _t("Message search for encrypted rooms is disabled.");
} else if (this.state.currentRoom === null) {
crawlerState = _t("Not downloading messages for any room."); crawlerState = _t("Not downloading messages for any room.");
} else { } else {
crawlerState = ( crawlerState = (
@ -131,58 +121,32 @@ export default class ManageEventIndex extends React.Component {
); );
} }
if (EventIndexPeg.get() !== null) { const eventIndexingSettings = (
eventIndexingSettings = ( <div>
<div> {
{ _t( "Riot is securely caching encrypted messages locally for them " +
_t( "Riot is securely caching encrypted messages locally for them " + "to appear in search results:",
"to appear in search results:", )
) }
} <div className='mx_SettingsTab_subsectionText'>
<div className='mx_SettingsTab_subsectionText'> {_t("Space used:")} {formatBytes(this.state.eventIndexSize, 0)}<br />
{_t("Space used:")} {formatBytes(this.state.eventIndexSize, 0)}<br /> {_t("Indexed messages:")} {this.state.eventCount}<br />
{_t("Indexed messages:")} {this.state.eventCount}<br /> {_t("Number of rooms:")} {this.state.roomCount}<br />
{_t("Number of rooms:")} {this.state.roomCount}<br /> {crawlerState}<br />
{crawlerState}<br />
</div>
</div> </div>
); </div>
);
buttons = ( const buttons = (
<div className="mx_Dialog_buttons"> <div className="mx_Dialog_buttons">
<AccessibleButton kind="secondary" onClick={this._onDisable}> <AccessibleButton kind="secondary" onClick={this._onDisable}>
{_t("Disable")} {_t("Disable")}
</AccessibleButton> </AccessibleButton>
<AccessibleButton kind="primary" onClick={this._onDone}> <AccessibleButton kind="primary" onClick={this._onDone}>
{_t("Done")} {_t("Done")}
</AccessibleButton> </AccessibleButton>
</div> </div>
); );
} else if (!this.state.eventIndexingEnabled && this.state.eventIndexingInstalled) {
eventIndexingSettings = (
<div>
{_t( "Securely cache encrypted messages locally for them to appear in search results.")}
</div>
);
buttons = (
<div className="mx_Dialog_buttons">
<AccessibleButton kind="primary" onClick={this._onEnable}>
{_t("Enable")}
</AccessibleButton>
</div>
);
} else {
eventIndexingSettings = (
<div>
{
_t( "Riot can't securely cache encrypted messages locally" +
"while running in a web browser. Use Riot Desktop for" +
"encrypted messages to appear in search results.",
)
}
</div>
);
}
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');