You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2021/07/29 22:18:09 UTC
[whimsy] branch master updated: Drop cache; restore secretary access
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 13568cd Drop cache; restore secretary access
13568cd is described below
commit 13568cd31cd2c70a90b117daa49fa4cc5baf8202
Author: Sebb <se...@apache.org>
AuthorDate: Thu Jul 29 23:17:56 2021 +0100
Drop cache; restore secretary access
The cache is not needed and was causing issues.
---
www/roster/main.rb | 40 +++++++++++++++------------------------
www/roster/views/iclaSearch.js.rb | 6 ++++++
2 files changed, 21 insertions(+), 25 deletions(-)
diff --git a/www/roster/main.rb b/www/roster/main.rb
index 7ef17fa..dcd5d23 100755
--- a/www/roster/main.rb
+++ b/www/roster/main.rb
@@ -282,38 +282,28 @@ get '/icla/' do
_html :iclas
end
-icla_index = nil
-icla_index_time = nil
-icla_index_etag = nil
get '/icla/index.json' do
@auth = Auth.info(env)
# Restrict who can see this
- pass unless @auth[:member] or @auth[:pmc_chair]
- # recompute icla_index if the data is 5 minutes old or older
- icla_index = nil if not icla_index_time or Time.now-icla_index_time >= 300
-
- if not icla_index
-
- # build a list of ICLA Public names, email addresses
- tmp = []
- ASF::ICLA.each {|icla|
- if icla.noId?
- tmp << { name: icla.name, mail: icla.email}
+ pass unless @auth[:member] or @auth[:pmc_chair] # assume secretary is a member
+
+ # build a list of ICLA Public names, email addresses
+ # No real point caching this as the source is cached anyway
+ icla_index = []
+ ASF::ICLA.each {|icla|
+ if icla.noId?
+ if @auth[:secretary] # only secretary sees ICLAs
+ iclaFile = ASF::ICLAFiles.match_claRef(icla.claRef)
+ icla_index << { name: icla.name, mail: icla.email, claRef: icla.claRef, iclaFile: iclaFile}
+ else
+ icla_index << { name: icla.name, mail: icla.email}
end
- }
- icla_index = tmp.to_json
-
- # cache
- icla_index_time = Time.now
- icla_index_etag = etag = Digest::MD5.hexdigest(icla_index)
- end
+ end
+ }
# send response
- last_modified icla_index_time
- etag icla_index_etag
content_type 'application/json', charset: 'UTF-8'
- expires [icla_index_time+300, Time.now+60].max
- icla_index
+ icla_index.to_json
end
# Handle nonpmc: committees that aren't PMCs
diff --git a/www/roster/views/iclaSearch.js.rb b/www/roster/views/iclaSearch.js.rb
index eac4f49..fcc3918 100644
--- a/www/roster/views/iclaSearch.js.rb
+++ b/www/roster/views/iclaSearch.js.rb
@@ -75,11 +75,13 @@ class IclaSearch < Vue
elsif list.length > 99
_p "#{list.length} entries match"
else
+ hasICLA = list.first.iclaFile
_table.table.table_hover do
_thead do
_tr do
_th 'public name'
_th 'email'
+ _th 'ICLA' if hasICLA
end
end
@@ -88,6 +90,10 @@ class IclaSearch < Vue
_tr do
_td icla.name
_td icla.mail
+ if hasICLA
+ # iclapath already ends in /
+ _td { _a icla.claRef, href: "#{@@iclapath}#{icla.iclaFile}" }
+ end
end
end