Skip to content

Commit

Permalink
Don't cache avail status
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbASF committed Sep 24, 2024
1 parent ba11b59 commit 7685097
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
19 changes: 12 additions & 7 deletions www/board/agenda/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#

require 'whimsy/asf/status'
UNAVAILABLE = Status.updates_disallowed_reason # are updates disallowed?

# redirect root to latest agenda
get '/' do
Expand Down Expand Up @@ -188,7 +187,8 @@
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
Expand Down Expand Up @@ -337,7 +337,8 @@ def server
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
Expand All @@ -354,7 +355,8 @@ def server

# 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
Expand Down Expand Up @@ -452,13 +454,15 @@ def server

# 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
Expand Down Expand Up @@ -586,7 +590,8 @@ def server

# 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"
Expand Down
16 changes: 10 additions & 6 deletions www/secretary/workbench/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def self.safe_for_line_ending_conversion?(string)
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
Expand Down Expand Up @@ -173,7 +172,8 @@ def self.safe_for_line_ending_conversion?(string)

# 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
Expand All @@ -189,14 +189,16 @@ def self.safe_for_line_ending_conversion?(string)
# 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

Expand All @@ -213,7 +215,8 @@ def self.safe_for_line_ending_conversion?(string)

# 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

Expand Down Expand Up @@ -289,7 +292,8 @@ def self.safe_for_line_ending_conversion?(string)

# 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)
Expand Down

0 comments on commit 7685097

Please sign in to comment.