about summary refs log tree commit homepage
path: root/lib/PublicInbox/MsgTime.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-11 07:20:52 +0000
committerEric Wong <e@80x24.org>2023-10-11 22:10:48 +0000
commit3b7cdd9173bd0d74fc181b05c02d90b320d621ae (patch)
tree0b1940e08ecf8c75e87c77c380e50bfad2c70db9 /lib/PublicInbox/MsgTime.pm
parente9e58f17fdc00b244d0830ff2926a2dfefc4fda2 (diff)
downloadpublic-inbox-3b7cdd9173bd0d74fc181b05c02d90b320d621ae.tar.gz
We don't need multiple return points nor multiple time_response
calls in either function.
Diffstat (limited to 'lib/PublicInbox/MsgTime.pm')
-rw-r--r--lib/PublicInbox/MsgTime.pm16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/PublicInbox/MsgTime.pm b/lib/PublicInbox/MsgTime.pm
index 58b0deae..bbc9a007 100644
--- a/lib/PublicInbox/MsgTime.pm
+++ b/lib/PublicInbox/MsgTime.pm
@@ -157,20 +157,16 @@ sub msg_date_only ($) {
 
 # Favors Received header for sorting globally
 sub msg_timestamp ($;$) {
-        my ($hdr, $fallback) = @_; # PublicInbox::Eml
-        my $ret;
-        $ret = msg_received_at($hdr) and return time_response($ret);
-        $ret = msg_date_only($hdr) and return time_response($ret);
-        time_response([ $fallback // time, '+0000' ]);
+        my ($eml, $fallback) = @_;
+        time_response(msg_received_at($eml) // msg_date_only($eml) //
+                        [ $fallback // time, '+0000' ]);
 }
 
 # Favors the Date: header for display and sorting within a thread
 sub msg_datestamp ($;$) {
-        my ($hdr, $fallback) = @_; # PublicInbox::Eml
-        my $ret;
-        $ret = msg_date_only($hdr) and return time_response($ret);
-        $ret = msg_received_at($hdr) and return time_response($ret);
-        time_response([ $fallback // time, '+0000' ]);
+        my ($eml, $fallback) = @_; # PublicInbox::Eml
+        time_response(msg_date_only($eml) // msg_received_at($eml) //
+                        [ $fallback // time, '+0000' ]);
 }
 
 1;