]> git.sesse.net Git - skvidarsync/commitdiff
Fix an issue where we would not get timestamps from first-time messages?
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 25 Dec 2023 12:06:02 +0000 (13:06 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 25 Dec 2023 12:06:02 +0000 (13:06 +0100)
bin/ws.pl

index 583ab38cd6e3802dd5146c029d7161f9db9479d2..f3dd7bc77cf8b617ba6769ff2e35416661836dcb 100644 (file)
--- a/bin/ws.pl
+++ b/bin/ws.pl
@@ -121,7 +121,7 @@ sub handle_event {
                        # TODO: What if edits happen out-of-order?
                        my $date = $1;
                        my $channel = $ev->{'channel'};
-                       my $ts = $ev->{'message'}{'ts'};
+                       my $ts = $ev->{'message'}{'ts'} // $ev->{'ts'};
                        print STDERR "Matching message {$channel, $ts} to date $date\n";
                        $dbh->do('INSERT INTO message_sheet_link (channel, ts, sheet_title) VALUES (?,?,?) ON CONFLICT (channel,ts) DO UPDATE SET sheet_title=EXCLUDED.sheet_title', undef,
                                $channel, $ts, $date);