1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Cli,Desktop,Mobile: Resolves #9465: Log user actions (deletions) (#9585)

This commit is contained in:
Henry Heino
2024-03-09 02:33:05 -08:00
committed by GitHub
parent 3222b620b9
commit 75cb639ed2
36 changed files with 182 additions and 59 deletions

View File

@@ -12,6 +12,7 @@ import Logger from '@joplin/utils/Logger';
import syncDebugLog from '../services/synchronizer/syncDebugLog';
import ResourceService from '../services/ResourceService';
import { LoadOptions } from './utils/types';
import ActionLogger from '../utils/ActionLogger';
import { getTrashFolder, getTrashFolderId } from '../services/trash';
const { substrWithEllipsis } = require('../string-utils.js');
@@ -107,7 +108,7 @@ export default class Folder extends BaseItem {
}
}
public static async delete(folderId: string, options: DeleteOptions = null) {
public static async delete(folderId: string, options?: DeleteOptions) {
options = {
deleteChildren: true,
...options,
@@ -120,9 +121,14 @@ export default class Folder extends BaseItem {
const folder = await Folder.load(folderId);
if (!folder) return; // noop
const actionLogger = ActionLogger.from(options.sourceDescription);
actionLogger.addDescription(`folder title: ${JSON.stringify(folder.title)}`);
options.sourceDescription = actionLogger;
if (options.deleteChildren) {
const childrenDeleteOptions: DeleteOptions = {
disableReadOnlyCheck: options.disableReadOnlyCheck,
sourceDescription: actionLogger,
deleteChildren: true,
toTrash,
};