fix(File): Remove extra API endpoint

Got rid of frappe.core.doctype.file.file.optimize_saved_image in favour
of whitelisted Document Action File.optimize_file
This commit is contained in:
Gavin D'souza 2021-08-25 12:03:33 +05:30
parent bc596e9681
commit 75ff78e6bd
2 changed files with 3 additions and 12 deletions

View file

@ -29,15 +29,9 @@ frappe.ui.form.on("File", "refresh", function(frm) {
if (is_optimizable) {
frm.add_custom_button(__("Optimize"), function() {
frappe.show_alert(__("Optimizing image..."));
frappe.call({
method: "frappe.core.doctype.file.file.optimize_saved_image",
args: {
doc_name: frm.doc.name,
},
callback: function() {
frappe.show_alert(__("Image optimized"));
frappe.set_route("List", "File");
}
frm.call("optimize_file").then(() => {
frappe.show_alert(__("Image optimized"));
frappe.set_route("List", "File");
});
});
}

View file

@ -979,9 +979,6 @@ def unzip_file(name):
files = file_obj.unzip()
return len(files)
@frappe.whitelist()
def optimize_saved_image(doc_name):
frappe.get_doc('File', doc_name).optimize_file()
@frappe.whitelist()
def get_attached_images(doctype, names):