Fixed latest 2 direct messages not actually loading in initial load of timeline.

This commit is contained in:
Storm Dragon
2025-07-31 02:10:50 -04:00
parent 1e74d9ab69
commit 5886da8f49
+8 -4
View File
@@ -6615,8 +6615,10 @@ sub dmrefresh {
my $last_status_id = $j->{'last_status'}->{'id'} || $j->{'last_status'}->{'id_str'}; my $last_status_id = $j->{'last_status'}->{'id'} || $j->{'last_status'}->{'id_str'};
my $tracking_key = "${conversation_id}:${last_status_id}"; my $tracking_key = "${conversation_id}:${last_status_id}";
print $stdout "-- DEBUG: DM #$i unread flag: " . ($is_unread ? "true" : "false") . ", tracking_key: $tracking_key\n" if ($verbose); print $stdout "-- DEBUG: DM #$i unread flag: " . ($is_unread ? "true" : "false") . ", tracking_key: $tracking_key, dm_first_time: " . ($dm_first_time ? "true" : "false") . "\n" if ($verbose);
# During first-time initialization, show the most recent DMs regardless of seen status
if (!$dm_first_time) {
# Check if we've already seen this exact conversation+status combination # Check if we've already seen this exact conversation+status combination
if ($dm_seen_status{$tracking_key}) { if ($dm_seen_status{$tracking_key}) {
print $stdout "-- DEBUG: Skipping DM #$i - already seen locally (key: $tracking_key)\n" if ($verbose); print $stdout "-- DEBUG: Skipping DM #$i - already seen locally (key: $tracking_key)\n" if ($verbose);
@@ -6624,11 +6626,13 @@ sub dmrefresh {
} }
# For servers that support unread flag, also check that # For servers that support unread flag, also check that
# But skip this check during first-time initialization to ensure DMs are shown if (!$is_unread) {
if (!$is_unread && !$dm_seen_status{$tracking_key} && !$dm_first_time) {
print $stdout "-- DEBUG: Skipping DM #$i - already read (unread=false)\n" if ($verbose); print $stdout "-- DEBUG: Skipping DM #$i - already read (unread=false)\n" if ($verbose);
next; next;
} }
} else {
print $stdout "-- DEBUG: First-time initialization - showing DM #$i regardless of seen/unread status\n" if ($verbose);
}
# Only play sound for the first unread conversation to avoid spam # Only play sound for the first unread conversation to avoid spam
if ($dm_notification_sent) { if ($dm_notification_sent) {
@@ -7632,7 +7636,7 @@ sub standarddm {
my ($time, $ts) = &$wraptime($ref->{'last_status'}->{'created_at'}); my ($time, $ts) = &$wraptime($ref->{'last_status'}->{'created_at'});
my $text = &descape(&html_to_text($ref->{'last_status'}->{'content'})); my $text = &descape(&html_to_text($ref->{'last_status'}->{'content'}));
my $sns = &descape($ref->{'last_status'}->{'account'}->{'username'} || $ref->{'last_status'}->{'account'}->{'acct'}); my $sns = &descape($ref->{'last_status'}->{'account'}->{'acct'} || $ref->{'last_status'}->{'account'}->{'username'});
# Add relative time for DMs # Add relative time for DMs
my $relative_time = &format_relative_time($ref->{'last_status'}->{'created_at'}); my $relative_time = &format_relative_time($ref->{'last_status'}->{'created_at'});