Test and linting tidy-up

This commit is contained in:
Jack Kingsman
2026-02-09 22:37:50 -08:00
parent d5a321f314
commit 28069ab732
6 changed files with 23 additions and 14 deletions

View File

@@ -993,4 +993,3 @@ async def _migrate_015_fix_null_sender_timestamp(conn: aiosqlite.Connection) ->
)
await conn.commit()

View File

@@ -329,10 +329,9 @@ class RadioManager:
if not current_connected:
# Attempt reconnection on every loop while disconnected
if not self.is_reconnecting:
if await self.reconnect():
await self.post_connect_setup()
self._last_connected = True
if not self.is_reconnecting and await self.reconnect():
await self.post_connect_setup()
self._last_connected = True
elif not self._last_connected and current_connected:
# Connection restored (might have reconnected automatically)

View File

@@ -18,7 +18,12 @@ from meshcore import EventType
from app.models import Contact
from app.radio import radio_manager
from app.repository import AppSettingsRepository, ChannelRepository, ContactRepository, MessageRepository
from app.repository import (
AppSettingsRepository,
ChannelRepository,
ContactRepository,
MessageRepository,
)
logger = logging.getLogger(__name__)

View File

@@ -1,7 +1,7 @@
import logging
import aiosqlite
from hashlib import sha256
import aiosqlite
from fastapi import APIRouter, BackgroundTasks
from pydantic import BaseModel, Field

View File

@@ -128,12 +128,15 @@ export function useConversationMessages(
return;
// Get the true oldest message as cursor for the next page
const oldestMessage = messages.reduce((oldest, msg) => {
if (!oldest) return msg;
if (msg.received_at < oldest.received_at) return msg;
if (msg.received_at === oldest.received_at && msg.id < oldest.id) return msg;
return oldest;
}, null as Message | null);
const oldestMessage = messages.reduce(
(oldest, msg) => {
if (!oldest) return msg;
if (msg.received_at < oldest.received_at) return msg;
if (msg.received_at === oldest.received_at && msg.id < oldest.id) return msg;
return oldest;
},
null as Message | null
);
if (!oldestMessage) return;
setLoadingOlder(true);

View File

@@ -3,7 +3,7 @@
import pytest
from app.database import Database
from app.repository import MessageRepository
from app.repository import ContactRepository, MessageRepository
@pytest.fixture
@@ -29,6 +29,9 @@ async def test_claim_prefix_promotes_dm_to_full_key(test_db):
full_key = "a1b2c3d3ba9f5fa8705b9845fe11cc6f01d1d49caaf4d122ac7121663c5beec7"
prefix = full_key[:6].upper()
# Create the contact so the claim safety check (exactly 1 contact matches prefix) passes
await ContactRepository.upsert({"public_key": full_key, "name": "Test"})
msg_id = await MessageRepository.create(
msg_type="PRIV",
text="hello",