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 b709c2dc Next phase - handle rescind of withdrawal request
b709c2dc is described below

commit b709c2dce6f8518876d91fc302c70100787f5fd2
Author: Sebb <[email protected]>
AuthorDate: Wed Sep 11 14:42:29 2024 +0100

    Next phase - handle rescind of withdrawal request
    
    Actual withdrawal needs further work, so commented out
---
 www/roster/models/committer.rb           |  6 +++
 www/roster/views/actions/memstat.json.rb | 81 +++++++++++++++++++++++++++++++-
 www/roster/views/person/memstat.js.rb    |  7 +++
 3 files changed, 92 insertions(+), 2 deletions(-)

diff --git a/www/roster/models/committer.rb b/www/roster/models/committer.rb
index 4c5ac245..78b2ceb3 100644
--- a/www/roster/models/committer.rb
+++ b/www/roster/models/committer.rb
@@ -187,6 +187,12 @@ class Committer
           response[:forms][:emeritus_reinstated] = 
ASF::EmeritusReinstatedFiles.svnpath!(file)
         end
 
+        if auth[:secretary]
+          path, name = ASF::WithdrawalRequestFiles.findpath(person.id, env)
+          if path
+            response[:forms][:withdrawal_request] = path
+          end
+        end
       else
         if person.member_nomination
           member[:nomination] = person.member_nomination
diff --git a/www/roster/views/actions/memstat.json.rb 
b/www/roster/views/actions/memstat.json.rb
index d375837c..84902fd8 100644
--- a/www/roster/views/actions/memstat.json.rb
+++ b/www/roster/views/actions/memstat.json.rb
@@ -24,7 +24,7 @@ if @action == 'emeritus' or @action == 'active' or @action == 
'deceased'
     extra = []
 
     # determine where to put the entry
-    if @action == 'emeritus'
+    if @action == 'emeritus' # move to emeritus
       index = text.index(/^\s\*\)\s/, text.index(/^Emeritus/))
       entry.sub! %r{\s*/\* deceased, .+?\*/},'' # drop the deceased comment if 
necessary
       # if pending emeritus request was found, move it to emeritus
@@ -34,7 +34,7 @@ if @action == 'emeritus' or @action == 'active' or @action == 
'deceased'
       else # there should be a request file
         _warn 'Emeritus request file not found'
       end
-    elsif @action == 'active'
+    elsif @action == 'active' # revert to active
       index = text.index(/^\s\*\)\s/, text.index(/^Active/))
       entry.sub! %r{\s*/\* deceased, .+?\*/},'' # drop the deceased comment if 
necessary
       # if emeritus file was found, move it to emeritus-reinstated
@@ -55,6 +55,83 @@ if @action == 'emeritus' or @action == 'active' or @action 
== 'deceased'
     # return the updated (and normalized) text and extra svn command
     [ASF::Member.normalize(text), extra]
   end
+
+  ############### INCOMPLETE #######################
+# elsif @action == 'withdraw' # process withdrawal request (secretary only)
+#   # TODO 
+#   # update LDAP - remove from members
+#   # unsubscribe from member only mailing lists:
+#   # - compare subscriptions against ASF::Mail.cansub
+#   Tempfile.create('withdraw') do |tempfile|
+#     ASF::SVN.multiUpdate_ members_txt, message, env, _ do |text|
+#       extra = []
+#       # remove user's entry
+#       unless text.sub! entry, '' # e.g. if the workspace was out of date
+#         raise Exception.new('Failed to remove existing entry -- try 
refreshing')
+#       end
+#       # save the entry to the archive
+#       File.write(tempfile, entry)
+#       tempfile.close
+#       extra << ['put' , tempfile.path, ASF::SVN.svnpath!('withdrawn', 
'archive', "#{@userid}.txt")]
+
+#       # Find matching request for the id
+#       pathname, basename = ASF::WithdrawalRequestFiles.findpath(@userid, env)
+#       unless pathname
+#         raise Exception.new("Failed to find withdrawal pending file for 
#{@userid}")
+#       end
+
+#       # Move the request from pending - this should also work for directories
+#       extra << ['mv', pathname, ASF::SVN.svnpath!('withdrawn', basename)]
+#       [ASF::Member.normalize(text), extra]
+#     end
+#     ASF::WithdrawalRequestFiles.refreshnames(true, env) # update the listing 
if successful
+#     ASF::Mail.configure
+#     mail = Mail.new do
+#       from '[email protected]'
+#       to "#{USERNAME}<#{USERMAIL}>"
+#       subject "Acknowledgement of membership withdrawal from #{USERNAME}"
+#       text_part do
+#         body <<~EOD
+#         The membership withdrawal request that was registered for you has 
now been actioned.
+#         Your details have been removed from the membership roster.
+#         You have also been unsubscribed from members-only private email 
lists.
+        
+#         Warm Regards,
+        
+#         Secretary, Apache Software Foundation
+#         [email protected]
+#         EOD
+#       end
+#     end
+#     mail.deliver!
+#   end
+
+elsif @action == 'rescind_withdrawal' # Secretary only
+  pathname, _basename = ASF::WithdrawalRequestFiles.findpath(@userid, env)
+  if pathname
+    ASF::SVN.svn_!('rm', pathname, _, {env:env, msg:message})
+    ASF::WithdrawalRequestFiles.refreshnames(true, env) # update the listing
+    ASF::Mail.configure
+    mail = Mail.new do
+      from '[email protected]'
+      to "#{USERNAME}<#{USERMAIL}>"
+      subject "Acknowledgement of withdrawal rescindment from #{USERNAME}"
+      text_part do
+        body <<~EOD
+        This acknowledges receipt of your request to rescind your membership 
withdrawal request.
+        The request has been deleted, and your membership status will be 
unaffected.
+        
+        Warm Regards,
+        
+        Secretary, Apache Software Foundation
+        [email protected]
+        EOD
+      end
+    end
+    mail.deliver!
+  else
+    _warn "Withdrawal request file not found for #{@userid}"
+  end
 end
 
 # Owner operations
diff --git a/www/roster/views/person/memstat.js.rb 
b/www/roster/views/person/memstat.js.rb
index acf53f8a..451a3e0c 100644
--- a/www/roster/views/person/memstat.js.rb
+++ b/www/roster/views/person/memstat.js.rb
@@ -58,6 +58,13 @@ class PersonMemberStatus < Vue
                   _button.btn.btn_primary 'move to emeritus',
                     name: 'action', value: 'emeritus'
                 end
+                if committer.forms['withdrawal_request']
+                  # INCOMPLETE
+                  # _button.btn.btn_primary 'move to withdrawn',
+                  # name: 'action', value: 'withdraw'
+                  _button.btn.btn_primary 'rescind withdrawal request',
+                  name: 'action', value: 'rescind_withdrawal'
+                end
               end
             end # end _form
           end

Reply via email to