You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by cl...@apache.org on 2018/01/30 01:30:45 UTC
[whimsy] branch master updated: project/icla continue to rough in
discuss form
This is an automated email from the ASF dual-hosted git repository.
clr 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 8e75609 project/icla continue to rough in discuss form
8e75609 is described below
commit 8e756093c08c8f8234dbbbcfa8064a4f2b7b9001
Author: Craig L Russell <cr...@oracle.com>
AuthorDate: Mon Jan 29 17:30:35 2018 -0800
project/icla continue to rough in discuss form
---
www/project/icla/main.rb | 2 +-
www/project/icla/views/actions/discuss.json.rb | 100 +++++++------------------
www/project/icla/views/pages/discuss.js.rb | 2 +-
www/project/icla/views/pages/invite.js.rb | 84 +++++++++++----------
4 files changed, 72 insertions(+), 116 deletions(-)
diff --git a/www/project/icla/main.rb b/www/project/icla/main.rb
index f538987..68959c1 100755
--- a/www/project/icla/main.rb
+++ b/www/project/icla/main.rb
@@ -76,7 +76,7 @@ end
get '/' do
@token = params['token']
@mock = params['mock']
- @extra = "&mock=" + @mock if @mock
+ @extra = @mock ? "&mock=" + @mock : ''
loadProgress(@token) if @token
@phase = @progress['phase'] if @progress
if @phase == 'discuss'
diff --git a/www/project/icla/views/actions/discuss.json.rb b/www/project/icla/views/actions/discuss.json.rb
index b76b36f..7d29024 100644
--- a/www/project/icla/views/actions/discuss.json.rb
+++ b/www/project/icla/views/actions/discuss.json.rb
@@ -1,6 +1,7 @@
require 'socket'
require 'net/http'
require 'pathname'
+require 'json'
# find pmc and user information
# all ppmcs are also pmcs but not all pmcs are ppmcs
@@ -22,93 +23,44 @@ rescue
_error 'Invalid domain name in email address'
_focus :iclaemail
end
+# create the discussion object
+date = Time.now.to_date.to_s
+contributor = {:name => @iclaname, :email => @iclaemail}
+comment = @proposalText + '\n' + @discussComment
+comments = [{:member => @proposer, :timestamp => date, :comment => comment}]
+discussion = {
+ :phase => 'discuss',
+ :proposer => @proposer,
+ :subject => @subject,
+ :project => @pmc,
+ :contributor => contributor,
+ :comments => comments
+}
-# validate vote link
-if @votelink and not @votelink.empty?
-
-# verify that the link refers to lists.apache.org message on the project list
- if not @votelink=~ /.*lists\.apache\.org.*/
- _error "Please link to a message via lists.apache.org"
- end
- if not @votelink=~ /.*#{pmc.mail_list}(\.incubator)?\.apache\.org.*/
- _error "Please link to the [RESULT][VOTE] message sent to the private list."
- end
-
- # attempt to fetch the page
- if @votelink =~ /^https?:/i
- uri = URI.parse(@votelink)
- http = Net::HTTP.new(uri.host.untaint, uri.port)
- if uri.scheme == 'https'
- http.use_ssl = true
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
- end
- request = Net::HTTP::Get.new(uri.request_uri.untaint)
- response = http.request(request)
- unless response.code.to_i < 400
- _error "HTTP status #{response.code} for #{@votelink}"
- _focus :votelink
- end
- else
- _error 'Only http(s) links are accepted for vote links'
- _focus :votelink
- end
-
-end
-
-# validate notice link
-if @noticelink and not @noticelink.empty?
-
- # verify that the link refers to lists.apache.org message on the proper list
- if not @noticelink=~ /.*lists\.apache\.org.*/
- _error "Please link to a message via lists.apache.org"
- end
- if pmc_type == 'PMC' and not @noticelink=~ /.*board@apache\.org.*/
- _error "Please link to the NOTICE message sent to the board list."
- end
- if pmc_type == 'PPMC' and not @noticelink=~ /.*private@incubator\.apache\.org.*/
- _error "Please link to the NOTICE message sent to the incubator private list."
- end
+ # generate a token
+token = pmc.name + '-' + date + '-' + Digest::MD5.hexdigest(@iclaemail)[0..5]
- # attempt to fetch the page
- if @noticelink =~ /^https?:/i
- uri = URI.parse(@noticelink)
- http = Net::HTTP.new(uri.host.untaint, uri.port)
- if uri.scheme == 'https'
- http.use_ssl = true
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
- end
- request = Net::HTTP::Get.new(uri.request_uri.untaint)
- response = http.request(request)
- unless response.code.to_i < 400
- _error "HTTP status #{response.code} for #{@noticelink}"
- _focus :noticelink
- end
- else
- _error 'Only http(s) links are accepted for notice links'
- _focus :noticelink
- end
+# save the discussion object to a file
+discussion_json = discussion.to_json
+file_name = '/srv/icla/' + token + '.json'
+File.open(file_name.untaint, 'w') {|f|f.write(discussion_json)}
-end
+# create the email to the pmc
# add user and pmc emails to the response
_userEmail "#{user.public_name} <#{user.mail.first}>" if user
_pmcEmail "private@#{pmc.mail_list}.apache.org" if pmc
-# generate an invitation token
-date = Date.new.inspect
-token = pmc.name + date + Digest::MD5.hexdigest(@iclaemail)[0..5]
-path = Pathname.new(env['REQUEST_URI']) + "../../form?token=#{token}"
+path = Pathname.new(env['REQUEST_URI']) + "../../?token=#{token}"
scheme = env['rack.url_scheme'] || 'https'
link = "#{scheme}://#{env['HTTP_HOST']}#{path}"
# add token and invitation to the response
_token token
-_message %{Dear #{@iclaname},
+_subject params['subject']
+_discussion discussion
+_message %{
+Use this link to continue the discussion:
-Click on this link to accept:
#{link}
-
-Regards,
-#{user.public_name if user}
-On behalf of the #{pmc.name} project
}
diff --git a/www/project/icla/views/pages/discuss.js.rb b/www/project/icla/views/pages/discuss.js.rb
index 7286158..ea25a78 100644
--- a/www/project/icla/views/pages/discuss.js.rb
+++ b/www/project/icla/views/pages/discuss.js.rb
@@ -50,7 +50,7 @@ class Discuss < Vue
# Form fields
#
_div.form_group do
- _label "Comment from " + @member, for: 'discussBody'
+ _label "Comment from " + @member + ' (required)', for: 'discussBody'
_textarea.form_control rows: 4,
required: true, placeholder: 'new comment',
id: 'discussBody', value: @discussBody,
diff --git a/www/project/icla/views/pages/invite.js.rb b/www/project/icla/views/pages/invite.js.rb
index b7f9a40..ae71675 100644
--- a/www/project/icla/views/pages/invite.js.rb
+++ b/www/project/icla/views/pages/invite.js.rb
@@ -35,7 +35,7 @@ class Invite < Vue
@showRoleFrame = false;
@discussComment = ''
@voteBody = ''
- @bodyText = ''
+ @proposalText = ''
end
def render
@@ -72,19 +72,19 @@ class Invite < Vue
#
_div.form_group do
- _label "Contributor's name:", for: 'iclaname'
+ _label "Contributor's name (required):", for: 'iclaname'
_input.form_control.iclaname! placeholder: 'GivenName FamilyName',
required: true, value: @iclaname
end
_div.form_group do
- _label "Contributor's E-Mail address:", for: 'iclaemail'
+ _label "Contributor's E-Mail address (required):", for: 'iclaemail'
_input.form_control.iclaemail! type: 'email', required: true,
placeholder: 'user@example.com', onChange: self.setIclaEmail,
value: @iclaemail
end
_div.form_group do
- _label "PMC/PPMC", for: 'pmc'
+ _label "PMC/PPMC (required)", for: 'pmc'
_select.form_control.pmc! required: true, onChange: self.setPMC, value: @pmc do
_option ''
Server.data.pmcs.each do |pmc|
@@ -179,7 +179,7 @@ class Invite < Vue
onClick: -> {@role = :committer;
@subject = @subjectPhase + ' Invite ' + @iclaname +
' to become a committer for ' + @pmc
- @bodyText = 'I propose to invite ' + @iclaname +
+ @proposalText = 'I propose to invite ' + @iclaname +
' to become a committer.'
}
_span @phasePrefix +
@@ -191,7 +191,7 @@ class Invite < Vue
onClick: -> {@role = :pmc;
@subject = @subjectPhase + ' Invite ' + @iclaname +
' to become committer and ' + @pmcOrPPMC + ' member for ' + @pmc
- @bodyText = 'I propose to invite ' + @iclaname +
+ @proposalText = 'I propose to invite ' + @iclaname +
' to become a committer and ' + @pmcOrPPMC + ' member.'
}
_span @phasePrefix +
@@ -204,7 +204,7 @@ class Invite < Vue
onClick: -> {@role = :invite;
@subject = @subjectPhase + ' Invite ' + @iclaname +
' to submit an ICLA for ' + @pmc
- @bodyText = 'I propose to invite ' + @iclaname +
+ @proposalText = 'I propose to invite ' + @iclaname +
' to submit an ICLA.'
}
_span @phasePrefix +
@@ -219,7 +219,7 @@ class Invite < Vue
_div 'To: private@' + @pmc_mail[@pmc] + '.apache.org'
_div 'Subject: ' + @subject
_p
- _span @bodyText
+ _span @proposalText
_p
_textarea.form_control rows: 4,
placeholder: 'Here are my reasons:',
@@ -284,43 +284,46 @@ class Invite < Vue
end
_p
- end
- #
- # Hidden form: preview discussion email
- #
- _div.modal.fade.discussion_preview! do
- _div.modal_dialog do
- _div.modal_content do
- _div.modal_header do
- _button.close "\u00d7", type: 'button', data_dismiss: 'modal'
- _h4 'Preview Discussion Email'
- end
-
- _div.modal_body do
- # headers
- _div do
- _b 'From: '
- _span @member
- end
- _div do
- _b 'To: '
- _span @pmcEmail
+ #
+ # Hidden form: preview discussion email
+ #
+ _div.modal.fade.discussion_preview! do
+ _div.modal_dialog do
+ _div.modal_content do
+ _div.modal_header do
+ _button.close "\u00d7", type: 'button', data_dismiss: 'modal'
+ _h4 'Discussion Email'
end
- _div do
- _b
- _span @message
+
+ _div.modal_body do
+ # headers
+ _div do
+ _b 'From: '
+ _span @member
+ end
+ _div do
+ _b 'To: '
+ _span @pmcEmail
+ end
+ _div do
+ _b 'Subject: '
+ _span @subject
+ end
+ _div do
+ _b
+ _pre @message
+ end
end
- end
- _div.modal_footer do
- _button.btn.btn_default 'Cancel', data_dismiss: 'modal'
- _button.btn.btn_primary 'Mock Send', onClick: self.mockSend
+ _div.modal_footer do
+ _button.btn.btn_default 'Close', data_dismiss: 'modal'
+ end
end
end
end
- end
- _p
+ _p
+ end
# when the form is initially loaded, set the focus on the iclaname field
def mounted()
document.getElementById('iclaname').focus()
@@ -355,7 +358,7 @@ class Invite < Vue
@phase = :discuss
@subject = ''
@subjectPhase = '[DISCUSS]'
- @previewMessage = 'Preview Discussion'
+ @previewMessage = 'Start Discussion'
@phasePrefix = ' Start the discussion to'
@showDiscussFrame = true;
@showRoleFrame = true;
@@ -530,6 +533,7 @@ class Invite < Vue
pmc: @pmc,
proposer: @member,
subject: @subject,
+ proposalText: @proposalText,
discussComment: @discussComment
}
@@ -542,7 +546,7 @@ class Invite < Vue
@pmcEmail = response.pmcEmail
@discussion = response.discussion
@token = response.token
- console.log(@token)
+ @message = response.message
document.getElementById(response.focus).focus() if response.focus
jQuery('#discussion-preview').modal(:show) unless @alert
end
--
To stop receiving notification emails like this one, please contact
clr@apache.org.