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:
parent
c875fbe20a
commit
082549e273
3 changed files with 10 additions and 11 deletions
|
|
@ -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",
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue