Skip to content

Build your personal knowledge base with Trilium Notes

add "erase all deleted notes now" also to recent changes

zadamd388b4d8141b
diff --git a/src/public/app/widgets/dialogs/recent_changes.js b/src/public/app/widgets/dialogs/recent_changes.js
index 85b56e90db..4677687213 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 = `
<div class="recent-changes-dialog modal fade mx-auto" tabindex="-1" role="dialog">
@@ -14,7 +15,11 @@ const TPL = `
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Recent changes</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+
+ <button class="erase-deleted-notes-now-button btn btn-xs" style="padding: 0 10px">
+ Erase deleted notes now</button>
+
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;">
<span aria-hidden="true">&times;</span>
</button>
</div>
@@ -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);