fix(planner): place edit and delete controls follow place_edit, not day_edit

With places set to "Trip owner" a member who may edit days still saw Edit and
Delete on a place in the day plan's context menu, the inspector's action row,
its inline rename and the phone timeline's edit circle, and every one of them
ended in the server's 403. The day plan gates the two entries on place_edit
(taking a place off the day stays a day right), the inspector drops its edit,
delete and update handlers without the right the way the places pool already
does, the phone timeline offers the pencil only with it, and openPlaceEditor
and handleDeletePlace guard like their siblings.

Closes #2446
This commit is contained in:
Maurice
2026-09-22 10:53:54 +02:00
parent e510ff25ab
commit a44df6cf11
9 changed files with 97 additions and 14 deletions
@@ -622,6 +622,19 @@ describe('MPlanTimeline', () => {
expect(mocks.tl.removeAssignment).toHaveBeenCalledWith(MUSEUM)
})
it('FE-MOB-PLTL-048: without place_edit a place row keeps remove and reorder but loses its edit circle (#2446)', () => {
renderTimeline({}, { can: vi.fn((action: string) => action !== 'place_edit') as TripPlanner['can'] }, { mode: 'edit' })
// the place row keeps its remove circle and loses the edit one; the
// transport and note rows keep theirs, editing those is a day right
const row = screen.getByText('Museum').closest('[role="button"]') as HTMLElement
expect(within(row).getByLabelText('planner.removeFromDay')).toBeInTheDocument()
expect(within(row).queryByLabelText('common.edit')).not.toBeInTheDocument()
fireEvent.click(within(row).getByLabelText('planner.removeFromDay'))
expect(mocks.tl.removeAssignment).toHaveBeenCalledWith(MUSEUM)
expect(mocks.tl.editAssignment).not.toHaveBeenCalled()
})
it('FE-MOB-PLTL-037: the transit row opens the journey view from its edit circle', () => {
renderTimeline({}, {}, { mode: 'edit' })