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 d2a1e6ff Current month may not have any messages yet [skip ci]
d2a1e6ff is described below
commit d2a1e6ffffaaf8c3c93918947c274e112fd9df08
Author: Sebb <[email protected]>
AuthorDate: Sat Aug 3 00:09:51 2024 +0100
Current month may not have any messages yet [skip ci]
---
www/secretary/workbench/server.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/www/secretary/workbench/server.rb
b/www/secretary/workbench/server.rb
index fac856ba..5154070f 100644
--- a/www/secretary/workbench/server.rb
+++ b/www/secretary/workbench/server.rb
@@ -61,10 +61,10 @@ get '/' do
redirect to('/') if env['REQUEST_URI'] == env['SCRIPT_NAME']
# determine latest month for which there are messages
- archives = Dir[File.join(ARCHIVE, '*.yml')].select {|name| name =~
%r{/\d{6}\.yml$}}
+ current = Date.today.strftime('%Y%m') # exclude future-dated entries
+ archives = Dir[File.join(ARCHIVE, '*.yml')].select {|name| name =~
%r{/\d{6}\.yml$} && File.basename(name,'.yml') <= current}
@mbox = archives.empty? ? nil : File.basename(archives.max, '.yml')
if @mbox
- @mbox = [Date.today.strftime('%Y%m'), @mbox].min # Exclude future-dated
entries
@messages = Mailbox.new(@mbox).client_headers.select do |message|
message[:status] != :deleted
end