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 fe421233 Allow override of timeZoneInfo
fe421233 is described below

commit fe421233b5ddc441732bf187078380d216f066b0
Author: Sebb <s...@apache.org>
AuthorDate: Sun Dec 31 14:01:15 2023 +0000

    Allow override of timeZoneInfo
    
    avoids the need to parse the last agenda
---
 www/board/agenda/views/actions/reminder-text.json.rb | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/www/board/agenda/views/actions/reminder-text.json.rb 
b/www/board/agenda/views/actions/reminder-text.json.rb
index b8449cfc..b7e87a08 100644
--- a/www/board/agenda/views/actions/reminder-text.json.rb
+++ b/www/board/agenda/views/actions/reminder-text.json.rb
@@ -6,8 +6,13 @@ raise ArgumentError, "Invalid syntax #{@reminder}" unless  
@reminder =~ /\A[-\w]
 # read template for the reminders
 template = File.read(File.join(FOUNDATION_BOARD, 'templates', 
"#{@reminder}.mustache"))
 
-# find the latest agenda
-agenda = Dir[File.join(FOUNDATION_BOARD, 'board_agenda_*.txt')].max
+# Allow override of timeZoneInfo (avoids the need to parse the last agenda)
+timeZoneInfo = @tzlink
+unless timeZoneInfo
+  # find the latest agenda
+  agenda = Dir[File.join(FOUNDATION_BOARD, 'board_agenda_*.txt')].max
+  timeZoneInfo = File.read(agenda)[/Other Time Zones: (.*)/, 1]
+end
 
 # determine meeting time
 meeting = ASF::Board.nextMeeting
@@ -21,7 +26,7 @@ view = {
   meetingDate:  meeting.strftime("%a, %d %b %Y at %H:%M %Z"),
   month: meeting.strftime("%B"),
   year: meeting.year.to_s,
-  timeZoneInfo: File.read(agenda)[/Other Time Zones: (.*)/, 1],
+  timeZoneInfo: timeZoneInfo,
   dueDate:  dueDate.strftime("%a %b #{dueDate.day.ordinalize}"),
   agenda: meeting.strftime("https://whimsy.apache.org/board/agenda/%Y-%m-%d/";)
 }

Reply via email to