You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2016/09/07 15:48:20 UTC

[whimsy] branch master updated: connect ICLA to tasklist

This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  2303694   connect ICLA to tasklist
2303694 is described below

commit 2303694332be6a700d52b4f38211254f43a5f1d3
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Sep 7 11:48:00 2016 -0400

    connect ICLA to tasklist
---
 www/secmail/models/mailbox.rb          |  2 +-
 www/secmail/server.rb                  |  3 +--
 www/secmail/views/actions/icla.json.rb |  8 ++++++--
 www/secmail/views/forms/icla.js.rb     |  8 +++++++-
 www/secmail/views/parts.js.rb          |  3 ++-
 www/secmail/views/tasklist.html.rb     | 21 +++++++++++++++++++--
 6 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/www/secmail/models/mailbox.rb b/www/secmail/models/mailbox.rb
index 21660f6..766962e 100644
--- a/www/secmail/models/mailbox.rb
+++ b/www/secmail/models/mailbox.rb
@@ -100,7 +100,7 @@ class Mailbox
   #
   def self.find(message)
     month, hash = message.match(%r{/(\d+)/(\w+)}).captures
-    Mailbox.new(month).find(hash)
+    Mailbox.new(month.untaint).find(hash.untaint)
   end
 
   #
diff --git a/www/secmail/server.rb b/www/secmail/server.rb
index 611cbce..6703ec3 100644
--- a/www/secmail/server.rb
+++ b/www/secmail/server.rb
@@ -50,8 +50,7 @@ end
 
 # task lists
 post '/tasklist/:file' do
-  dryrun = _json(:"actions/#{params[:file]}")
-  @tasklist = JSON.parse(dryrun)['tasklist']
+  @dryrun = JSON.parse(_json(:"actions/#{params[:file]}"))
   _html :tasklist
 end
 
diff --git a/www/secmail/views/actions/icla.json.rb b/www/secmail/views/actions/icla.json.rb
index a7d504d..c7db8ed 100644
--- a/www/secmail/views/actions/icla.json.rb
+++ b/www/secmail/views/actions/icla.json.rb
@@ -6,13 +6,13 @@ message = Mailbox.find(@message)
 iclas = ASF::SVN['private/documents/iclas']
 
 # write attachment (+ signature, if present) to the documents/iclas directory
-_task "svn commit #{@filename}" do
+_task "svn commit documents/iclas/#@filename" do
   svn_reset iclas
   dest = message.write_svn(iclas, @filename, @selected, @signature)
 end
 
 # insert line into iclas.txt
-_task "svn commit iclas.txt" do
+_task "svn commit foundation/officers/iclas.txt" do
   # construct line to be inserted
   insert = [
     'notinavail',
@@ -28,4 +28,8 @@ _task "svn commit iclas.txt" do
   File.write ASF::ICLA::SOURCE, iclas_txt
 end
 
+# send confirmation email
+_task "email #@email" do
+end
+
 {result: "stub for ICLA, filename: #{@filename}"}
diff --git a/www/secmail/views/forms/icla.js.rb b/www/secmail/views/forms/icla.js.rb
index 4f5c647..740a186 100644
--- a/www/secmail/views/forms/icla.js.rb
+++ b/www/secmail/views/forms/icla.js.rb
@@ -8,7 +8,10 @@ class ICLA < React
   def render
     _h4 'ICLA'
 
-    _form action: '../../tasklist/icla', method: 'post', onSubmit: self.file do
+    _form action: '../../tasklist/icla', method: 'post', target: 'content' do
+      _input type: 'hidden', name: 'message'
+      _input type: 'hidden', name: 'selected'
+
       _table.form do
         _tr do
           _th 'Real Name'
@@ -119,6 +122,9 @@ class ICLA < React
     end
 
     $acreq.disabled = !valid or !@user or !@filed
+
+    jQuery('input[name=message]').val(window.parent.location.pathname)
+    jQuery('input[name=selected]').val(@@selected)
   end
 
   # generate file name from the public name
diff --git a/www/secmail/views/parts.js.rb b/www/secmail/views/parts.js.rb
index ba69a77..94d5469 100644
--- a/www/secmail/views/parts.js.rb
+++ b/www/secmail/views/parts.js.rb
@@ -145,7 +145,8 @@ class Parts < React
 
       else
 
-        React.createElement @form, headers: @@headers, submit: self.submit
+        React.createElement @form, headers: @@headers, selected: @selected,
+          submit: self.submit
 
       end
     end
diff --git a/www/secmail/views/tasklist.html.rb b/www/secmail/views/tasklist.html.rb
index fe4c186..a6ee9cf 100644
--- a/www/secmail/views/tasklist.html.rb
+++ b/www/secmail/views/tasklist.html.rb
@@ -1,4 +1,21 @@
 _html do
-  _h1 'tasklist'
-  _pre @tasklist.inspect
+
+  if @dryrun['exception']
+
+    _h2.bg_danger @dryrun['exception']
+    _pre @dryrun['backtrace'].join("\n")
+
+  else
+
+    _h1.bg_warning 'Operations to be performed'
+
+    _ul do
+      @dryrun['tasklist'].each do |task|
+        _li {_h3 task}
+      end
+    end
+
+    _button.btn.btn_primary 'proceed'
+
+  end
 end

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].