Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Stable10] Fix cancel upload and hide 'uploading' message for files_drop shared folders #34097

Merged
merged 2 commits into from
Feb 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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='downloadFile']";
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