2024-03-14 20:30:49 +02:00
|
|
|
import { checkObjectHasProperties } from '@joplin/utils/object';
|
|
|
|
import { ModelType } from '../../BaseModel';
|
2024-03-29 14:11:15 +02:00
|
|
|
import conflictFolderId from '../../models/utils/getConflictFolderId';
|
|
|
|
import getTrashFolderId from './getTrashFolderId';
|
2024-03-14 20:30:49 +02:00
|
|
|
|
|
|
|
type ItemSlice = { id?: string };
|
|
|
|
const isTrashableItem = (itemType: ModelType, item: ItemSlice) => {
|
|
|
|
checkObjectHasProperties(item, ['id']);
|
|
|
|
|
|
|
|
if (itemType !== ModelType.Folder && itemType !== ModelType.Note) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2024-03-29 14:11:15 +02:00
|
|
|
return item.id !== conflictFolderId() && item.id !== getTrashFolderId();
|
2024-03-14 20:30:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export default isTrashableItem;
|