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

Desktop,Mobile,Cli: Fix notes are moved to the conflict folder when a folder is unshared (#12993)

Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
This commit is contained in:
Henry Heino
2025-09-13 06:08:19 -07:00
committed by GitHub
parent 5adc0170fc
commit f9ffe6c4e6
3 changed files with 52 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
import { defaultFolderIcon, FolderEntity, FolderIcon, NoteEntity, ResourceEntity } from '../services/database/types';
import { BaseItemEntity, defaultFolderIcon, FolderEntity, FolderIcon, NoteEntity, ResourceEntity } from '../services/database/types';
import BaseModel, { DeleteOptions } from '../BaseModel';
import { FolderLoadOptions } from './utils/types';
import time from '../time';
@@ -747,14 +747,18 @@ export default class Folder extends BaseItem {
report[tableName] = rows.length;
for (const row of rows) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
const toSave: any = {
const toSave: BaseItemEntity = {
id: row.id,
share_id: '',
updated_time: Date.now(),
// Don't change the updated_time.
// This prevents conflicts in the case where the item was unshared remotely.
// See https://github.com/laurent22/joplin/issues/12648
// updated_time: Date.now(),
};
if (hasParentId) toSave.parent_id = row.parent_id;
if (hasParentId) {
(toSave as FolderEntity|NoteEntity).parent_id = row.parent_id;
}
await ItemClass.save(toSave, { autoTimestamp: false });
}