fix: read activity shards in GET /api/feed; improve sync feedback

_merged/index.json is a shard manifest with activities:[] when the user
has >FEED_PAGE_SIZE activities. The endpoint now collects from all
index-{year}.json shard files before returning.

SyncResult gains a `total` field (activities received from server) so the
feed screen can distinguish "server returned nothing" from "all already
stored locally". Messages: "No activities on instance" / "Up to date (N)"
/ "X of N activities synced".
This commit is contained in:
Davide Scaini
2026-04-24 15:07:52 +02:00
parent 44b2878b14
commit 02726034c7
3 changed files with 25 additions and 12 deletions
+4 -2
View File
@@ -18,10 +18,12 @@ export default function FeedScreen() {
setSyncing(false);
if (result.error) {
setSyncMsg(result.error);
} else if (result.total === 0) {
setSyncMsg('No activities on instance');
} else if (result.synced === 0) {
setSyncMsg('Already up to date');
setSyncMsg(`Up to date (${result.total} activities)`);
} else {
setSyncMsg(`${result.synced} ${result.synced === 1 ? 'activity' : 'activities'} synced`);
setSyncMsg(`${result.synced} of ${result.total} activities synced`);
}
setTimeout(() => setSyncMsg(null), 3500);
}, [db]);