oliver-zehentleitner / maity

web: chat: the cross chat pane shares the group chat pane parts instead of a copy (the copy never trims old messages)

Sign in to report

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.js open() (new in the range) copies the group chat pane in group-chat.js:
  • earlier-pages button and scroll trigger: cross-chat.js:231-264 and group-chat.js:206-239, word for word; chat.js:1066-1091 is a third variant;
  • the resyncBefore walk that picks up removals: cross-chat.js:280-293, group-chat.js:260-283, chat.js:1206-1222;
  • add: cross-chat.js:266-274 and group-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 add lets go of the oldest messages past parts.KEEP while the reader is at the bottom (group-chat.js:249, :552); the cross chat add does not, so a long-open cross chat keeps every message in the DOM.
  • chats.js showPane builds 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:819 and web/README.md:272 say 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; one paneCtx() in chats.js.

Effort / risk: M-L. Medium; smoke covers both chats.