Fix @mention styling inside bold/italic + 3 audit loose ends (#55 follow-up) - #57
Merged
Merged
Conversation
…low-up) PRIMARY: @mentions inside inline emphasis lost their mention styling. MessageBubble.parseBody emitted bold/italic/strike tokens whose inner `value` was raw text never run through the mention/link splitter, so an @mention in **bold** or *italic* rendered with emphasis styling but no mention pill/color. Extract the mention+link classification into a shared `splitTextToSegments` helper, run it over emphasis inner values, and render the resulting children INSIDE the emphasis wrapper via a recursive `renderSeg` snippet — mentions/links now inherit emphasis styling AND get their own chip/link styling. Code spans stay literal (never linkified). `hasSelfMention` now recurses into emphasis children for the border accent. SECONDARY (audit follow-ups): - ChannelModal isPrivate wired end-to-end: App -> store.createChannel(id, topic, isPrivate). The create API takes no visibility arg, so createChannel sets the local row + retained meta to private AND persists via the admin path (setVisibility -> comms_conversation_update), mirroring ChannelAdminPanel. #handleMeta now reads visibility from the broadcast. - ArtifactDetailHeader Compare dropdown closes on outside mousedown via a <svelte:window> guard, mirroring ArtifactPanel's primary-dropdown pattern. - safeStorage DRY: extracted the byte-identical copies from mqtt-store and resizable-panel into a shared web/src/lib/safe-storage.js. Tests: +11 (bold/italic/strike/plain mention chips + code-not-linkified; createChannel private/public/queued; compare-dropdown outside-click). 1314 -> 1325 tests, all green; build green.
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.
Primary bug — @mentions inside bold/italic lose mention styling
In the message feed, an
@mentionin plain text rendered as a gold mention pill, but an@mentioninside**bold**/*italic*/~~strike~~rendered with the emphasis styling but without the mention color/pill.Root cause:
MessageBubble.parseBodyemittedbold/italic/striketokens (fromparseRich) whose innervaluewas raw text that was never run through the mention/link splitter. Only top-leveltexttokens got theparseMentions+ URL pass, so any@namewrapped in emphasis was rendered as plain emphasized text.Fix:
splitTextToSegmentshelper insideparseBody.children: splitTextToSegments(value), rendered inside the<strong>/<em>/strike wrapper via a recursiverenderSegsnippet — so a nested mention/link inherits the emphasis styling and gets its own chip/link styling.inline-code/block-code) are emitted as their own tokens and pushed literally, so an@nameinside backtickcodestays literal and is never linkified (XSS-safe; no new{@html}path; DOMPurify untouched).hasSelfMentionnow recurses into emphasischildrenso a self-mention inside emphasis still paints the bubble border accent.Secondary — 3 audit loose ends
isPrivatewired end-to-end.App.svelte→store.createChannel(id, topic, isPrivate). The backend create API (comms_conversation_create) takes no visibility argument, socreateChannelsets the local row + retained meta broadcast toprivateand persists it through the admin path (setVisibility→comms_conversation_update), mirroringChannelAdminPanel.#handleMetanow readsvisibilityback from the meta broadcast (was hardcodedpublic). No longer a silently-inert toggle.<svelte:window onmousedown>guard inArtifactDetailHeader.sveltefor the Compare dropdown (its open state is local to the header), mirroringArtifactPanel's primary-dropdown pattern.safeStorageDRY. The two byte-identical copies (mqtt-store.svelte.js+resizable-panel.svelte.js) are folded into a sharedweb/src/lib/safe-storage.js; both now import it.Tests
message-bubble-mention-emphasis.spec.js(new): bold**@alice**, italic*@bob*, strike~~@carol~~, plain@carolall render a.mentionchip;@daveinside backtickcodedoes not; mixed bold+plain.mqtt-store-admin-actions.spec.js(+3): private create sets localprivate+ firescomms_conversation_updatevisibility; public create does not; private create while disconnected queues the admin action.artifact-compare-dropdown-outside-click.spec.js(new): outside mousedown closes, inside mousedown keeps open.channel-modal-wires.spec.js: updated the create assertion to the 3-arg signature('phoenix', '', false).Counts: 1314 → 1325 tests, 97 → 99 files, 0 skips. Full suite green (run 2×, no flakiness, no stderr noise).
pnpm buildgreen. e2e source-level invariants: 55 passed.