Skip to content

Commit 4b3c40b

Browse files
committed
Check if a file was created manually before creating a new rich workspace
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent d2333a0 commit 4b3c40b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/views/RichWorkspace.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,29 +129,35 @@ export default {
129129
if (IS_PUBLIC) {
130130
params.shareToken = this.shareToken
131131
}
132-
axios.get(WORKSPACE_URL, { params }).then((response) => {
132+
return axios.get(WORKSPACE_URL, { params }).then((response) => {
133133
const data = response.data.ocs.data
134134
this.folder = data.folder || null
135135
this.file = data.file
136136
this.editing = true
137137
this.loaded = true
138+
return true
138139
}).catch((error) => {
139140
const data = error.response.data.ocs.data
140141
this.folder = data.folder || null
141142
this.file = null
142143
this.loaded = true
143144
this.ready = true
144145
this.creating = false
146+
return false
145147
})
146148
},
147149
createNew() {
148150
if (this.creating) {
149151
return
150152
}
151153
this.creating = true
152-
window.FileList.createFile('Readme.md', { scrollTo: false, animate: false }).then((status, data) => {
153-
this.getFileInfo()
154+
this.getFileInfo().then((workspaceFileExists) => {
154155
this.autofocus = true
156+
if (!workspaceFileExists) {
157+
window.FileList.createFile('Readme.md', { scrollTo: false, animate: false }).then((status, data) => {
158+
this.getFileInfo()
159+
})
160+
}
155161
})
156162
},
157163
},

0 commit comments

Comments
 (0)