From 8812fb4d3cc8fa45e8fd67fd77317a76a2bdd888 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 29 Jan 2009 18:05:17 +0000 Subject: [PATCH] Send ticket change notifications even if status doesn't change --- apt.mlt | 6 ++---- cert.mlt | 6 ++---- domain.mlt | 6 ++---- ip.mlt | 6 ++---- list.mlt | 6 ++---- quota.mlt | 6 ++---- request.sml | 19 ++++++++++++------- requestH.sml | 17 +++++++++++------ sec.mlt | 6 ++---- sign.mlt | 6 ++---- 10 files changed, 39 insertions(+), 45 deletions(-) diff --git a/apt.mlt b/apt.mlt index 1cbfde5..df5e26e 100644 --- a/apt.mlt +++ b/apt.mlt @@ -188,10 +188,8 @@ elseif $"mod" <> "" then val oldStatus = #status req; val newStatus = Apt.statusFromInt (Web.stoi ($"status")); Apt.modify {req with node = node, data = $"pkgs", msg = $"msg", status = newStatus}; - if oldStatus <> newStatus then - if not (Apt.notifyMod {old = oldStatus, new = newStatus, changer = Init.getUserName(), req = id}) then - %>

Error sending e-mail notification

<% - end + if not (Apt.notifyMod {old = oldStatus, new = newStatus, changer = Init.getUserName(), req = id}) then + %>

Error sending e-mail notification

<% end %>

Request modified

Back to: open requests, all requests diff --git a/cert.mlt b/cert.mlt index 33cc148..0206458 100644 --- a/cert.mlt +++ b/cert.mlt @@ -109,10 +109,8 @@ elseif $"mod" <> "" then val oldStatus = #status req; val newStatus = Cert.statusFromInt (Web.stoi ($"status")); Cert.modify {req with data = $"req", msg = $"msg", status = newStatus}; - if oldStatus <> newStatus then - if not (Cert.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then - %>

Error sending e-mail notification

