mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 02:05:45 +03:00
Simplify event index store reset flow
This commit is contained in:
parent
e53a8ad992
commit
b38f5c9459
4 changed files with 14 additions and 22 deletions
|
@ -36,8 +36,8 @@ export default class SeshatResetDialog extends React.PureComponent<IProps> {
|
|||
<div>
|
||||
<p>
|
||||
{_t(
|
||||
"Your event store appears corrupted. " +
|
||||
"This action will restart this application.",
|
||||
"Your event store appears to be corrupted. " +
|
||||
"Your messages will be re-indexed as soon as the store is initialised.",
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -123,11 +123,15 @@ export default class EventIndexPanel extends React.Component {
|
|||
await this.updateState();
|
||||
}
|
||||
|
||||
_confirmEventStoreReset() {
|
||||
Modal.createDialog(SeshatResetDialog, {
|
||||
onFinished: (success) => {
|
||||
_confirmEventStoreReset = () => {
|
||||
const self = this;
|
||||
const { close } = Modal.createDialog(SeshatResetDialog, {
|
||||
onFinished: async (success) => {
|
||||
if (success) {
|
||||
EventIndexPeg.resetEventStore();
|
||||
await SettingsStore.setValue('enableEventIndexing', null, SettingLevel.DEVICE, false);
|
||||
await EventIndexPeg.deleteEventIndex();
|
||||
await self._onEnable();
|
||||
close();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -223,7 +227,10 @@ export default class EventIndexPanel extends React.Component {
|
|||
eventIndexingSettings = (
|
||||
<div className='mx_SettingsTab_subsectionText'>
|
||||
<p>
|
||||
{_t("Message search initilisation failed")}
|
||||
{this.state.enabling
|
||||
? <InlineSpinner />
|
||||
: _t("Message search initilisation failed")
|
||||
}
|
||||
</p>
|
||||
{EventIndexPeg.error && (
|
||||
<details>
|
||||
|
|
|
@ -309,14 +309,4 @@ export default abstract class BaseEventIndexManager {
|
|||
async deleteEventIndex(): Promise<void> {
|
||||
throw new Error("Unimplemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset a potentially corrupted event store
|
||||
*
|
||||
* @return {Promise} A promise that will resolve once the event store has
|
||||
* been deleted.
|
||||
*/
|
||||
async resetEventStore(): Promise<void> {
|
||||
throw new Error("Unimplemented");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,11 +179,6 @@ class EventIndexPeg {
|
|||
await indexManager.deleteEventIndex();
|
||||
}
|
||||
}
|
||||
|
||||
resetEventStore() {
|
||||
const indexManager = PlatformPeg.get().getEventIndexingManager();
|
||||
return indexManager.resetEventStore();
|
||||
}
|
||||
}
|
||||
|
||||
if (!global.mxEventIndexPeg) {
|
||||
|
|
Loading…
Reference in a new issue