refactor: use the same method for retrying one as well as multiple email

queues

* removed retry_sending method from email queue controller
This commit is contained in:
phot0n 2023-12-11 20:58:02 +05:30 committed by akhilnarang
parent c875fbe20a
commit 082549e273
3 changed files with 10 additions and 11 deletions

View file

@ -19,13 +19,18 @@ frappe.ui.form.on("Email Queue", {
} else if (frm.doc.status == "Error") {
frm.add_custom_button("Retry Sending", function () {
frm.call({
method: "retry_sending",
doc: frm.doc,
method: "frappe.email.doctype.email_queue.email_queue.retry_sending",
args: {
name: frm.doc.name,
queues: [frm.doc.name],
},
callback: function () {
frm.reload_doc();
frappe.show_alert({
message: __(
"Status Updated. The email will be picked up in the next scheduled run."
),
indicator: "green",
});
},
});
});

View file

@ -222,12 +222,6 @@ class EmailQueue(Document):
.where(email_recipient.creation < (Now() - Interval(days=days)))
).run()
@frappe.whitelist()
def retry_sending(self):
if self.status == "Error":
self.status = "Not Sent"
self.save(ignore_permissions=True)
@task(queue="short")
@deprecated
@ -440,7 +434,7 @@ class SendMailContext:
@frappe.whitelist()
def bulk_retry(queues):
def retry_sending(queues: str | list[str]):
if not frappe.has_permission("Email Queue", throw=True):
return

View file

@ -53,7 +53,7 @@ function add_bulk_retry_button_to_actions(list_view) {
);
frappe.call({
method: "frappe.email.doctype.email_queue.email_queue.bulk_retry",
method: "frappe.email.doctype.email_queue.email_queue.retry_sending",
args: {
queues: list_view.get_checked_items(true),
},