aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src/newMenu
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-04-15 18:09:37 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2024-04-16 12:02:30 +0200
commitdf3b2ebbfd727b64afe881e5252484f00fe56966 (patch)
treed24f5319137af010f6768083fbf9b1a7a9274181 /apps/files/src/newMenu
parent3091c31d6e57036b0d588b75aaa2c7e0ab2f18a5 (diff)
downloadnextcloud-server-df3b2ebbfd727b64afe881e5252484f00fe56966.tar.gz
nextcloud-server-df3b2ebbfd727b64afe881e5252484f00fe56966.zip
fix(files): Inherit some node attributes when creating new nodes to preserve shared state
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files/src/newMenu')
-rw-r--r--apps/files/src/newMenu/newFolder.ts6
-rw-r--r--apps/files/src/newMenu/newFromTemplate.ts14
2 files changed, 17 insertions, 3 deletions
diff --git a/apps/files/src/newMenu/newFolder.ts b/apps/files/src/newMenu/newFolder.ts
index 64ab8004e78..5d378cab438 100644
--- a/apps/files/src/newMenu/newFolder.ts
+++ b/apps/files/src/newMenu/newFolder.ts
@@ -74,6 +74,12 @@ export const entry = {
owner: getCurrentUser()?.uid || null,
permissions: Permission.ALL,
root: context?.root || '/files/' + getCurrentUser()?.uid,
+ // Include mount-type from parent folder as this is inherited
+ attributes: {
+ 'mount-type': context.attributes?.['mount-type'],
+ 'owner-id': context.attributes?.['owner-id'],
+ 'owner-display-name': context.attributes?.['owner-display-name'],
+ },
})
showSuccess(t('files', 'Created new folder "{name}"', { name: basename(source) }))
diff --git a/apps/files/src/newMenu/newFromTemplate.ts b/apps/files/src/newMenu/newFromTemplate.ts
index 5e69181995e..10ff5d630fe 100644
--- a/apps/files/src/newMenu/newFromTemplate.ts
+++ b/apps/files/src/newMenu/newFromTemplate.ts
@@ -36,7 +36,7 @@ import Vue, { defineAsyncComponent } from 'vue'
const TemplatePickerVue = defineAsyncComponent(() => import('../views/TemplatePicker.vue'))
let TemplatePicker: ComponentInstance & { open: (n: string, t: TemplateFile) => void } | null = null
-const getTemplatePicker = async () => {
+const getTemplatePicker = async (context: Folder) => {
if (TemplatePicker === null) {
// Create document root
const mountingPoint = document.createElement('div')
@@ -45,7 +45,15 @@ const getTemplatePicker = async () => {
// Init vue app
TemplatePicker = new Vue({
- render: (h) => h(TemplatePickerVue, { ref: 'picker' }),
+ render: (h) => h(
+ TemplatePickerVue,
+ {
+ ref: 'picker',
+ props: {
+ parent: context,
+ },
+ },
+ ),
methods: { open(...args) { this.$refs.picker.open(...args) } },
el: mountingPoint,
})
@@ -71,7 +79,7 @@ export function registerTemplateEntries() {
},
order: 11,
async handler(context: Folder, content: Node[]) {
- const templatePicker = getTemplatePicker()
+ const templatePicker = getTemplatePicker(context)
const name = await newNodeName(`${provider.label}${provider.extension}`, content, {
label: t('files', 'Filename'),
name: provider.label,