Skip to content

Commit

Permalink
Fix Dropzone issue changing existing photos.
Browse files Browse the repository at this point in the history
I used the Dropzone source code to come up with what was missing when
adding existing files (we were previously reducing maxFiles which had
much the same effect unless you tried to remove/add when it got quite
confused); after doing that, I then discovered a PR on Dropzone which
has the same fixes: dropzone/dropzone#2003
  • Loading branch information
dracos committed Jul 13, 2023
1 parent 894b382 commit ea42a74
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web/cobrands/fixmystreet/fixmystreet.js
Original file line number Diff line number Diff line change
Expand Up @@ -887,15 +887,17 @@ $.extend(fixmystreet.set_up, {
if (!f) {
return;
}
var mockFile = { name: f, server_id: f, dataURL: '/photo/temp.' + f };
var mockFile = { name: f, server_id: f, dataURL: '/photo/temp.' + f, status: Dropzone.SUCCESS, accepted: true };
photodrop.emit("addedfile", mockFile);
photodrop.createThumbnailFromUrl(mockFile,
photodrop.options.thumbnailWidth, photodrop.options.thumbnailHeight,
photodrop.options.thumbnailMethod, true, function(thumbnail) {
photodrop.emit('thumbnail', mockFile, thumbnail);
});
photodrop.emit("complete", mockFile);
photodrop.options.maxFiles -= 1;
photodrop.files.push(mockFile);
photodrop._updateMaxFilesReachedClass();
prevFile = mockFile;
});
});
});
Expand Down

0 comments on commit ea42a74

Please sign in to comment.