From 29d7fd349b919d94daa496ee88a2ac0af428ea34 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Fri, 28 Jun 2019 19:27:53 +0200 Subject: [PATCH] code refactoring (Yann, Liana) --- src/app/files/fileManager.js | 90 +++++++++++++++++------------------- 1 file changed, 42 insertions(+), 48 deletions(-) diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 728ebe8193..b5e8e01102 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -137,63 +137,57 @@ class FileManager extends FileSystemApi { async setFile (path, content) { if (this.currentRequest) { let reject = false - let savedAsCopy = false - let accept = false - let actions = (toaster) => { - return yo` -
- - - + + -
- ` - } + } + e.target.innerHTML = 'Saved' + saveAsCopy = true + toaster.hide() + }}> + Save As Copy + + + `} await toaster(yo`
- ${this.currentRequest.from} is trying to modify ${path} + ${this.currentRequest.from} is trying to modify ${path}
- `, actions, { time: 4000 }) + `, actions, { time: 5000 }) if (reject) throw new Error(`set file operation on ${path} aborted by user.`) - if (accept || savedAsCopy) return - else this._setFileInternal(path, content) + if (saveAsCopy) return } + this._setFileInternal(path, content) } _setFileInternal (path, content) {