You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2020/07/11 21:37:44 UTC

[whimsy] branch master updated: Allow for existing file

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 09c8d18  Allow for existing file
09c8d18 is described below

commit 09c8d18cdb3b176f5e13ebc6c7538657d6f0287d
Author: Sebb <se...@apache.org>
AuthorDate: Sat Jul 11 22:37:35 2020 +0100

    Allow for existing file
---
 www/roster/views/actions/memstat.json.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/www/roster/views/actions/memstat.json.rb b/www/roster/views/actions/memstat.json.rb
index 370c524..759155d 100644
--- a/www/roster/views/actions/memstat.json.rb
+++ b/www/roster/views/actions/memstat.json.rb
@@ -38,6 +38,7 @@ if @action == 'emeritus' or @action == 'active' or @action == 'deceased'
       # if emeritus file was found, move it to emeritus-reinstated
       filename = ASF::EmeritusFiles.extractfilename(@emeritusfileurl)
       if filename
+        # TODO: allow for previous reinstated file
         extra << ['mv', @emeritusfileurl,  ASF::SVN.svnpath!('emeritus-reinstated', filename)]
       end
     elsif @action == 'deceased'
@@ -79,7 +80,8 @@ elsif @action == 'request_emeritus'
   Dir.mktmpdir do |tmpdir|
     filename =File.join(tmpdir,'tmpfile')
     File.write(filename, signed_request)
-    if 0 == ASF::SVN.create_(EMERITUS_REQUEST_URL, "#{USERID}.txt", filename, "Emeritus request from #{USERNAME} (#{USERID})", env, _)
+    rc = ASF::SVN.create_(EMERITUS_REQUEST_URL, "#{USERID}.txt", filename, "Emeritus request from #{USERNAME} (#{USERID})", env, _)
+    if rc == 0
       ASF::Mail.configure
       mail = Mail.new do
         from "secretary@apache.org"
@@ -91,6 +93,8 @@ elsif @action == 'request_emeritus'
       end
       mail.attachments["#{USERID}.txt"] = signed_request
       mail.deliver!
+    elsif rc == 1
+      _warn "Request file already exists"
     end
   end
 elsif @action == 'request_reinstatement'