<% - end + if not (Cert.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then + %>

Error sending e-mail notification

<% end %>

Request modified

Back to: open requests, all requests diff --git a/domain.mlt b/domain.mlt index 3b53b62..0493788 100644 --- a/domain.mlt +++ b/domain.mlt @@ -91,10 +91,8 @@ elseif $"mod" <> "" then val oldStatus = #status req; val newStatus = Domain.statusFromInt (Web.stoi ($"status")); Domain.modify {req with data = $"dom", msg = $"msg", status = newStatus}; - if oldStatus <> newStatus then - if not (Domain.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then - %>

Error sending e-mail notification

<% - end + if not (Domain.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then + %>

Error sending e-mail notification

<% end %>

Request modified

Back to: open requests, all requests diff --git a/ip.mlt b/ip.mlt index c928981..bb8500d 100644 --- a/ip.mlt +++ b/ip.mlt @@ -114,10 +114,8 @@ elseif $"mod" <> "" then val oldStatus = #status req; val newStatus = Ip.statusFromInt (Web.stoi ($"status")); Ip.modify {req with node = node, data = $"port", msg = $"msg", status = newStatus}; - if oldStatus <> newStatus then - if not (Ip.notifyMod {old = oldStatus, new = newStatus, changer = Init.getUserName(), req = id}) then - %>

Error sending e-mail notification

<% - end + if not (Ip.notifyMod {old = oldStatus, new = newStatus, changer = Init.getUserName(), req = id}) then + %>

Error sending e-mail notification

<% end %>

Request modified

Back to: open requests, all requests diff --git a/list.mlt b/list.mlt index 45ec388..e57467f 100644 --- a/list.mlt +++ b/list.mlt @@ -87,10 +87,8 @@ elseif $"mod" <> "" then val oldStatus = #status req; val newStatus = MailingList.statusFromInt (Web.stoi ($"status")); MailingList.modify {req with data = $"dom", msg = $"msg", status = newStatus}; - if oldStatus <> newStatus then - if not (MailingList.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then - %>

Error sending e-mail notification

<% - end + if not (MailingList.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then + %>

Error sending e-mail notification

<% end %>

Request modified

Back to: open requests, all requests diff --git a/quota.mlt b/quota.mlt index 8d32896..f99441a 100644 --- a/quota.mlt +++ b/quota.mlt @@ -114,10 +114,8 @@ elseif $"mod" <> "" then val oldStatus = #status req; val newStatus = Quota.statusFromInt (Web.stoi ($"status")); Quota.modify {req with data = $"req", msg = $"msg", status = newStatus}; - if oldStatus <> newStatus then - if not (Quota.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then - %>

Error sending e-mail notification

<% - end + if not (Quota.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then + %>

Error sending e-mail notification

<% end %>

Request modified

Back to: open requests, all requests diff --git a/request.sml b/request.sml index 8e3dbc5..e3a6dec 100644 --- a/request.sml +++ b/request.sml @@ -147,12 +147,17 @@ val statusToString = | REJECTED => "Rejected" fun notifyMod (oldStatus, newStatus, changer, req) = - notify (fn (_, mail) => - (Mail.mwrite (mail, changer); - Mail.mwrite (mail, " has changed the status of this request from "); - Mail.mwrite (mail, statusToString oldStatus); - Mail.mwrite (mail, " to "); - Mail.mwrite (mail, statusToString newStatus); - Mail.mwrite (mail, ".\n\n"))) req + if oldStatus = newStatus then + notify (fn (_, mail) => + (Mail.mwrite (mail, changer); + Mail.mwrite (mail, " has added a comment to this request.\n\n"))) req + else + notify (fn (_, mail) => + (Mail.mwrite (mail, changer); + Mail.mwrite (mail, " has changed the status of this request from "); + Mail.mwrite (mail, statusToString oldStatus); + Mail.mwrite (mail, " to "); + Mail.mwrite (mail, statusToString newStatus); + Mail.mwrite (mail, ".\n\n"))) req end diff --git a/requestH.sml b/requestH.sml index dd4e423..03e168d 100644 --- a/requestH.sml +++ b/requestH.sml @@ -154,12 +154,17 @@ val statusToString = | REJECTED => "Rejected" fun notifyMod {old, new, changer, req} = - notify (fn (_, mail) => + if old = new then + notify (fn (_, mail) => (Mail.mwrite (mail, changer); - Mail.mwrite (mail, " has changed the status of this request from "); - Mail.mwrite (mail, statusToString old); - Mail.mwrite (mail, " to "); - Mail.mwrite (mail, statusToString new); - Mail.mwrite (mail, ".\n\n"))) req + Mail.mwrite (mail, " has added a comment to this request.\n\n"))) req + else + notify (fn (_, mail) => + (Mail.mwrite (mail, changer); + Mail.mwrite (mail, " has changed the status of this request from "); + Mail.mwrite (mail, statusToString old); + Mail.mwrite (mail, " to "); + Mail.mwrite (mail, statusToString new); + Mail.mwrite (mail, ".\n\n"))) req end diff --git a/sec.mlt b/sec.mlt index e6fe245..4bd6097 100644 --- a/sec.mlt +++ b/sec.mlt @@ -201,10 +201,8 @@ elseif $"mod" <> "" then val oldStatus = #status req; val newStatus = Sec.Req.statusFromInt (Web.stoi ($"status")); Sec.Req.modify {req with node = nodeNum, data = $"req", msg = $"msg", status = newStatus}; - if oldStatus <> newStatus then - if not (Sec.Req.notifyMod {old = oldStatus, new = newStatus, changer = Init.getUserName(), req = id}) then - %>

Error sending e-mail notification

<% - end + if not (Sec.Req.notifyMod {old = oldStatus, new = newStatus, changer = Init.getUserName(), req = id}) then + %>

Error sending e-mail notification

<% end %>

Request modified

Back to: open requests, all requests diff --git a/sign.mlt b/sign.mlt index 4126f93..b8628e0 100644 --- a/sign.mlt +++ b/sign.mlt @@ -127,10 +127,8 @@ elseif $"mod" <> "" then val oldStatus = #status req; val newStatus = Sign.statusFromInt (Web.stoi ($"status")); Sign.modify {req with data = $"req", msg = $"msg", status = newStatus}; - if oldStatus <> newStatus then - if not (Sign.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then - %>

Error sending e-mail notification

<% - end + if not (Sign.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then + %>

Error sending e-mail notification

<% end %>

Request modified

Back to: open requests, all requests -- 2.20.1