From 9bee024da71b7faa06b3c1cec379b0c692d9b895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 23 Jan 2020 12:24:06 +0100 Subject: [PATCH] ManageEventIndex: Remove some useless divs and add the enable case. --- .../dialogs/eventindex/ManageEventIndex.js | 69 ++++++++++--------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/src/async-components/views/dialogs/eventindex/ManageEventIndex.js b/src/async-components/views/dialogs/eventindex/ManageEventIndex.js index d9a0cdcb5d..754d1b8516 100644 --- a/src/async-components/views/dialogs/eventindex/ManageEventIndex.js +++ b/src/async-components/views/dialogs/eventindex/ManageEventIndex.js @@ -116,7 +116,11 @@ export default class ManageEventIndex extends React.Component { SettingsStore.setValue("crawlerSleepTime", null, SettingLevel.DEVICE, e.target.value); } - _onDisable = () => { + _onDisable = async () => { + this.props.onFinished(false); + } + + _onEnable = async () => { this.props.onFinished(false); } @@ -126,17 +130,16 @@ export default class ManageEventIndex extends React.Component { render() { let eventIndexingSettings = null; + let buttons; let crawlerState; if (!this.state.eventIndexingEnabled) { - crawlerState =
{_t("Message search for encrypted rooms is disabled.")}
; + 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 { crawlerState = ( -
- {_t("Downloading mesages for %(currentRoom)s.", { currentRoom: this.state.currentRoom })} -
+ _t("Downloading mesages for %(currentRoom)s.", { currentRoom: this.state.currentRoom }) ); } @@ -154,18 +157,30 @@ export default class ManageEventIndex extends React.Component { {_t("Number of rooms:")} {this.state.roomCount}
{crawlerState}
+ + ); - - - + buttons = ( +
+ + {_t("Disable")} + + + {_t("Done")} + +
+ ); + } else if (!this.state.eventIndexingEnabled && this.state.eventIndexingInstalled) { + eventIndexingSettings = ( +
+ {_t( "Securely cache encrypted messages locally for them to appear in search results.")} +
+ ); + buttons = ( +
+ + {_t("Enable")} +
); } else { @@ -182,28 +197,14 @@ export default class ManageEventIndex extends React.Component { } const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); - const buttons =
-
- - {_t("Disable")} - - - {_t("Done")} - -
-
; return ( {}} + onFinished={this.props.onFinished} title={_t("Message search")} > -
- {eventIndexingSettings} -
-
- {buttons} -
+ {eventIndexingSettings} + {buttons}
); }