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 2018/05/26 15:24:27 UTC

[whimsy] branch master updated: keep track whether the committers summary has been sent or not

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

rubys 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 fad2144  keep track whether the committers summary has been sent or not
fad2144 is described below

commit fad21443c03794397da9fba833d4ea7d85924fb7
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sat May 26 11:23:16 2018 -0400

    keep track whether the committers summary has been sent or not
    
    only show 'send summary' button when it has not been sent
---
 www/board/agenda/views/actions/summary.json.rb | 22 +++++++++++++++++++++-
 www/board/agenda/views/buttons/summary.js.rb   |  3 ++-
 www/board/agenda/views/models/agenda.js.rb     |  2 +-
 www/board/agenda/views/models/minutes.js.rb    |  5 +++++
 4 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/www/board/agenda/views/actions/summary.json.rb b/www/board/agenda/views/actions/summary.json.rb
index 74d2f15..29befa3 100644
--- a/www/board/agenda/views/actions/summary.json.rb
+++ b/www/board/agenda/views/actions/summary.json.rb
@@ -1,9 +1,29 @@
 # send summary email to committers
+
+# fetch minutes
+@minutes = @agenda.sub('_agenda_', '_minutes_')
+minutes_file = File.join(AGENDA_WORK, "#{@minutes.sub('.txt', '.yml')}")
+minutes_file.untaint if @minutes =~ /^board_minutes_\d+_\d+_\d+\.txt$/
+
+if File.exist? minutes_file
+  minutes = YAML.load_file(minutes_file) || {}
+else
+  minutes = {}
+end
+
+# ensure headers have proper CRLF
 header, body = @text.untaint.split(/\r?\n\r?\n/, 2)
 header.gsub! /\r?\n/, "\r\n"
 
+# send mail
 ASF::Mail.configure
 mail = Mail.new("#{header}\r\n\r\n#{body}")
 mail.deliver!
 
-{delivered: true, mail: mail.to_s}
+# update todos
+minutes[:todos] ||= {}
+minutes[:todos][:summary_sent] ||= true
+File.write minutes_file, YAML.dump(minutes)
+
+# return response
+{mail: mail.to_s, minutes: minutes}
diff --git a/www/board/agenda/views/buttons/summary.js.rb b/www/board/agenda/views/buttons/summary.js.rb
index 7af6447..8874860 100644
--- a/www/board/agenda/views/buttons/summary.js.rb
+++ b/www/board/agenda/views/buttons/summary.js.rb
@@ -47,7 +47,8 @@ class Summary < Vue
     }
 
     @disabled = true
-    post 'summary', data do
+    post 'summary', data do |response|
+      Minutes.load response.minutes
       @disabled = false
       jQuery('#summary-form').modal(:hide)
       document.body.classList.remove('modal-open')
diff --git a/www/board/agenda/views/models/agenda.js.rb b/www/board/agenda/views/models/agenda.js.rb
index 1642ed1..13cd8fe 100644
--- a/www/board/agenda/views/models/agenda.js.rb
+++ b/www/board/agenda/views/models/agenda.js.rb
@@ -259,7 +259,7 @@ class Agenda
     if not Minutes.complete
       list << {form: Post, text: 'add item'}
     elsif [:director, :secretary].include? User.role
-      list << {form: Summary}
+      list << {form: Summary} unless Minutes.summary_sent
     end
 
     if User.role == :secretary 
diff --git a/www/board/agenda/views/models/minutes.js.rb b/www/board/agenda/views/models/minutes.js.rb
index 5b4276b..02d9eee 100644
--- a/www/board/agenda/views/models/minutes.js.rb
+++ b/www/board/agenda/views/models/minutes.js.rb
@@ -86,6 +86,11 @@ class Minutes
     self.complete and 
       not Server.drafts.include?  Agenda.file.sub('_agenda_', '_minutes_')
   end
+
+  # determine if committers summary has been sent
+  def self.summary_sent
+    @@list.todos and @@list.todos.summary_sent
+  end
 end
 
 Events.subscribe :minutes do |message|

-- 
To stop receiving notification emails like this one, please contact
rubys@apache.org.