Skip to content

Build your personal knowledge base with Trilium Notes

client/collections/board: improve comments

Adorian Doranc2ca4a0b9303
diff --git a/apps/client/src/services/dialog.ts b/apps/client/src/services/dialog.ts
index 4bf85badef..042d73a82c 100644
--- a/apps/client/src/services/dialog.ts
+++ b/apps/client/src/services/dialog.ts
@@ -210,11 +210,10 @@ async function confirm(message: MessageType) {
}
/**
- * Asks a yes/no question that also offers to delete the notes it is about.
+ * Shows a confirmation with an optional checkbox for deleting the notes it asks about.
*
- * The caller words the offer. Pass no `checkboxLabel` to ask the question alone.
- *
- * @returns the answer and whether the box was ticked, or `false` where the reader backed out.
+ * @param checkboxLabel labels the checkbox; omit it to show no checkbox.
+ * @returns `confirmed` and `isDeleteNoteChecked`, or `false` when the dialog is dismissed.
*/
async function confirmWithNoteDeletion(message: MessageType, checkboxLabel?: string) {
return new Promise<ConfirmDialogResult | undefined>((res) =>
diff --git a/apps/client/src/widgets/collections/board/api.ts b/apps/client/src/widgets/collections/board/api.ts
index 55328a2fdd..367ac42b70 100644
--- a/apps/client/src/widgets/collections/board/api.ts
+++ b/apps/client/src/widgets/collections/board/api.ts
@@ -499,15 +499,14 @@ export default class BoardApi {
}
/**
- * Asks before taking a column off the board, the grouping label going from every card in it.
+ * Asks before taking a column off the board, offering to delete its cards as well.
* Both the menu and the Delete key come through here, so the question is put once and the same
* way, and a refusal from the server is reported rather than passing for a deletion.
*
* @returns whether the column went, for a caller with something to do afterwards.
*/
async confirmAndRemoveColumn(column: string) {
- // `removeColumn` acts on this map too, so a filter hiding part of the column cannot make
- // the offer undercount.
+ // Count from the unfiltered map, which is the one `removeColumn` deletes from.
const cards = (this.allByColumn ?? this.byColumn)?.get(column)?.length ?? 0;
const answer = await dialog.confirmWithNoteDeletion(
t("board_view.delete-column-confirmation"),
@@ -529,8 +528,8 @@ export default class BoardApi {
/**
* Takes a column off the board.
*
- * @param deleteNotes whether its cards are deleted, rather than kept on the board with the
- * grouping value taken off them.
+ * @param deleteNotes deletes the column's cards instead of removing the grouping value from
+ * them.
*/
async removeColumn(column: string, deleteNotes = false) {
// `allByColumn` covers the cards an active filter is not showing.
diff --git a/apps/client/src/widgets/dialogs/confirm.tsx b/apps/client/src/widgets/dialogs/confirm.tsx
index 410a081936..8ab665150d 100644
--- a/apps/client/src/widgets/dialogs/confirm.tsx
+++ b/apps/client/src/widgets/dialogs/confirm.tsx
@@ -94,8 +94,6 @@ export default function ConfirmDialog() {
: <RawHtmlBlock html={opts?.message} />
}
- {/* The caller words the offer itself: what is being removed, and how many notes go
- with it, is the caller's to describe. */}
{opts?.checkboxLabel && (
<FormCheckbox
name="confirm-dialog-checkbox"