web: chat: the cross chat pane shares the group chat pane parts instead of a copy (the copy never trims old messages)
tsk-m20cfnk7bjyq Proposed
Audit round 6 (tsk-hgnbapyw7hnh), read at 046a4d3b. View: chat / cross chat. Kind: duplication with a behaviour difference.
What is wrong
cross-chat.jsopen()(new in the range) copies the group chat pane ingroup-chat.js:- earlier-pages button and scroll trigger:
cross-chat.js:231-264andgroup-chat.js:206-239, word for word;chat.js:1066-1091is a third variant; - the
resyncBeforewalk that picks up removals:cross-chat.js:280-293,group-chat.js:260-283,chat.js:1206-1222; add:cross-chat.js:266-274andgroup-chat.js:241-256;- manage
act(331-344/359-372), rename form (345-352/374-383), add picker (353-366/384-397), remove list (367-377/398-403); hintMention,typedInChat,sendIt(397-433/431-471), compose assembly (436-439/474-478),drawHead(444-452/485-493),refreshView(453-466/496-508), empty state (221-227/189-195),quote(205-211/162-168).- The copy has drifted: the group chat
addlets go of the oldest messages pastparts.KEEPwhile the reader is at the bottom (group-chat.js:249,:552); the cross chatadddoes not, so a long-open cross chat keeps every message in the DOM. chats.jsshowPanebuilds its pane context twice, for a cross chat (:321-353) and a project chat (:360-382): timers, listeners,every,stale,paneList,drawn,place,fitted.web/context/chat.md:819andweb/README.md:272say the open chat is the group chat's panes; in the code it is a copy.
Proposal
- Move the reading parts (earlier pager, add-and-trim, resync walk) into
M.chatParts, then the manage and compose parts behind options; onepaneCtx()inchats.js.
Effort / risk: M-L. Medium; smoke covers both chats.