whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: WHIMSY-322 Be more lenient when parsing PDF project names
Date Thu, 09 Apr 2020 16:17:22 GMT
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 54ac078  WHIMSY-322 Be more lenient when parsing PDF project names
54ac078 is described below

commit 54ac0783cd4cfc958980dfcf82853cf088ddaad1
Author: Sebb <sebb@apache.org>
AuthorDate: Thu Apr 9 17:17:13 2020 +0100

    WHIMSY-322 Be more lenient when parsing PDF project names
---
 .../workbench/views/actions/parse-icla.json.rb     | 24 ++++++++++++++++++++++
 www/secretary/workbench/views/forms/icla.js.rb     |  5 +++--
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/www/secretary/workbench/views/actions/parse-icla.json.rb b/www/secretary/workbench/views/actions/parse-icla.json.rb
index f5b7a82..a8f6177 100644
--- a/www/secretary/workbench/views/actions/parse-icla.json.rb
+++ b/www/secretary/workbench/views/actions/parse-icla.json.rb
@@ -5,12 +5,36 @@ require_relative '../../models/mailbox'
 
 attachment = URI.decode(@attachment) # derived from a URI
 
+# WHIMSY-322
+ALIASES = {
+  "solr" => "lucene",
+}
+
 if attachment.end_with? '.pdf'
   message = Mailbox.find(@message)
   
   path = message.find(attachment).as_file.path
   
   parsed = ICLAParser.parse(path)
+
+  # Extract the project and adjust if necessary
+  project = parsed[:Project]
+  parsed [:PDFProject] = project # retain the original value
+  
+  if project
+    project.downcase!
+    projects = (ASF::Podling.current+ASF::Committee.pmcs).map(&:name)
+    unless projects.include? project
+      if project.start_with? 'commons-'
+        parsed[:Project] = 'commons'
+      elsif project.start_with? 'log'
+        parsed[:Project] = 'logging'
+      else
+        tmp = ALIASES[project]
+        parsed[:Project] = tmp if tmp
+      end
+    end
+  end
 else
   parsed = {}
 end
diff --git a/www/secretary/workbench/views/forms/icla.js.rb b/www/secretary/workbench/views/forms/icla.js.rb
index bca79af..6fd1c2e 100644
--- a/www/secretary/workbench/views/forms/icla.js.rb
+++ b/www/secretary/workbench/views/forms/icla.js.rb
@@ -81,11 +81,11 @@ class ICLA < Vue
           end
         end
 
-        unless @project.nil? or @@projects.include? @project
+        unless @pdfproject.nil? or @pdfproject == @project
           _tr do
             _th 'Project (PDF)'
             _td do
-              _ @project
+              _ @pdfproject
             end
           end
         end        
@@ -120,6 +120,7 @@ class ICLA < Vue
     @email = parsed.EMail || @@headers.from
     @user = parsed.ApacheID || ''
     @project = parsed.Project
+    @pdfproject = parsed.PDFProject
   end
 
   def getpdfdata()


Mime
View raw message