diff --git a/apps/client/src/stylesheets/theme-next/dialogs.css b/apps/client/src/stylesheets/theme-next/dialogs.css index 9b8fb0306..985239d49 100644 --- a/apps/client/src/stylesheets/theme-next/dialogs.css +++ b/apps/client/src/stylesheets/theme-next/dialogs.css @@ -242,7 +242,7 @@ div.tn-tool-dialog { } /* Item title for deleted notes */ -.recent-changes-content ul li.deleted-note .note-title > .note-title { +.recent-changes-content ul li.deleted-note .note-title { text-decoration: line-through; } diff --git a/apps/client/src/widgets/dialogs/recent_changes.ts b/apps/client/src/widgets/dialogs/recent_changes.ts deleted file mode 100644 index 280d716d0..000000000 --- a/apps/client/src/widgets/dialogs/recent_changes.ts +++ /dev/null @@ -1,177 +0,0 @@ -import { formatDateTime } from "../../utils/formatters.js"; -import { t } from "../../services/i18n.js"; -import appContext, { type EventData } from "../../components/app_context.js"; -import BasicWidget from "../basic_widget.js"; -import dialogService, { openDialog } from "../../services/dialog.js"; -import froca from "../../services/froca.js"; -import hoistedNoteService from "../../services/hoisted_note.js"; -import linkService from "../../services/link.js"; -import server from "../../services/server.js"; -import toastService from "../../services/toast.js"; -import ws from "../../services/ws.js"; -import { Modal } from "bootstrap"; - -const TPL = /*html*/` -`; - -// TODO: Deduplicate with server. -interface RecentChangesRow { - noteId: string; - date: string; -} - -export default class RecentChangesDialog extends BasicWidget { - - private ancestorNoteId?: string; - - private modal!: bootstrap.Modal; - private $content!: JQuery; - private $eraseDeletedNotesNow!: JQuery; - - doRender() { - this.$widget = $(TPL); - this.modal = Modal.getOrCreateInstance(this.$widget[0]); - - 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(t("recent_changes.deleted_notes_message")); - }); - }); - } - - async showRecentChangesEvent({ ancestorNoteId }: EventData<"showRecentChanges">) { - this.ancestorNoteId = ancestorNoteId; - - await this.refresh(); - - openDialog(this.$widget); - } - - async refresh() { - if (!this.ancestorNoteId) { - this.ancestorNoteId = hoistedNoteService.getHoistedNoteId(); - } - - const recentChangesRows = await server.get(`recent-changes/${this.ancestorNoteId}`); - - // preload all notes into cache - await froca.getNotes( - recentChangesRows.map((r) => r.noteId), - true - ); - - this.$content.empty(); - - if (recentChangesRows.length === 0) { - this.$content.append(t("recent_changes.no_changes_message")); - } - - const groupedByDate = this.groupByDate(recentChangesRows); - - for (const [dateDay, dayChanges] of groupedByDate) { - const $changesList = $("