You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-13 00:10:37 +02:00
Desktop,Mobile: Resolves #10073, #10080: Fix conflicts notebook doesn't work with the trash feature (#10104)
This commit is contained in:
@ -6,6 +6,7 @@ import { State as ShareState } from '../../services/share/reducer';
|
||||
import ItemChange from '../ItemChange';
|
||||
import Setting from '../Setting';
|
||||
import { checkObjectHasProperties } from '@joplin/utils/object';
|
||||
import isTrashableItem from '../../services/trash/isTrashableItem';
|
||||
|
||||
const logger = Logger.create('models/utils/readOnly');
|
||||
|
||||
@ -75,13 +76,17 @@ export const checkIfItemCanBeAddedToFolder = async (itemType: ModelType, Folder:
|
||||
// extra `sharePermissionCheckOnly` boolean to do the check for one case or the other. A bit of a
|
||||
// hack but good enough for now.
|
||||
export const itemIsReadOnlySync = (itemType: ModelType, changeSource: number, item: ItemSlice, userId: string, shareState: ShareState, sharePermissionCheckOnly = false): boolean => {
|
||||
checkObjectHasProperties(item, sharePermissionCheckOnly ? ['share_id'] : ['share_id', 'deleted_time']);
|
||||
if (!sharePermissionCheckOnly && isTrashableItem(itemType, item)) {
|
||||
checkObjectHasProperties(item, ['deleted_time']);
|
||||
}
|
||||
|
||||
// Item is in trash
|
||||
if (!sharePermissionCheckOnly && item.deleted_time) return true;
|
||||
|
||||
if (!needsShareReadOnlyChecks(itemType, changeSource, shareState)) return false;
|
||||
|
||||
checkObjectHasProperties(item, ['share_id']);
|
||||
|
||||
// Item is not shared
|
||||
if (!item.share_id) return false;
|
||||
|
||||
|
Reference in New Issue
Block a user