mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
BUGFIX: check image size before uploading an avatar/background
This commit is contained in:
parent
faa341148e
commit
7fd0db857f
@ -40,11 +40,14 @@ Discourse.AvatarSelectorView = Discourse.ModalBodyView.extend({
|
||||
});
|
||||
|
||||
// when a file has been selected
|
||||
$upload.on("fileuploadadd", function () {
|
||||
$upload.on('fileuploadsubmit', function (e, data) {
|
||||
var result = Discourse.Utilities.validateUploadedFiles(data.files);
|
||||
self.setProperties({
|
||||
uploading: true,
|
||||
uploadProgress: 0,
|
||||
uploading: result,
|
||||
imageIsNotASquare: false
|
||||
});
|
||||
return result;
|
||||
});
|
||||
|
||||
// when there is a progression for the upload
|
||||
|
@ -26,8 +26,10 @@ Discourse.PreferencesView = Discourse.View.extend({
|
||||
formData: { user_image_type: "profile_background" }
|
||||
});
|
||||
|
||||
$upload.on("fileuploadadd", function() {
|
||||
self.set("uploading", true);
|
||||
$upload.on('fileuploadsubmit', function (e, data) {
|
||||
var result = Discourse.Utilities.validateUploadedFiles(data.files);
|
||||
self.setProperties({ uploadProgress: 0, uploading: result });
|
||||
return result;
|
||||
});
|
||||
$upload.on("fileuploadprogressall", function(e, data) {
|
||||
var progress = parseInt(data.loaded / data.total * 100, 10);
|
||||
@ -51,5 +53,3 @@ Discourse.PreferencesView = Discourse.View.extend({
|
||||
$("#profile-background-input").fileupload("destroy");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user