Fix following past 48 entries and make the e621 page size configurable
Follow lists were paginated at the API default of 48, but the SPA treats them as complete sets: the tag/pool toggles read their state from page one (so the 49th follow looked unfollowed and its spinner waited for a page that could never contain it) and the Followed page rendered only 48 cards while showing that as the count. Both follow endpoints are now unpaginated — they are per-user sets and still restricted to the caller's rows — and the three consumers take plain arrays. Post visibility: the old J621-Django online view fetched limit=320 (e621's maximum) while ours hard-coded 48, and fetchPostsByIds capped id batches at 100. The Online browser now has a 'Posts per page' setting (48/100/200/320) in its sidebar, mirrored in Account -> Browsing preferences, stored per user as e621_per_page and also used for pool loading; the id-batch cap is raised to 320. Tests: follow list shape/isolation (4) and preference validation/merge (3) added; the full backend suite is 46 green. Live-checked the array response shape and the preference bounds (200 accepted, 500 rejected).
This commit is contained in:
@@ -255,7 +255,7 @@ export async function fetchPostsByIds(
|
||||
credentials,
|
||||
"/posts.json",
|
||||
{
|
||||
params: { tags: `id:${ids.join(",")}`, limit: Math.min(ids.length, 100) },
|
||||
params: { tags: `id:${ids.join(",")}`, limit: Math.min(ids.length, 320) },
|
||||
signal,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -12,6 +12,9 @@ export function applyPreferences(
|
||||
if (typeof preferences.ordering === "string") ui.setOrdering(preferences.ordering);
|
||||
if (typeof preferences.per_page === "number") ui.setPerPage(preferences.per_page);
|
||||
if (typeof preferences.zoom === "number") ui.setZoom(preferences.zoom);
|
||||
if (typeof preferences.e621_per_page === "number") {
|
||||
ui.setE621PerPage(preferences.e621_per_page);
|
||||
}
|
||||
}
|
||||
|
||||
/** The browse settings currently in effect, as a preferences payload. */
|
||||
@@ -22,6 +25,7 @@ export function preferencesPayload(extra?: UserPreferences): UserPreferences {
|
||||
ordering: ui.ordering,
|
||||
per_page: ui.perPage,
|
||||
zoom: ui.zoom,
|
||||
e621_per_page: ui.e621PerPage,
|
||||
...extra,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ export interface UserPreferences {
|
||||
per_page?: number;
|
||||
zoom?: number;
|
||||
online_hot_default?: boolean;
|
||||
/** Posts per e621 request for the Online browser and pool loading (max 320). */
|
||||
e621_per_page?: number;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
|
||||
Reference in New Issue
Block a user