feature: edit or delete your own chat messages for 10 minutes - #622
Merged
Merged
Conversation
Contributor
Author
|
df80de9 follows api#442's edit ack, which now carries the server's stored
|
This was referenced Sep 28, 2026
lukepolo
force-pushed
the
feature/chat-moderation
branch
from
September 29, 2026 01:11
d1da735 to
f056cf5
Compare
The message menu offers the author Edit Message and Delete Message on a line they sent from the website in the last ten minutes, in every room including direct conversations. Moderators keep their delete in group rooms, and nobody edits someone else's words. The window is checked when the menu opens rather than on a timer; a trigger left over from before the window closed goes away with a toast saying why. Editing happens in place: Enter saves, Esc cancels, Shift+Enter breaks the line, and the box counts down near the 2000 character cap like the composer. Only one editor is open across a list. An unchanged edit just closes, a failure keeps the editor open with a toast, and a closed window or a message that is gone closes it. The socket sends lobby:edit through the same request plumbing as a delete, applies the text on the ack, and listens for the room's `edited` event, which never creates a message and never revives a deleted one. A stale history snapshot keeps an edit it predates. Edited lines carry an "(edited)" marker with the edit time in a tooltip. Conversation badges now know which messages they counted, so a deleted direct message comes off the badge.
A gagged player no longer gets Edit in a group room, which the api refuses, and an edit refused as gagged or not allowed closes the editor since no retry can succeed. Esc and Cancel wait for a save in flight. Closing the editor hands focus back to the message's trigger, and a closed window seen by an edit or a self-delete re-checks the row so the trigger stops offering it. The edit ack no longer overwrites the server's edited_at when the room broadcast got there first; the two race, since the ack waits on the notification update. A conversation emptied by a delete closes its tab when it isn't on screen, matching the api dropping the conversation. The edited marker is keyboard-focusable so its time can be reached.
An edit or self-delete answered window_closed now takes the row's trigger away, and a stale trigger unmounting before its watcher runs no longer releases a hub lock someone else holds. Each test fails with its fix reverted.
lukepolo
force-pushed
the
feature/chat-self-edit
branch
from
September 29, 2026 01:17
85b4715 to
ea4fce8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Players can edit or delete their own chat messages for 10 minutes after sending them.
Socket.editMessageshares the delete request plumbing; the ack and the:editedbroadcast can land in either order, and an older edit never replaces a newer one.window_closedanswer re-checks the row.Merge/deploy: pairs with 5stackgg/api#442; stacked on #618, merge that first.
Tests: Edit offered to a gagged player, the empty DM tab, a stale ack or older edit winning, DM badge ids, the editor staying open on a refusal, Esc/Cancel mid-save, focus return, the window-closed recheck and a stray hub-lock release each fail with their fix reverted. Based on DEAFCS d4bd9f46e
Not covered: a self-edit refused as
window_closedcloses the editor and loses the typed text.