fix(tours): restrict permanent deletion to tours workspace

This commit is contained in:
elmocito
2026-10-06 12:52:25 +02:00
parent 04c7491e2a
commit 8739b4c74d
17 changed files with 456 additions and 39 deletions
@@ -91,8 +91,8 @@ describe('MToursSelectionList', () => {
expect(name).not.toHaveClass('truncate')
})
it('keeps metrics atomic and gives the mobile day action a separate full-width row', () => {
const { container } = render(<MToursSelectionList planner={{ ...planner(), selectedPlaceId: tour.place_id }} shell={shell()} filter="all" canAssign />)
it('keeps the mobile TRIP-PLAN Tours browse list limited to viewing and assignment', () => {
const { container } = render(<MToursSelectionList planner={{ ...planner(), selectedPlaceId: tour.place_id }} shell={shell()} filter="all" canEdit canAssign />)
expect(screen.getByRole('option', { name: new RegExp(tour.name) })).toHaveAttribute('aria-selected', 'true')
const metrics = screen.getByTestId('mobile-tour-metrics')
expect(metrics).toHaveTextContent('12.5 km')
@@ -109,6 +109,7 @@ describe('MToursSelectionList', () => {
add.click()
expect(openSheet).toHaveBeenCalledWith('bract', { placeId: tour.place_id, dayPicker: true })
expect(container.querySelector('[data-testid="mobile-tour-metrics"]')).toBeTruthy()
expect(screen.queryByRole('button', { name: 'Delete' })).not.toBeInTheDocument()
})
it('keeps a long German name and source/difficulty labels intact', () => {
@@ -22,8 +22,8 @@ interface MToursSelectionListProps extends TourPermissionProps {
* (the same one MPlacesBrowser's unplanned-place rows open) — a tour is a
* Place under the hood, so no new linking code is needed here either.
*/
export default function MToursSelectionList({ planner, shell, filter, canEdit, canAssign: assignPermission }: MToursSelectionListProps) {
const { canAssign } = useTourPermissions({ tripId: planner.tripId, canEdit, canAssign: assignPermission })
export default function MToursSelectionList({ planner, shell, filter, canAssign: assignPermission }: MToursSelectionListProps) {
const { canAssign } = useTourPermissions({ tripId: planner.tripId, canAssign: assignPermission })
const { t } = planner
const distanceUnit = useSettingsStore(s => s.settings.distance_unit)
const tours: TourListItem[] = planner.tours