From 9204ce7d3d5f7b89e05940032d6a437174278f7f Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 5 Dec 2018 22:40:07 +0100 Subject: Do not show general warning on free space error Fixes #12588 Probably needs more fixing for the other cases. But this is the quick fix I could come up with for now. Signed-off-by: Roeland Jago Douma --- apps/files/js/file-upload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/files/js') diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 8d18761acc8..ed7cd4c2a66 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -1024,7 +1024,7 @@ OC.Uploader.prototype = _.extend({ // target folder does not exist any more OC.Notification.show(t('files', 'Target folder "{dir}" does not exist any more', {dir: upload.getFullPath()} ), {type: 'error'}); self.cancelUploads(); - } else if (status === 507) { + } else if (data.textStatus === 'notenoughspace') { // not enough space OC.Notification.show(t('files', 'Not enough free space'), {type: 'error'}); self.cancelUploads(); -- cgit v1.2.3 From 00446ffb9e63954f126227cc92ae946503e6149c Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 20 Dec 2018 20:09:05 +0100 Subject: Only check whatsnew once per hour Store the last check in the session storage. (Which gets cleared on logout). And only check once an hour. Saves a request to the server on most requests when browsing. Signed-off-by: Roeland Jago Douma --- apps/files/js/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apps/files/js') diff --git a/apps/files/js/app.js b/apps/files/js/app.js index 3630ed7587d..c7393b871b8 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -133,7 +133,10 @@ this._debouncedPersistShowHiddenFilesState = _.debounce(this._persistShowHiddenFilesState, 1200); - OCP.WhatsNew.query(); // for Nextcloud server + if (sessionStorage.getItem('WhatsNewServerCheck') < (Date.now() - 3600*1000)) { + OCP.WhatsNew.query(); // for Nextcloud server + sessionStorage.setItem('WhatsNewServerCheck', Date.now()); + } }, /** -- cgit v1.2.3 From 6bcc77a7c6575bffd800b5a1d381966c59c1c04a Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Fri, 21 Dec 2018 12:03:34 +0100 Subject: Replace ChildNode.before with custom before helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/files/js/navigation.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/navigation.js b/apps/files/js/navigation.js index 02a0af2b369..acfda3b6ce8 100644 --- a/apps/files/js/navigation.js +++ b/apps/files/js/navigation.js @@ -283,8 +283,11 @@ * This method allows easy swapping of elements. */ swap: function (list, j, i) { - list[i].before(list[j]); - list[j].before(list[i]); + var before = function(node, insertNode) { + node.parentNode.insertBefore(insertNode, node); + } + before(list[i], list[j]); + before(list[j], list[i]); } }; -- cgit v1.2.3 From 528964e0b73fc3ddbf14737a342823d7b6fd9816 Mon Sep 17 00:00:00 2001 From: Florian Schunk Date: Fri, 9 Nov 2018 12:23:51 +0100 Subject: copy Dialog starts in current directory Signed-off-by: Florian Schunk --- apps/files/js/fileactions.js | 2 +- core/js/oc-dialogs.js | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 2981fb64c11..7ad37f3c559 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -655,7 +655,7 @@ if (type === OC.dialogs.FILEPICKER_TYPE_MOVE) { context.fileList.move(filename, targetPath, false, context.dir); } - }, false, "httpd/unix-directory", true, actions); + }, false, "httpd/unix-directory", true, actions, context.dir); } }); diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index ed09b4121a7..9646eb0cc41 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -189,8 +189,9 @@ var OCdialogs = { * @param mimetypeFilter mimetype to filter by - directories will always be included * @param modal make the dialog modal * @param type Type of file picker : Choose, copy, move, copy and move + * @param path path to the folder that the the file can be picket from */ - filepicker:function(title, callback, multiselect, mimetypeFilter, modal, type) { + filepicker:function(title, callback, multiselect, mimetypeFilter, modal, type, path) { var self = this; this.filepicker.sortField = 'name'; @@ -214,6 +215,9 @@ var OCdialogs = { this.filepicker.filesClient = (OCA.Sharing && OCA.Sharing.PublicApp && OCA.Sharing.PublicApp.fileList)? OCA.Sharing.PublicApp.fileList.filesClient: OC.Files.getClient(); this.filelist = null; + if (path == undefined) { + path = ''; + } $.when(this._getFilePickerTemplate()).then(function($tmpl) { self.filepicker.loading = false; @@ -232,9 +236,14 @@ var OCdialogs = { self.$filePicker = $tmpl.octemplate({ dialog_name: dialogName, title: title, +<<<<<<< HEAD emptytext: emptyText, newtext: newText }).data('path', '').data('multiselect', multiselect).data('mimetype', mimetypeFilter); +======= + emptytext: emptyText + }).data('path', path).data('multiselect', multiselect).data('mimetype', mimetypeFilter); +>>>>>>> copy Dialog starts in current directory if (modal === undefined) { modal = false; @@ -355,7 +364,7 @@ var OCdialogs = { self.filepicker.sortOrder = self.filepicker.sortOrder === 'asc' ? 'desc' : 'asc'; self._fillFilePicker(dir); }); - self._fillFilePicker(''); + self._fillFilePicker(path); }); // build buttons -- cgit v1.2.3 From 37270fc525b2cbe0b715bac707705eef2daffb03 Mon Sep 17 00:00:00 2001 From: Florian Schunk Date: Fri, 9 Nov 2018 15:38:59 +0100 Subject: remember last copied to directory Signed-off-by: Florian Schunk --- apps/files/js/fileactions.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'apps/files/js') diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 7ad37f3c559..05efa1f36e9 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -648,6 +648,10 @@ if (permissions & OC.PERMISSION_UPDATE) { actions = OC.dialogs.FILEPICKER_TYPE_COPY_MOVE; } + var dialogDir = context.dir; + if (context.fileList.dirInfo.dirLastCopiedTo != undefined) { + dialogDir = context.fileList.dirInfo.dirLastCopiedTo; + } OC.dialogs.filepicker(t('files', 'Choose target folder'), function(targetPath, type) { if (type === OC.dialogs.FILEPICKER_TYPE_COPY) { context.fileList.copy(filename, targetPath, false, context.dir); @@ -655,7 +659,8 @@ if (type === OC.dialogs.FILEPICKER_TYPE_MOVE) { context.fileList.move(filename, targetPath, false, context.dir); } - }, false, "httpd/unix-directory", true, actions, context.dir); + context.fileList.dirInfo.dirLastCopiedTo = targetPath; + }, false, "httpd/unix-directory", true, actions, dialogDir); } }); -- cgit v1.2.3 From ecb936495f095610298c952c7c555ebb6daf1174 Mon Sep 17 00:00:00 2001 From: Florian Schunk Date: Sun, 23 Dec 2018 14:27:08 +0100 Subject: also remember folder for multiselect actions Signed-off-by: Florian Schunk --- apps/files/js/filelist.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'apps/files/js') diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index bcecdb697fe..7f0d1ea1a94 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -918,6 +918,10 @@ }; var actions = this.isSelectedMovable() ? OC.dialogs.FILEPICKER_TYPE_COPY_MOVE : OC.dialogs.FILEPICKER_TYPE_COPY; + var dialogDir = self.getCurrentDirectory(); + if (self.dirInfo.dirLastCopiedTo != undefined) { + dialogDir = self.dirInfo.dirLastCopiedTo; + } OC.dialogs.filepicker(t('files', 'Choose target folder'), function(targetPath, type) { self.fileMultiSelectMenu.toggleLoading('copyMove', true); if (type === OC.dialogs.FILEPICKER_TYPE_COPY) { @@ -926,7 +930,8 @@ if (type === OC.dialogs.FILEPICKER_TYPE_MOVE) { self.move(files, targetPath, disableLoadingState); } - }, false, "httpd/unix-directory", true, actions); + self.dirInfo.dirLastCopiedTo = targetPath; + }, false, "httpd/unix-directory", true, actions, dialogDir); event.preventDefault(); }, -- cgit v1.2.3 From 332b4aee9da4ffe6f7f79255ca4ce75b8a283693 Mon Sep 17 00:00:00 2001 From: Florian Schunk Date: Mon, 7 Jan 2019 22:07:16 +0100 Subject: fix testing for undefined Signed-off-by: Florian Schunk --- apps/files/js/fileactions.js | 2 +- apps/files/js/filelist.js | 2 +- core/js/oc-dialogs.js | 9 +-------- 3 files changed, 3 insertions(+), 10 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 05efa1f36e9..ef29551c591 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -649,7 +649,7 @@ actions = OC.dialogs.FILEPICKER_TYPE_COPY_MOVE; } var dialogDir = context.dir; - if (context.fileList.dirInfo.dirLastCopiedTo != undefined) { + if (typeof context.fileList.dirInfo.dirLastCopiedTo !== 'undefined') { dialogDir = context.fileList.dirInfo.dirLastCopiedTo; } OC.dialogs.filepicker(t('files', 'Choose target folder'), function(targetPath, type) { diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 7f0d1ea1a94..29c5a49131d 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -919,7 +919,7 @@ var actions = this.isSelectedMovable() ? OC.dialogs.FILEPICKER_TYPE_COPY_MOVE : OC.dialogs.FILEPICKER_TYPE_COPY; var dialogDir = self.getCurrentDirectory(); - if (self.dirInfo.dirLastCopiedTo != undefined) { + if (typeof self.dirInfo.dirLastCopiedTo !== 'undefined') { dialogDir = self.dirInfo.dirLastCopiedTo; } OC.dialogs.filepicker(t('files', 'Choose target folder'), function(targetPath, type) { diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index 9646eb0cc41..3583019ef08 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -215,9 +215,7 @@ var OCdialogs = { this.filepicker.filesClient = (OCA.Sharing && OCA.Sharing.PublicApp && OCA.Sharing.PublicApp.fileList)? OCA.Sharing.PublicApp.fileList.filesClient: OC.Files.getClient(); this.filelist = null; - if (path == undefined) { - path = ''; - } + path = path || ''; $.when(this._getFilePickerTemplate()).then(function($tmpl) { self.filepicker.loading = false; @@ -236,14 +234,9 @@ var OCdialogs = { self.$filePicker = $tmpl.octemplate({ dialog_name: dialogName, title: title, -<<<<<<< HEAD emptytext: emptyText, newtext: newText - }).data('path', '').data('multiselect', multiselect).data('mimetype', mimetypeFilter); -======= - emptytext: emptyText }).data('path', path).data('multiselect', multiselect).data('mimetype', mimetypeFilter); ->>>>>>> copy Dialog starts in current directory if (modal === undefined) { modal = false; -- cgit v1.2.3 From 05734131345809f61444388daf4d845e70079283 Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Mon, 21 Jan 2019 19:11:13 +0100 Subject: apps: file-upload: fix typo in comments Signed-off-by: Tigran Mkrtchyan --- apps/files/js/file-upload.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index ed7cd4c2a66..bc1a4b36794 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -194,7 +194,7 @@ OC.FileUpload.prototype = { var data = this.data; var file = this.getFile(); - // it was a folder upload, so make sure the parent directory exists alrady + // it was a folder upload, so make sure the parent directory exists already var folderPromise; if (file.relativePath) { folderPromise = this.uploader.ensureFolderExists(this.getFullPath()); @@ -655,7 +655,7 @@ OC.Uploader.prototype = _.extend({ // when only replacement selected -> overwrite self.onReplace(conflict.data('data')); } else { - // when only original seleted -> skip + // when only original selected -> skip // when none selected -> skip self.onSkip(conflict.data('data')); } -- cgit v1.2.3 From 3e37620cc23718baa35f5a8627bc437b2910a7e1 Mon Sep 17 00:00:00 2001 From: imsolost Date: Fri, 18 Jan 2019 15:09:13 -0800 Subject: fixed replacement functions to catch all instances of parenthesis Signed-off-by: imsolost --- apps/files/js/filelist.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 29c5a49131d..cbe51aad42d 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1674,7 +1674,7 @@ c: fileData.etag }; var previewUrl = this.generatePreviewUrl(urlSpec); - previewUrl = previewUrl.replace('(', '%28').replace(')', '%29'); + previewUrl = previewUrl.replace(/\(/g, '%28').replace(/\)/g, '%29'); iconDiv.css('background-image', 'url("' + previewUrl + '")'); } } @@ -2058,8 +2058,7 @@ } previewURL = self.generatePreviewUrl(urlSpec); - previewURL = previewURL.replace('(', '%28'); - previewURL = previewURL.replace(')', '%29'); + previewUrl = previewUrl.replace(/\(/g, '%28').replace(/\)/g, '%29'); // preload image to prevent delay // this will make the browser cache the image -- cgit v1.2.3 From 5742ec79ab28d618e54fece89f8659a4f574eee8 Mon Sep 17 00:00:00 2001 From: imsolost Date: Fri, 25 Jan 2019 09:36:45 -0800 Subject: changed case on variable to match initial case Signed-off-by: imsolost --- apps/files/js/filelist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps/files/js') diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index cbe51aad42d..7ba650eb183 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -2058,7 +2058,7 @@ } previewURL = self.generatePreviewUrl(urlSpec); - previewUrl = previewUrl.replace(/\(/g, '%28').replace(/\)/g, '%29'); + previewURL = previewURL.replace(/\(/g, '%28').replace(/\)/g, '%29'); // preload image to prevent delay // this will make the browser cache the image -- cgit v1.2.3 From f99ce0d546c8332bb46807eed21fcdf7d5d0ab71 Mon Sep 17 00:00:00 2001 From: Tomasz Grobelny Date: Sun, 27 Jan 2019 22:59:14 +0100 Subject: Throttle getstoragestats.php calls and allow simultaneous uploads Signed-off-by: Tomasz Grobelny --- apps/files/js/file-upload.js | 3 ++- apps/files/js/files.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'apps/files/js') diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index bc1a4b36794..9f1912d590d 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -845,7 +845,8 @@ OC.Uploader.prototype = _.extend({ type: 'PUT', dropZone: options.dropZone, // restrict dropZone to content div autoUpload: false, - sequentialUploads: true, + sequentialUploads: false, + limitConcurrentUploads: 10, //singleFileUploads is on by default, so the data.files array will always have length 1 /** * on first add of every selection diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 016aef05a96..a785a44ddd6 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -33,6 +33,9 @@ }, // update quota updateStorageQuotas: function() { + Files._updateStorageQuotasThrottled(); + }, + _updateStorageQuotas: function() { var state = Files.updateStorageQuotas; state.call = $.getJSON(OC.filePath('files','ajax','getstoragestats.php'),function(response) { Files.updateQuota(response); @@ -356,6 +359,7 @@ }; Files._updateStorageStatisticsDebounced = _.debounce(Files._updateStorageStatistics, 250); + Files._updateStorageQuotasThrottled = _.throttle(Files._updateStorageQuotas, 30000); OCA.Files.Files = Files; })(); -- cgit v1.2.3 From 038e665db98ec065bcca6c30c2326362cde0aae8 Mon Sep 17 00:00:00 2001 From: Daniel Calviño Sánchez Date: Tue, 29 Jan 2019 11:40:45 +0100 Subject: Fix dropping a folder on a folder row MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the uploaded files have a relative path (that is, when a folder is uploaded) it is first ensured that all the parent folders exist, which is done by trying to create them. When a folder is created in the currently opened folder the file list is updated and a row for the new folder is added. However, this was done too when the folder already existed, which caused the previous row to be removed and a new one added to replace it. For security reasons, some special headers need to be set in requests; this is done automatically for jQuery by handling the "ajaxSend" event in the document. In the case of DAV requests, if the headers are not set the server rejects the request with "CSRF check not passed". When a file or folder is dropped on a folder row the jQuery upload events are chained from the initial drop event, which has the row as its target. In order to upload the file jQuery performs a request, which triggers the "ajaxSend" event in the row; this event then bubbles up to the document, which is then handled by adding the special headers to the request. However, when a folder was dropped on a folder row that folder row was removed when ensuring that the folder exists. The jQuery upload events were still triggered on the row, but as it had been removed it had no parent nodes, and thus the events did not bubble up. Due to this the "ajaxSend" event never reached the document when triggered on the removed row, the headers were not set, and the upload failed. All this is simply fixed by not removing the folder row when trying to create it if it existed already. Signed-off-by: Daniel Calviño Sánchez --- apps/files/js/file-upload.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'apps/files/js') diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 9f1912d590d..79d266a300b 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -523,7 +523,9 @@ OC.Uploader.prototype = _.extend({ self.filesClient.createDirectory(fullPath).always(function(status) { // 405 is expected if the folder already exists if ((status >= 200 && status < 300) || status === 405) { - self.trigger('createdfolder', fullPath); + if (status !== 405) { + self.trigger('createdfolder', fullPath); + } deferred.resolve(); return; } -- cgit v1.2.3