Skip to content

Bug: editing a message does nothing — PATCH /api/messages/{id} is the reschedule route, not an edit route #76

Description

@Adron

Found by the payload-key sweep required by #46 (see PR #75).

Symptom

Views/EditMessageView.swift lets the user edit a post's text and save. Nothing changes.

  • Editing an already-published post fails with 400 "Can only edit scheduled posts that are in the future" — copy that makes no sense in an edit sheet.
  • Editing a future scheduled post returns 200 and the content change is silently discarded.

Root cause

APIClient.editMessage(id:content:publiclyVisible:) (Services/APIClient.swift:381-388) sends

PATCH /api/messages/{id}   { content, publiclyVisible }

But app/api/messages/[id]/route.ts PATCH is "reschedule a scheduled post":

  • :127 — if (!message.scheduledAt || message.scheduledAt <= new Date()) return badRequest('Can only edit scheduled posts that are in the future')
  • :132 — const { scheduledAt: scheduledAtRaw, scheduledCrossPostConfig } = body

content and publiclyVisible are never read. The route exports only GET, PATCH, DELETE.

This is a backend gap, not just an iOS bug

There is no route anywhere that updates a message's content — grep content app/api/messages/**/route.ts
matches only the create path (POST /api/messages) and the metadata routes. The web ships no edit
surface either (grep -rln "isEditing|handleEdit|editMessage" components/messages/ → nothing).

So iOS shipped an edit feature the platform does not have.

Options

  1. Backend ask — add PUT /api/messages/{id} (or extend PATCH) accepting { content, publiclyVisible } for the author, with an editedAt marker, authorized via
    getCurrentUserOrSyncToken. Then iOS points editMessage at it.
  2. Or remove EditMessageView and editMessage from iOS until the platform supports editing.

Needs a product call on which. Until then the sheet should not be reachable — it can only fail.

Acceptance criteria

  • Editing a published post from iOS either persists, or the entry point is gone.
  • No path shows "Can only edit scheduled posts that are in the future" from an edit sheet.
  • Unit test covering whichever route is chosen.

Files: Services/APIClient.swift:381, Views/EditMessageView.swift; backend
app/api/messages/[id]/route.ts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend-askNeeds a change in the interlinedlist backendbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions