Skip to content

Commit fcb949c

Browse files
committed
fix(files): only show template picker menu entries if possible
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent dffb132 commit fcb949c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

apps/files/src/newMenu/newFromTemplate.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ export function registerTemplateEntries() {
6262
iconClass: provider.iconClass || 'icon-file',
6363
iconSvgInline: provider.iconSvgInline,
6464
enabled(context: Folder): boolean {
65-
return (context.permissions & Permission.CREATE) !== 0
65+
if (context.attributes['is-encrypted']) {
66+
return false
67+
}
68+
69+
// templates are only supported in folders where the user has read and create permissions
70+
return (context.permissions & Permission.READ) !== 0
71+
&& (context.permissions & Permission.CREATE) !== 0
6672
},
6773
order: 11,
6874
async handler(context: Folder, content: Node[]) {

0 commit comments

Comments
 (0)