feat(collections): "want to revisit" status for saved places (#2567)

A fourth status after visited, for a place already seen that the user wants
to go back to. It joins the one-tap cycle, the filters, the pickers, the
assistant cards and the MCP status tool, and counts as visited wherever
visits are counted (isVisitedCollectionStatus), so "visited everywhere"
keeps it. The status pickers go two by two where four would not fit.
This commit is contained in:
Maurice
2026-11-13 09:28:17 +01:00
parent 73ac4b29ad
commit 72e8b1f8d9
56 changed files with 178 additions and 51 deletions
@@ -5,10 +5,28 @@ import {
collectionPlaceUpdateRequestSchema,
collectionReorderRequestSchema,
collectionSavePlaceRequestSchema,
collectionStatusSchema,
isVisitedCollectionStatus,
} from './collection.schema';
import { describe, expect, it } from 'vitest';
describe('collectionStatusSchema', () => {
// #2567: "want to revisit" is a status of its own, stored as it is.
it('accepts revisit next to the first three', () => {
for (const status of ['idea', 'want', 'visited', 'revisit'] as const) {
expect(collectionStatusSchema.parse(status)).toBe(status);
}
});
it('counts revisit as visited, and nothing before it', () => {
expect(isVisitedCollectionStatus('visited')).toBe(true);
expect(isVisitedCollectionStatus('revisit')).toBe(true);
expect(isVisitedCollectionStatus('want')).toBe(false);
expect(isVisitedCollectionStatus('idea')).toBe(false);
});
});
describe('collectionPlaceUpdateRequestSchema', () => {
// Regression for #1437: an update that omits `status` must NOT inject a default
// of 'idea', otherwise the server overwrites the stored status on every edit-save.
+11 -1
View File
@@ -9,10 +9,20 @@ import { tagSchema } from '../tag/tag.schema';
import { z } from 'zod';
export const COLLECTION_STATUSES = ['idea', 'want', 'visited'] as const;
/**
* A saved place's status, in the order the one-tap cycle walks. 'revisit' (#2567)
* is a place already visited that the user wants to go back to; it sits last so
* the stored values and the order of the first three stay as they were.
*/
export const COLLECTION_STATUSES = ['idea', 'want', 'visited', 'revisit'] as const;
export const collectionStatusSchema = z.enum(COLLECTION_STATUSES).catch('idea').default('idea');
export type CollectionStatus = (typeof COLLECTION_STATUSES)[number];
/** Whether the status means "been there": a place to revisit counts as visited wherever visits are counted. */
export function isVisitedCollectionStatus(status: CollectionStatus): boolean {
return status === 'visited' || status === 'revisit';
}
/** Per-member permission on a shared list. viewer = read + copy-to-trip only;
* editor (default) = add + edit places; admin = full incl. delete. The owner
* is always full and is not a member row. */