1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Desktop: Fixes #8844: Hide option to share a notebook when it is not available

This commit is contained in:
Laurent Cozic 2023-09-12 19:14:52 +01:00
parent efd7cc7a6b
commit b9f36705ff
4 changed files with 7 additions and 1 deletions

View File

@ -18,6 +18,6 @@ export const runtime = (comp: any): CommandRuntime => {
}, },
}); });
}, },
enabledCondition: 'joplinServerConnected && (folderIsShareRootAndOwnedByUser || !folderIsShared)', enabledCondition: 'joplinServerConnected && joplinCloudAccountType != 1 && (folderIsShareRootAndOwnedByUser || !folderIsShared)',
}; };
}; };

View File

@ -723,6 +723,8 @@ class Setting extends BaseModel {
'sync.10.canUseSharePermissions': { value: false, type: SettingItemType.Bool, public: false }, 'sync.10.canUseSharePermissions': { value: false, type: SettingItemType.Bool, public: false },
'sync.10.accountType': { value: 0, type: SettingItemType.Int, public: false },
'sync.5.syncTargets': { value: {}, type: SettingItemType.Object, public: false }, 'sync.5.syncTargets': { value: {}, type: SettingItemType.Object, public: false },
'sync.resourceDownloadMode': { 'sync.resourceDownloadMode': {

View File

@ -32,6 +32,7 @@ export interface WhenClauseContext {
folderIsShared: boolean; folderIsShared: boolean;
folderIsShareRoot: boolean; folderIsShareRoot: boolean;
joplinServerConnected: boolean; joplinServerConnected: boolean;
joplinCloudAccountType: number;
hasMultiProfiles: boolean; hasMultiProfiles: boolean;
noteIsReadOnly: boolean; noteIsReadOnly: boolean;
folderIsReadOnly: boolean; folderIsReadOnly: boolean;
@ -87,6 +88,7 @@ export default function stateToWhenClauseContext(state: State, options: WhenClau
folderIsShared: commandFolder ? !!commandFolder.share_id : false, folderIsShared: commandFolder ? !!commandFolder.share_id : false,
joplinServerConnected: [9, 10].includes(settings['sync.target']), joplinServerConnected: [9, 10].includes(settings['sync.target']),
joplinCloudAccountType: settings['sync.target'] === 10 ? settings['sync.10.accountType'] : 0,
hasMultiProfiles: state.profileConfig && state.profileConfig.profiles.length > 1, hasMultiProfiles: state.profileConfig && state.profileConfig.profiles.length > 1,

View File

@ -12,6 +12,7 @@ interface UserApiResponse {
}; };
inbox_email?: string; inbox_email?: string;
can_use_share_permissions?: number; can_use_share_permissions?: number;
account_type?: number;
} }
const userFetcher = async () => { const userFetcher = async () => {
@ -31,6 +32,7 @@ const userFetcher = async () => {
Setting.setValue('sync.10.inboxId', owner.inbox ? owner.inbox.jop_id : ''); Setting.setValue('sync.10.inboxId', owner.inbox ? owner.inbox.jop_id : '');
Setting.setValue('sync.10.inboxEmail', owner.inbox_email ? owner.inbox_email : ''); Setting.setValue('sync.10.inboxEmail', owner.inbox_email ? owner.inbox_email : '');
Setting.setValue('sync.10.canUseSharePermissions', !!owner.can_use_share_permissions); Setting.setValue('sync.10.canUseSharePermissions', !!owner.can_use_share_permissions);
Setting.setValue('sync.10.accountType', owner.account_type);
}; };
// Listen to the event only once // Listen to the event only once