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 7685097b Don't cache avail status
7685097b is described below

commit 7685097b536c829017938eb691bf67bb715226dd
Author: Sebb <[email protected]>
AuthorDate: Tue Sep 24 16:52:58 2024 +0100

    Don't cache avail status
---
 www/board/agenda/routes.rb        | 19 ++++++++++++-------
 www/secretary/workbench/server.rb | 16 ++++++++++------
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/www/board/agenda/routes.rb b/www/board/agenda/routes.rb
index a9643201..985f2bcb 100755
--- a/www/board/agenda/routes.rb
+++ b/www/board/agenda/routes.rb
@@ -3,7 +3,6 @@
 #
 
 require 'whimsy/asf/status'
-UNAVAILABLE = Status.updates_disallowed_reason # are updates disallowed?
 
 # redirect root to latest agenda
 get '/' do
@@ -188,7 +187,8 @@ get %r{/(\d\d\d\d-\d\d-\d\d)/feedback.json} do |date|
 end
 
 post %r{/(\d\d\d\d-\d\d-\d\d)/feedback.json} do |date|
-  return [503, UNAVAILABLE] if UNAVAILABLE
+  unavailable = Status.updates_disallowed_reason # are updates disallowed?
+  return [503, unavailable] if unavailable
 
   @agenda = "board_agenda_#{date.gsub('-', '_')}.txt"
   @dryrun = false
@@ -337,7 +337,8 @@ get '/json/posted-reports' do
 end
 
 post '/json/posted-reports' do
-  return [503, UNAVAILABLE] if UNAVAILABLE
+  unavailable = Status.updates_disallowed_reason # are updates disallowed?
+  return [503, unavailable] if unavailable
 
   _json :"actions/posted-reports"
 end
@@ -354,7 +355,8 @@ end
 
 # posted actions
 post '/json/:file' do
-  return [503, UNAVAILABLE] if UNAVAILABLE
+  unavailable = Status.updates_disallowed_reason # are updates disallowed?
+  return [503, unavailable] if unavailable
 
   _json :"actions/#{params[:file]}"
 end
@@ -452,13 +454,15 @@ end
 
 # Secretary post-meeting todos
 get '/json/secretary-todos/:date' do
-  return [503, UNAVAILABLE] if UNAVAILABLE
+  unavailable = Status.updates_disallowed_reason # are updates disallowed?
+  return [503, unavailable] if unavailable
 
   _json :'actions/todos'
 end
 
 post '/json/secretary-todos/:date' do
-  return [503, UNAVAILABLE] if UNAVAILABLE
+  unavailable = Status.updates_disallowed_reason # are updates disallowed?
+  return [503, unavailable] if unavailable
 
   _json :'actions/todos'
 end
@@ -586,7 +590,8 @@ end
 
 # post a new agenda
 post %r{/(\d\d\d\d-\d\d-\d\d)/} do |date|
-  return [503, UNAVAILABLE] if UNAVAILABLE
+  unavailable = Status.updates_disallowed_reason # are updates disallowed?
+  return [503, unavailable] if unavailable
 
   boardurl = ASF::SVN.svnurl('foundation_board')
   agenda = "board_agenda_#{date.gsub('-', '_')}.txt"
diff --git a/www/secretary/workbench/server.rb 
b/www/secretary/workbench/server.rb
index 8a3d862a..b10e32f8 100644
--- a/www/secretary/workbench/server.rb
+++ b/www/secretary/workbench/server.rb
@@ -54,7 +54,6 @@ set :show_exceptions, true
 disable :logging # suppress log of requests to stderr/error.log
 
 require 'whimsy/asf/status'
-UNAVAILABLE = Status.updates_disallowed_reason # are updates disallowed?
 
 # list of messages
 get '/' do
@@ -173,7 +172,8 @@ end
 
 # task lists
 post '/tasklist/:file' do
-  return [503, UNAVAILABLE] if UNAVAILABLE
+  unavailable = Status.updates_disallowed_reason # are updates disallowed?
+  return [503, unavailable] if unavailable
 
   @jsmtime = File.mtime('public/tasklist.js').to_i
   @cssmtime = File.mtime('public/secmail.css').to_i
@@ -189,14 +189,16 @@ end
 # posted actions
 SAFE_ACTIONS = %w[check-mail check-signature]
 post '/actions/:file' do
-  return [503, UNAVAILABLE] if UNAVAILABLE && 
!SAFE_ACTIONS.include?(params[:file])
+  unavailable = Status.updates_disallowed_reason # are updates disallowed?
+  return [503, unavailable] if unavailable && 
!SAFE_ACTIONS.include?(params[:file])
 
   _json :"actions/#{params[:file]}"
 end
 
 # mark a single message as deleted
 delete %r{/(\d+)/(\w+)/} do |month, hash|
-  return [503, UNAVAILABLE] if UNAVAILABLE
+  unavailable = Status.updates_disallowed_reason # are updates disallowed?
+  return [503, unavailable] if unavailable
 
   success = false
 
@@ -213,7 +215,8 @@ end
 
 # update a single message
 patch %r{/(\d{6})/(\w+)/} do |month, hash|
-  return [503, UNAVAILABLE] if UNAVAILABLE
+  unavailable = Status.updates_disallowed_reason # are updates disallowed?
+  return [503, unavailable] if unavailable
 
   success = false
 
@@ -289,7 +292,8 @@ end
 
 # reparse an existing message
 get %r{/(\d{6})/(\w+)/_reparse_} do |month, hash|
-  return [503, UNAVAILABLE] if UNAVAILABLE
+  unavailable = Status.updates_disallowed_reason # are updates disallowed?
+  return [503, unavailable] if unavailable
 
   mailbox = Mailbox.new(month)
   message = mailbox.find(hash)

Reply via email to