summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaksim Sukharev <antreesy.web@gmail.com>2023-06-19 13:23:27 +0200
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2023-06-20 07:27:56 +0000
commitc2b6fd760cfeb9782eff9411d7a58f7867689c1b (patch)
treeebc27cac80c9f142312e681033588bff6a1efb47
parent0552272ca3f41e9d4f945c2ed1f961a1d2b14014 (diff)
don't send template information for Blank template when creating a file
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
-rw-r--r--src/components/NewMessage/NewMessageNewFileDialog.vue16
-rw-r--r--src/services/filesSharingServices.js4
2 files changed, 13 insertions, 7 deletions
diff --git a/src/components/NewMessage/NewMessageNewFileDialog.vue b/src/components/NewMessage/NewMessageNewFileDialog.vue
index 6033a0865..7ad98ffa0 100644
--- a/src/components/NewMessage/NewMessageNewFileDialog.vue
+++ b/src/components/NewMessage/NewMessageNewFileDialog.vue
@@ -210,11 +210,17 @@ export default {
let fileData
try {
- const response = await createNewFile(
- filePath,
- this.selectedTemplate?.filename,
- this.selectedTemplate?.templateType,
- )
+ let response
+ if (this.selectedTemplate.fileid === -1) {
+ // Don't send template information for Blank
+ response = await createNewFile(filePath)
+ } else {
+ response = await createNewFile(
+ filePath,
+ this.selectedTemplate?.filename,
+ this.selectedTemplate?.templateType,
+ )
+ }
fileData = response.data.ocs.data
} catch (error) {
console.error('Error while creating file', error)
diff --git a/src/services/filesSharingServices.js b/src/services/filesSharingServices.js
index 62777d425..4da0a2108 100644
--- a/src/services/filesSharingServices.js
+++ b/src/services/filesSharingServices.js
@@ -63,8 +63,8 @@ const getFileTemplates = async () => {
* Share a text file to a conversation
*
* @param {string} filePath The new file destination path
- * @param {string} templatePath The template source path
- * @param {string} templateType The template type e.g 'user'
+ * @param {string} [templatePath] The template source path
+ * @param {string} [templateType] The template type e.g 'user'
* @return { object } the file object
*/
const createNewFile = async function(filePath, templatePath, templateType) {