Skip to content

Commit

Permalink
Merge pull request #34097 from owncloud/stable10-fix-33177
Browse files Browse the repository at this point in the history
[Stable10] Fix cancel upload and hide 'uploading' message for files_drop shared folders
  • Loading branch information
VicDeo authored Feb 7, 2019
2 parents 192d33f + b06ecdd commit 92a7650
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
16 changes: 15 additions & 1 deletion apps/files_sharing/js/PublicUploadView.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
' <input type="button" class="stop icon-close" style="display:none" value="" />' +
' </div>' +
' <label>' +
' <input type="file" class="uploader hiddenuploadfield" name="files[]" />' +
' <input type="file" id="file_upload_start" class="uploader hiddenuploadfield" name="files[]" />' +
' <div class="public-upload-view--dropzone">' +
' <span class="icon icon-upload"></span><span>{{uploadButtonLabel}}</span>' +
' </div>' +
Expand Down Expand Up @@ -66,6 +66,8 @@
this,
'_onUploadBeforeAdd',
'_onUploadDone',
'_onUploadStop',
'onUploadCancel',
'_getUploadUrl'
);
},
Expand All @@ -83,6 +85,14 @@
}));
},

_onUploadStop: function (e, data) {
this.$('#uploadprogresswrapper .stop, #uploadprogressbar .label').hide();
},

onUploadCancel: function () {
this._uploader.cancelUploads();
},

_getUploadUrl: function(fileName) {
return OC.getRootPath() + '/public.php/webdav/' + encodeURIComponent(fileName);
},
Expand Down Expand Up @@ -127,6 +137,7 @@
});
this._uploader.on('beforeadd', this._onUploadBeforeAdd);
this._uploader.on('done', this._onUploadDone);
this._uploader.on('stop', this._onUploadStop);

return this;
},
Expand All @@ -144,6 +155,9 @@
view.render();

$('#preview .uploadForm').append(view.$el);
$('#uploadprogresswrapper .stop').on('click', function () {
view.onUploadCancel();
});
});

})(OC,OCA);
Expand Down
6 changes: 6 additions & 0 deletions tests/acceptance/features/lib/PublicLinkFilesPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class PublicLinkFilesPage extends FilesPageBasic {
protected $fileNamesXpath = "//span[@class='nametext']";
protected $fileNameMatchXpath = "//span[@class='nametext' and .=%s]";
protected $fileListXpath = ".//tbody[@id='fileList']";
protected $uploadFormXpath = "//div[@class='uploadForm']";
protected $emptyContentXpath = ".//div[@id='emptycontent']";
protected $addToYourOcBtnId = "save-button";
protected $singleFileDownloadBtnXpath = "//a[@id='download']";
Expand Down Expand Up @@ -335,6 +336,9 @@ public function waitTillPageIsLoaded(
$downloadButton = $this->find(
"xpath", $this->singleFileDownloadBtnXpath
);
$uploadForm = $this->find(
"xpath", $this->uploadFormXpath
);
if ($fileList !== null) {
try {
$fileListIsVisible = $fileList->isVisible();
Expand Down Expand Up @@ -382,6 +386,8 @@ public function waitTillPageIsLoaded(
}
} elseif ($downloadButton !== null) {
break;
} elseif ($uploadForm !== null) {
break;
}

\usleep(STANDARD_SLEEP_TIME_MICROSEC);
Expand Down
8 changes: 7 additions & 1 deletion tests/acceptance/features/webUIUpload/upload.feature
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,10 @@ Feature: File Upload
And the public accesses the last created public link using the webUI
And the user uploads overwriting file "lorem.txt" using the webUI and retries if the file is locked
Then file "lorem.txt" should be listed on the webUI
And the content of "simple-folder/lorem.txt" should be the same as the local "lorem.txt"
And the content of "simple-folder/lorem.txt" should be the same as the local "lorem.txt"

Scenario: upload a file into files_drop share
Given the user has created a new public link for folder "simple-folder" using the webUI with
| permission | upload |
And the public accesses the last created public link using the webUI
Then the user uploads file "lorem.txt" using the webUI

0 comments on commit 92a7650

Please sign in to comment.