mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #934] [MERGED] fix(chat): allow clearing Discord mirror URL via select-all+backspace #4845
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#4845
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/934
Author: @Romuromylus
Created: 5/17/2026
Status: ✅ Merged
Merged: 5/17/2026
Merged by: @Romuromylus
Base:
staging← Head:fix/914-discord-mirror-clear📝 Commits (3)
bf018abfix(chat): allow clearing Discord mirror URL via select-all+backspace06231f6Merge branch 'staging' into fix/914-discord-mirror-clear441569aMerge branch 'staging' into fix/914-discord-mirror-clear📊 Changes
1 file changed (+1 additions, -1 deletions)
View changed files
📝
packages/client/src/components/chat/ChatSettingsDrawer.tsx(+1 -1)📄 Description
Linked issue
Closes #914
Why this change
Reported in #914: selecting the Discord mirror URL field and hitting Backspace (or any select-all + delete) does not clear the URL. The only workaround today is char-by-char deletion, which the OP correctly flagged as broken behaviour.
The clear flow currently dispatches a
useUpdateChatMetadatamutation withdiscordWebhookUrl: e.target.value.trim() || undefined. When the input is empty, the value resolves toundefined,JSON.stringifydropsundefined-valued keys before sending, the PATCH body arrives at/chats/:id/metadatawithout the key at all, and the server's{ ...existing, ...incoming }merge inchats.routes.ts:369therefore preserves whatever URL was previously stored. The local controlled-input state updates regardless, which is why the field looks empty until the drawer re-reads metadata and the old value reappears.Char-by-char deletion suffers from the same final keystroke — the apparent success is just the optimistic local state catching up before the user reopens the drawer.
What changed
packages/client/src/components/chat/ChatSettingsDrawer.tsx— drop the|| undefinedfallback in the Discord mirror URL onChange so an empty input dispatchesdiscordWebhookUrl: ""instead. The trimmed empty string survives JSON serialisation, the server-side regex validation atchats.routes.ts:362short-circuits on falsy values (no spurious "Invalid Discord webhook URL" 400), the merge sets the stored value to"", and every existing consumer already treats empty string as "no URL":generate.routes.ts:894readstypeof earlyMeta.discordWebhookUrl === "string" ? earlyMeta.discordWebhookUrl : "".generate.routes.ts:953,1231,6839,6844gate Discord posting behind a truthydiscordWebhookUrlcheck.game.routes.ts:937returns the trimmed value or"".ChatSettingsDrawer.tsx:4758ismetadata.discordWebhookUrl && !regex.test(...)— falsy short-circuits, no banner on empty.One-line fix, no schema or migration impact.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Will verify on my private EasyPanel fork build before promoting this out of draft:
Docs and release impact
UI evidence (if applicable)
Will add a short screen capture of the clear flow alongside the manual-verification pass.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.