Skip to content

feat: allow applications to update their messages (#302) - #1089

Open
EinfacheSache wants to merge 2 commits into
gotify:masterfrom
EinfacheSache:feat/update-message
Open

EinfacheSache wants to merge 2 commits into
gotify:masterfrom
EinfacheSache:feat/update-message

Conversation

@EinfacheSache

@EinfacheSache EinfacheSache commented Nov 19, 2026 •

Copy link
Copy Markdown

Closes #302. Design: #302 (comment)

Applications can update their own messages. The message keeps its id, so progress messages ("Backup 40% … 100%") or approval requests can change in place. Deleting and re-sending gives a new id, a new notification and a new position in the list.

API

  • PUT /message/{id}, authenticated with an application token. The body is the same as POST /message.
  • Disabled by default. Updating has to be allowed per application with the new allowMessageUpdate setting (switch in the application's edit dialog, or allowMessageUpdate on POST/PUT /application). Otherwise the request returns 403, so applications stay push-only unless the user explicitly allows more. On PUT /application/{id} an omitted value keeps the current setting.
  • Only the application that created the message can update it. Unknown ids and messages of other applications both return 404.
  • The message keeps its id and creation date. Title, message, priority and extras are replaced, with the same defaults as on create (empty title/priority → application defaults, omitted extras are removed).
  • New optional updated timestamp on messages. The column is added by the existing auto-migration, and the field is omitted from JSON when unset.

Stream (backwards compatible)

  • /stream?updates=true additionally receives updated messages: same id, updated set.
  • Without the parameter nothing changes. Existing clients such as the Android app, which treats every stream message as new, don't receive updates and therefore don't show duplicates or extra notifications.

Web UI

  • Subscribes with updates=true and replaces updated messages in place, in "All Messages" and in the application view, without a new desktop notification.
  • Shows "(edited)" next to the date, with the update time as tooltip.
before after update
before after

Tests

  • Go: updates are forbidden (403) unless allowed for the application; the setting defaults to false and is kept when omitted on update.
  • Go: API tests for updating your own message, a message of another app (404), an unknown id (404) and defaults; router tests for app-token-only auth; a stream test that only updates=true clients receive updates.
  • e2e: the switch in the application dialog is off by default and can be enabled per application; updates return 403 until allowed.
  • e2e: update without reload, application view, update persists after reload, another app can't update.
  • Passing locally: go vet ./..., go test ./..., tsc, lint, testformat and the full UI e2e suite.

I'm happy to adjust the design (e.g. PATCH semantics, or allowing client tokens).

This PR only covers updates. Applications still can't delete messages, and deletions are not sent over the stream.

Adds PUT /message/{id} for the application that sent a message. The message keeps its id and date and gets an updated timestamp. Clients that connect to the stream with updates=true receive updated messages, other clients are unaffected. The web UI updates messages in place and marks them as edited.
@EinfacheSache
EinfacheSache requested a review from a team as a code owner November 19, 2026 00:09
@EinfacheSache EinfacheSache changed the title feat: allow applications to update their messages (#302) feat: allow applications to update their messages, stream updates and deletions (#302) Nov 19, 2026
@EinfacheSache EinfacheSache changed the title feat: allow applications to update their messages, stream updates and deletions (#302) feat: allow applications to update their messages (#302) Nov 19, 2026
Updating messages is disabled by default. It has to be enabled per
application with the new `allowMessageUpdate` setting, e.g. in the
application's edit dialog in the web UI. Otherwise `PUT /message/{id}`
returns 403.

This keeps applications push-only unless the user explicitly allows more.
An application whose token could be misused (e.g. an ssh login notifier)
can't change its messages afterwards.

On `PUT /application/{id}` an omitted `allowMessageUpdate` keeps the
current value, so existing clients don't reset it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Update Message for ongoing tasks

1 participant