fix: preserve Gitea events on refresh failure (#41)
All checks were successful
CI / lint (pull_request) Successful in 8s
CI / build-frontend (pull_request) Successful in 5s

This commit is contained in:
timmy 2026-08-05 15:34:05 +00:00
parent 582ab559c7
commit 4afa4032d7
2 changed files with 8 additions and 1 deletions

View File

@ -258,7 +258,7 @@ textarea { resize: vertical; min-height: 120px; }
paintEventStream(await res.json());
setEventStreamStatus('Updated ' + fmt(new Date()));
} catch (e) {
qs('#gitea-events').innerHTML = '<div class="muted">Event stream unavailable.</div>';
setEventStreamStatus('Update failed · showing last activity');
}
}

View File

@ -28,6 +28,13 @@ def test_event_stream_reports_when_activity_was_refreshed():
assert "setEventStreamStatus('Updated ' + fmt(new Date()))" in html
def test_event_stream_reports_refresh_failure_without_erasing_visible_events():
html = DASHBOARD.read_text()
assert "setEventStreamStatus('Update failed · showing last activity')" in html
assert "qs('#gitea-events').innerHTML = '<div class=\"muted\">Event stream unavailable.</div>'" not in html
@pytest.mark.anyio
async def test_event_stream_returns_recent_authenticated_gitea_activity(monkeypatch):
expected = [{"type": "create", "actor": {"login": "timmy"}}]