Send ticket change notifications even if status doesn't change
authorAdam Chlipala <adamc@hcoop.net>
Thu, 29 Jan 2009 18:05:17 +0000 (18:05 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Thu, 29 Jan 2009 18:05:17 +0000 (18:05 +0000)
apt.mlt
cert.mlt
domain.mlt
ip.mlt
list.mlt
quota.mlt
request.sml
requestH.sml
sec.mlt
sign.mlt

diff --git a/apt.mlt b/apt.mlt
index 1cbfde5..df5e26e 100644 (file)
--- 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
-                       %><h3>Error sending e-mail notification</h3><%
-               end
+       if not (Apt.notifyMod {old = oldStatus, new = newStatus, changer = Init.getUserName(), req = id}) then
+               %><h3>Error sending e-mail notification</h3><%
        end
        %><h3>Request modified</h3>
        Back to: <a href="apt?cmd=open">open requests</a>, <a href="apt?cmd=list">all requests</a>
index 33cc148..0206458 100644 (file)
--- 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
-                       %><h3>Error sending e-mail notification</h3><%
-               end
+       if not (Cert.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
+               %><h3>Error sending e-mail notification</h3><%
        end
        %><h3>Request modified</h3>
        Back to: <a href="?cmd=open">open requests</a>, <a href="?cmd=list">all requests</a>
index 3b53b62..0493788 100644 (file)
@@ -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
-                       %><h3>Error sending e-mail notification</h3><%
-               end
+       if not (Domain.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
+               %><h3>Error sending e-mail notification</h3><%
        end
        %><h3>Request modified</h3>
        Back to: <a href="domain?cmd=open">open requests</a>, <a href="domain?cmd=list">all requests</a>
diff --git a/ip.mlt b/ip.mlt
index c928981..bb8500d 100644 (file)
--- 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
-                       %><h3>Error sending e-mail notification</h3><%
-               end
+       if not (Ip.notifyMod {old = oldStatus, new = newStatus, changer = Init.getUserName(), req = id}) then
+               %><h3>Error sending e-mail notification</h3><%
        end
        %><h3>Request modified</h3>
        Back to: <a href="ip?cmd=open">open requests</a>, <a href="ip?cmd=list">all requests</a>
index 45ec388..e57467f 100644 (file)
--- 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
-                       %><h3>Error sending e-mail notification</h3><%
-               end
+       if not (MailingList.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
+               %><h3>Error sending e-mail notification</h3><%
        end
        %><h3>Request modified</h3>
        Back to: <a href="list?cmd=open">open requests</a>, <a href="list?cmd=list">all requests</a>
index 8d32896..f99441a 100644 (file)
--- 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
-                       %><h3>Error sending e-mail notification</h3><%
-               end
+       if not (Quota.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
+               %><h3>Error sending e-mail notification</h3><%
        end
        %><h3>Request modified</h3>
        Back to: <a href="?cmd=open">open requests</a>, <a href="?cmd=list">all requests</a>
index 8e3dbc5..e3a6dec 100644 (file)
@@ -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
index dd4e423..03e168d 100644 (file)
@@ -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 (file)
--- 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
-                       %><h3>Error sending e-mail notification</h3><%
-               end
+       if not (Sec.Req.notifyMod {old = oldStatus, new = newStatus, changer = Init.getUserName(), req = id}) then
+               %><h3>Error sending e-mail notification</h3><%
        end
        %><h3>Request modified</h3>
        Back to: <a href="sec?cmd=open">open requests</a>, <a href="sec?cmd=list">all requests</a>
index 4126f93..b8628e0 100644 (file)
--- 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
-                       %><h3>Error sending e-mail notification</h3><%
-               end
+       if not (Sign.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
+               %><h3>Error sending e-mail notification</h3><%
        end
        %><h3>Request modified</h3>
        Back to: <a href="?cmd=open">open requests</a>, <a href="?cmd=list">all requests</a>