mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 13:39:01 +01:00 
			
		
		
		
	add "erase all deleted notes now" also to recent changes
This commit is contained in:
		
							parent
							
								
									d9dac00a01
								
							
						
					
					
						commit
						d388b4d814
					
				@ -7,6 +7,7 @@ import appContext from "../../services/app_context.js";
 | 
				
			|||||||
import hoistedNoteService from "../../services/hoisted_note.js";
 | 
					import hoistedNoteService from "../../services/hoisted_note.js";
 | 
				
			||||||
import BasicWidget from "../basic_widget.js";
 | 
					import BasicWidget from "../basic_widget.js";
 | 
				
			||||||
import dialogService from "../dialog.js";
 | 
					import dialogService from "../dialog.js";
 | 
				
			||||||
 | 
					import toastService from "../../services/toast.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TPL = `
 | 
					const TPL = `
 | 
				
			||||||
<div class="recent-changes-dialog modal fade mx-auto" tabindex="-1" role="dialog">
 | 
					<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-content">
 | 
				
			||||||
            <div class="modal-header">
 | 
					            <div class="modal-header">
 | 
				
			||||||
                <h5 class="modal-title">Recent changes</h5>
 | 
					                <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">×</span>
 | 
					                    <span aria-hidden="true">×</span>
 | 
				
			||||||
                </button>
 | 
					                </button>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
@ -29,20 +34,30 @@ export default class RecentChangesDialog extends BasicWidget {
 | 
				
			|||||||
    doRender() {
 | 
					    doRender() {
 | 
				
			||||||
        this.$widget = $(TPL);
 | 
					        this.$widget = $(TPL);
 | 
				
			||||||
        this.$content = this.$widget.find(".recent-changes-content");
 | 
					        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}) {
 | 
					    async showRecentChangesEvent({ancestorNoteId}) {
 | 
				
			||||||
        await this.refresh(ancestorNoteId);
 | 
					        this.ancestorNoteId = ancestorNoteId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        await this.refresh();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        utils.openDialog(this.$widget);
 | 
					        utils.openDialog(this.$widget);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async refresh(ancestorNoteId) {
 | 
					    async refresh() {
 | 
				
			||||||
        if (!ancestorNoteId) {
 | 
					        if (!this.ancestorNoteId) {
 | 
				
			||||||
            ancestorNoteId = hoistedNoteService.getHoistedNoteId();
 | 
					            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
 | 
					        // preload all notes into cache
 | 
				
			||||||
        await froca.getNotes(recentChangesRows.map(r => r.noteId), true);
 | 
					        await froca.getNotes(recentChangesRows.map(r => r.noteId), true);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user