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
@@ -43,6 +43,7 @@ export default function MPlanTimeline({ planner, shell }: MPlanTimelineProps) {
const { t, trip, can } = planner
const canEdit = can('day_edit', trip)
const editing = shell.mode === 'edit' && canEdit
const canEditPlaces = can('place_edit', trip)
// Per-segment travel mode (#1281): tap a connector → pick the leg's mode.
const legMenu = useContextMenu()
const modeIcon = (key: string) => (key === 'walking' ? Footprints : key.startsWith('plugin:') ? Zap : Car)
@@ -202,7 +203,7 @@ export default function MPlanTimeline({ planner, shell }: MPlanTimelineProps) {
reorder={reorderFor(row.item)}
drag={dragFor(row)}
onOpen={() => openPlace(row.assignment)}
onEdit={() => tl.editAssignment(row.assignment)}
onEdit={canEditPlaces ? () => tl.editAssignment(row.assignment) : undefined}
onRemove={() => tl.removeAssignment(row.assignment)}
/>
{dayScheduleFor('assignment', row.assignment.id)}
@@ -124,7 +124,7 @@ export function PlaceRow({ assignment, fullPlace, linkedReservations, chrome, re
reorder: ReactNode
drag?: RowDrag
onOpen: () => void
onEdit: () => void
onEdit?: () => void
onRemove: () => void
}) {
const { t } = chrome
@@ -210,9 +210,11 @@ export function PlaceRow({ assignment, fullPlace, linkedReservations, chrome, re
</div>
{chrome.editing && (
<span className="flex flex-none items-center gap-1.5">
<ActionCircle label={t('common.edit')} onClick={onEdit}>
<Pencil size={14} strokeWidth={2} />
</ActionCircle>
{onEdit && (
<ActionCircle label={t('common.edit')} onClick={onEdit}>
<Pencil size={14} strokeWidth={2} />
</ActionCircle>
)}
<ActionCircle label={t('planner.removeFromDay')} onClick={onRemove}>
<X size={14} strokeWidth={2} />
</ActionCircle>