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 eb4a774  Find Emeritus file names on server
eb4a774 is described below

commit eb4a774b87f2741a2b639e3b04cb8088e6cbd8ab
Author: Sebb <[email protected]>
AuthorDate: Sun Jul 12 00:08:25 2020 +0100

    Find Emeritus file names on server
    
    Filenames sent back from the Javascript were originally generated
    on the server. The server will have the most up-to-date values
    So no need for the JavaScript to pass back the names.
---
 www/roster/views/actions/memstat.json.rb | 22 +++++++++++++++-------
 www/roster/views/person/main.js.rb       |  7 -------
 www/roster/views/person/memstat.js.rb    |  8 +-------
 3 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/www/roster/views/actions/memstat.json.rb 
b/www/roster/views/actions/memstat.json.rb
index 759155d..b9c5397 100644
--- a/www/roster/views/actions/memstat.json.rb
+++ b/www/roster/views/actions/memstat.json.rb
@@ -28,18 +28,21 @@ if @action == 'emeritus' or @action == 'active' or @action 
== 'deceased'
       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
-      filename = ASF::EmeritusRequestFiles.extractfilename(@emeritusfileurl)
-      if filename
-        extra << ['mv', @emeritusfileurl, ASF::SVN.svnpath!('emeritus', 
filename)]
+      pathname = ASF::EmeritusRequestFiles.findpath(user)
+      if pathname
+        extra << ['mv', pathname, ASF::SVN.svnpath!('emeritus', 
File.basename(pathname))]
+      else # there should be a request file
+        _warn "Emeritus request file not found"
       end
     elsif @action == '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
-      filename = ASF::EmeritusFiles.extractfilename(@emeritusfileurl)
-      if filename
+      # otherwise ignore
+      pathname = ASF::EmeritusFiles.findpath(user)
+      if pathname
         # TODO: allow for previous reinstated file
-        extra << ['mv', @emeritusfileurl,  
ASF::SVN.svnpath!('emeritus-reinstated', filename)]
+        extra << ['mv', pathname,  ASF::SVN.svnpath!('emeritus-reinstated', 
File.basename(pathname))]
       end
     elsif @action == 'deceased'
       index = text.index(/^\s\*\)\s/, text.index(/^Deceased/))
@@ -57,7 +60,12 @@ end
 # Owner operations
 if @action == 'rescind_emeritus'
   # TODO handle case where rescinded file already exists
-  ASF::SVN.svn_!('mv', [@emeritusfileurl, 
ASF::SVN.svnurl('emeritus-requests-rescinded')], _, {env:env, msg:message})
+  pathname = ASF::EmeritusRequestFiles.findpath(user)
+  if pathname
+    ASF::SVN.svn_!('mv', [pathname, 
ASF::SVN.svnpath!('emeritus-requests-rescinded', File.basename(pathname))], _, 
{env:env, msg:message})
+  else
+    _warn "Emeritus request file not found"
+  end
 elsif @action == 'request_emeritus'
   # Create emeritus request and send acknowlegement mail from secretary
   template, err =
diff --git a/www/roster/views/person/main.js.rb 
b/www/roster/views/person/main.js.rb
index d99826d..e579782 100644
--- a/www/roster/views/person/main.js.rb
+++ b/www/roster/views/person/main.js.rb
@@ -367,13 +367,6 @@ class Person < Vue
     # serialize form
     formData = form.serializeArray();
 
-    # if additional data, add it to formData
-    emeritus_file_url = target.getAttribute('data-emeritus-file-url')
-    console.log('submit emeritus_file_url: ' + emeritus_file_url)
-    if emeritus_file_url
-      formData.push name: 'emeritusfileurl', value: emeritus_file_url
-    end
-
     # add button if it has a value
     if target and target.getAttribute('name') and target.getAttribute('value')
       formData.push name: target.getAttribute('name'),
diff --git a/www/roster/views/person/memstat.js.rb 
b/www/roster/views/person/memstat.js.rb
index ed4ef1c..acf53f8 100644
--- a/www/roster/views/person/memstat.js.rb
+++ b/www/roster/views/person/memstat.js.rb
@@ -19,12 +19,10 @@ class PersonMemberStatus < Vue
             _form.inline method: 'post' do
               # Cancel this form (implemented in main.js.rb submit(event)
               _button.btn.btn_secondary 'Cancel', data_cancel_submit:true
-              emeritus_file_url = nil # for return by hidden form item
               # These actions are only for the person's own use
               if owner
                 if committer.member.status.include? 'Active'
                   if committer.forms['emeritus_request']
-                    emeritus_file_url = committer.forms['emeritus_request']
                     _button.btn.btn_primary 'rescind emeritus request',
                       name: 'action', value: 'rescind_emeritus'
                   else
@@ -39,9 +37,8 @@ class PersonMemberStatus < Vue
               # These actions are only for secretary's use
               if @@person.props.auth.secretary
                 if committer.member.status.include? 'Active'
-                  emeritus_file_url = committer.forms['emeritus_request']
                   # TODO check time has expired
-                  if emeritus_file_url
+                  if committer.forms['emeritus_request']
                     _button.btn.btn_primary 'move to emeritus',
                       name: 'action', value: 'emeritus'
                   end
@@ -49,7 +46,6 @@ class PersonMemberStatus < Vue
                     name: 'action', value: 'deceased'
                   _input 'dod', name: 'dod', value: dod
                 elsif committer.member.status.include? 'Emeritus'
-                  emeritus_file_url = committer.forms['emeritus']
                   _button.btn.btn_primary 'move to active',
                     name: 'action', value: 'active'
                   _button.btn.btn_primary 'move to deceased',
@@ -63,8 +59,6 @@ class PersonMemberStatus < Vue
                     name: 'action', value: 'emeritus'
                 end
               end
-              # Pass back the file url
-              _input type: 'hidden', name: 'emeritus_file_url', value: 
emeritus_file_url
             end # end _form
           end
         end

Reply via email to