This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new c0413b4b Add msg id retrieval
c0413b4b is described below

commit c0413b4bec45416807b4febbb0395d02d540e1f0
Author: Sebb <[email protected]>
AuthorDate: Sun Feb 15 15:47:21 2026 +0000

    Add msg id retrieval
---
 www/members/second_member.cgi | 42 +++++++++++++++++++++++++++++++++++-------
 1 file changed, 35 insertions(+), 7 deletions(-)

diff --git a/www/members/second_member.cgi b/www/members/second_member.cgi
index e7e2b399..1bfb7079 100755
--- a/www/members/second_member.cgi
+++ b/www/members/second_member.cgi
@@ -9,10 +9,36 @@ require 'whimsy/asf/forms'
 require 'whimsy/asf/member-files' # See for nomination file parsing
 require 'whimsy/asf/wunderbar_updates'
 require 'whimsy/asf/meeting-util'
+require_relative '../../tools/parsemail'
 require 'whimsy/asf/time-utils'
 require 'mail'
 
 MAILING_LIST = '[email protected]'
+MAIL_ROOT = '/srv/mail' # TODO: this should be config item
+
+# Try to find matching message id for the original nomination email
+def find_mesgid(subject)
+  ParseMail.parse_main(['members']) # ensure we are up to date
+  today = Date.today
+  msgids = [] # potential matches
+  [today.strftime("%Y%m"), (today<<1).strftime("%Y%m")].each do |yyyymm|
+    curfile = File.join(MAIL_ROOT, "members", "#{yyyymm}.yaml")
+    yaml = YamlFile.read(curfile)
+    yaml.each do |key, value|
+      if subject == value[:Subject]
+        msgid = value[:MessageId]
+        if msgid.include? '@whimsy' # currently @whimsy1-ec2-va.mail
+          return msgid # This must be it
+        else
+          msgids << msgid # could be the one
+        end
+      end
+    end
+  end
+  return msgids.first if msgids.size == 1
+  # else did not find unique match
+  nil
+end
 
 def emit_form(title, prev_data)
   _whimsy_panel(title, style: 'panel-success') do
@@ -74,19 +100,21 @@ Added second by #{secby} for #{nominee} as a New Member:
   Email generated by Whimsy (#{File.basename(__FILE__)})
 
 MAILBODY
-# See check_membernoms.cgi which parses this in list archives
-if uid == 'n/a'
-  mailsubject = "Re: [MEMBER NOMINATION] #{public_name}"
-else
-  mailsubject = "Re: [MEMBER NOMINATION] #{public_name} (#{uid})"
-end
-
+  # See check_membernoms.cgi which parses this in list archives
+  if uid == 'n/a'
+    mailsubject_original = "[MEMBER NOMINATION] #{public_name}"
+  else
+    mailsubject_original = "[MEMBER NOMINATION] #{public_name} (#{uid})"
+  end
+  mailsubject = "Re: #{mailsubject_original}"
+  msgid = find_mesgid(mailsubject_original)
   ASF::Mail.configure
   mail = Mail.new do
     to MAILING_LIST
     bcc '[email protected]'
     from "#{ASF::Person[secby].public_name} <#{secby}@apache.org>"
     subject mailsubject
+    in_reply_to msgid if msgid
     text_part do
       body mail_body
     end

Reply via email to