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 7a187224 Add involuntary emeritus button for secretary role
7a187224 is described below

commit 7a187224dffcc8d10794fbce5565fa5f384503af
Author: Sebb <[email protected]>
AuthorDate: Sun Mar 2 15:14:54 2025 +0000

    Add involuntary emeritus button for secretary role
---
 www/roster/views/actions/memstat.json.rb | 14 ++++++++++++--
 www/roster/views/person/main.js.rb       |  4 ++++
 www/roster/views/person/memstat.js.rb    | 15 +++++++++++++++
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/www/roster/views/actions/memstat.json.rb 
b/www/roster/views/actions/memstat.json.rb
index 50c966d7..7ca70d7a 100644
--- a/www/roster/views/actions/memstat.json.rb
+++ b/www/roster/views/actions/memstat.json.rb
@@ -13,9 +13,15 @@ TIMESTAMP = (Time.now.strftime '%Y-%m-%d %H:%M:%S %:z')
 members_txt = ASF::SVN.svnpath!('foundation', 'members.txt')
 # construct commit message
 message = "Action #{@action} for #{USERID}"
+if @action == 'involuntary_emeritus'
+  if @emeritus_reason.size < 10
+    raise Exception.new("Missing or incomplete reason provided: 
'#{@emeritus_reason}'")
+  end
+  message = "Action #{@action} for #{USERID}: #{@emeritus_reason}"
+end
 
 # update members.txt only for secretary actions
-if @action == 'emeritus' or @action == 'active' or @action == 'deceased'
+if %w{active emeritus deceased involuntary_emeritus}.include? @action
   ASF::SVN.multiUpdate_ members_txt, message, env, _ do |text|
     # remove user's entry
     unless text.sub! entry, '' # e.g. if the workspace was out of date
@@ -35,9 +41,13 @@ 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 == 'involuntary_emeritus' # move to emeritus
+      index = text.index(/^\s\*\)\s/, text.index(/^Emeritus/))
+      entry.sub! %r{\s*/\* deceased, .+?\*/},'' # drop the deceased comment if 
necessary
+      entry.sub! "\n", " /* involuntary, #{@emeritus_reason} */\n" # add the 
reason comment
     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
+      entry.sub! %r{\s*/\* (?:deceased|involuntary), .+?\*/},'' # drop the 
comments if necessary
       # if emeritus file was found, move it to emeritus-reinstated
       # otherwise ignore
       pathname, basename = ASF::EmeritusFiles.findpath(user)
diff --git a/www/roster/views/person/main.js.rb 
b/www/roster/views/person/main.js.rb
index 1ab41a03..5bdcd585 100644
--- a/www/roster/views/person/main.js.rb
+++ b/www/roster/views/person/main.js.rb
@@ -376,6 +376,10 @@ class Person < Vue
     form = jQuery(event.currentTarget).closest('form')
     target = event.target
 
+    # if event has the skip submit attribute, return immediately
+    # (used for fast return from validation)
+    return if target.getAttribute('data-skip-submit')
+
     # if (cancel) button is pressed, don't submit but remove @edit form
     cancel_submit = target.getAttribute('data-cancel-submit')
 
diff --git a/www/roster/views/person/memstat.js.rb 
b/www/roster/views/person/memstat.js.rb
index aa141f42..dcf14650 100644
--- a/www/roster/views/person/memstat.js.rb
+++ b/www/roster/views/person/memstat.js.rb
@@ -3,6 +3,17 @@
 #
 
 class PersonMemberStatus < Vue
+  def checkReason(event)
+    target = event.target
+    reason = document.getElementById('emeritus_reason').value
+    if reason.size() < 10 # TODO: better check
+      alert 'Must provide a reason for the involuntary emeritus'
+      target.setAttribute('data-skip-submit', true)
+    else
+      target.removeAttribute('data-skip-submit')
+    end
+  end
+
   def render
     committer = @@person.state.committer
     owner = @@person.props.auth.id == committer.id
@@ -45,6 +56,10 @@ class PersonMemberStatus < Vue
                   _button.btn.btn_primary 'move to deceased',
                     name: 'action', value: 'deceased'
                   _input 'dod', name: 'dod', value: dod
+                  _button.btn.btn_primary 'involuntary emeritus',
+                    onClick: self.checkReason,
+                    name: 'action', value: 'involuntary_emeritus'
+                  _input 'emeritus_reason', name: 'emeritus_reason', id: 
'emeritus_reason'
                 elsif committer.member.status.include? 'Emeritus'
                   _button.btn.btn_primary 'move to active',
                     name: 'action', value: 'active'

Reply via email to