1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

All: Fixes #6645: Do not encrypt non-owned note if it was not shared encrypted

This commit is contained in:
Laurent Cozic
2022-07-12 11:28:48 +01:00
parent 0b3c4edb92
commit 06d5feaa63
4 changed files with 14 additions and 4 deletions

View File

@@ -1,5 +1,14 @@
import { BaseItemEntity } from '../../services/database/types';
import { StateShare } from '../../services/share/reducer';
export default function(resource: BaseItemEntity): boolean {
return !resource.is_shared;
export default function(item: BaseItemEntity, share: StateShare): boolean {
// Note has been published - currently we don't encrypt
if (item.is_shared) return false;
// Item has been shared with user, but sharee is not encrypting his notes,
// so we shouldn't encrypt it either. Otherwise sharee will not be able to
// view the note anymore. https://github.com/laurent22/joplin/issues/6645
if (item.share_id && (!share || !share.master_key_id)) return false;
return true;
}