diff --git a/src/public/app/widgets/dialogs/recent_changes.js b/src/public/app/widgets/dialogs/recent_changes.js
index 85b56e90d..467768721 100644
--- a/src/public/app/widgets/dialogs/recent_changes.js
+++ b/src/public/app/widgets/dialogs/recent_changes.js
@@ -7,6 +7,7 @@ import appContext from "../../services/app_context.js";
import hoistedNoteService from "../../services/hoisted_note.js";
import BasicWidget from "../basic_widget.js";
import dialogService from "../dialog.js";
+import toastService from "../../services/toast.js";
const TPL = `
@@ -14,7 +15,11 @@ const TPL = `
@@ -29,20 +34,30 @@ export default class RecentChangesDialog extends BasicWidget {
doRender() {
this.$widget = $(TPL);
this.$content = this.$widget.find(".recent-changes-content");
+ this.$eraseDeletedNotesNow = this.$widget.find(".erase-deleted-notes-now-button");
+ this.$eraseDeletedNotesNow.on("click", () => {
+ server.post('notes/erase-deleted-notes-now').then(() => {
+ this.refresh();
+
+ toastService.showMessage("Deleted notes have been erased.");
+ });
+ });
}
async showRecentChangesEvent({ancestorNoteId}) {
- await this.refresh(ancestorNoteId);
+ this.ancestorNoteId = ancestorNoteId;
+
+ await this.refresh();
utils.openDialog(this.$widget);
}
- async refresh(ancestorNoteId) {
- if (!ancestorNoteId) {
- ancestorNoteId = hoistedNoteService.getHoistedNoteId();
+ async refresh() {
+ if (!this.ancestorNoteId) {
+ this.ancestorNoteId = hoistedNoteService.getHoistedNoteId();
}
- const recentChangesRows = await server.get('recent-changes/' + ancestorNoteId);
+ const recentChangesRows = await server.get('recent-changes/' + this.ancestorNoteId);
// preload all notes into cache
await froca.getNotes(recentChangesRows.map(r => r.noteId), true);