Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit b38f5c9

Browse files
committed
Simplify event index store reset flow
1 parent e53a8ad commit b38f5c9

File tree

4 files changed

+14
-22
lines changed

4 files changed

+14
-22
lines changed

src/components/views/dialogs/SeshatResetDialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ export default class SeshatResetDialog extends React.PureComponent<IProps> {
3636
<div>
3737
<p>
3838
{_t(
39-
"Your event store appears corrupted. " +
40-
"This action will restart this application.",
39+
"Your event store appears to be corrupted. " +
40+
"Your messages will be re-indexed as soon as the store is initialised.",
4141
)}
4242
</p>
4343
</div>

src/components/views/settings/EventIndexPanel.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,15 @@ export default class EventIndexPanel extends React.Component {
123123
await this.updateState();
124124
}
125125

126-
_confirmEventStoreReset() {
127-
Modal.createDialog(SeshatResetDialog, {
128-
onFinished: (success) => {
126+
_confirmEventStoreReset = () => {
127+
const self = this;
128+
const { close } = Modal.createDialog(SeshatResetDialog, {
129+
onFinished: async (success) => {
129130
if (success) {
130-
EventIndexPeg.resetEventStore();
131+
await SettingsStore.setValue('enableEventIndexing', null, SettingLevel.DEVICE, false);
132+
await EventIndexPeg.deleteEventIndex();
133+
await self._onEnable();
134+
close();
131135
}
132136
},
133137
});
@@ -223,7 +227,10 @@ export default class EventIndexPanel extends React.Component {
223227
eventIndexingSettings = (
224228
<div className='mx_SettingsTab_subsectionText'>
225229
<p>
226-
{_t("Message search initilisation failed")}
230+
{this.state.enabling
231+
? <InlineSpinner />
232+
: _t("Message search initilisation failed")
233+
}
227234
</p>
228235
{EventIndexPeg.error && (
229236
<details>

src/indexing/BaseEventIndexManager.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,4 @@ export default abstract class BaseEventIndexManager {
309309
async deleteEventIndex(): Promise<void> {
310310
throw new Error("Unimplemented");
311311
}
312-
313-
/**
314-
* Reset a potentially corrupted event store
315-
*
316-
* @return {Promise} A promise that will resolve once the event store has
317-
* been deleted.
318-
*/
319-
async resetEventStore(): Promise<void> {
320-
throw new Error("Unimplemented");
321-
}
322312
}

src/indexing/EventIndexPeg.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,6 @@ class EventIndexPeg {
179179
await indexManager.deleteEventIndex();
180180
}
181181
}
182-
183-
resetEventStore() {
184-
const indexManager = PlatformPeg.get().getEventIndexingManager();
185-
return indexManager.resetEventStore();
186-
}
187182
}
188183

189184
if (!global.mxEventIndexPeg) {

0 commit comments

Comments
 (0)