Files
bitvid/context/CONTEXT_1739837127.md
T
google-labs-jules[bot]andPR0M3TH3AN d22785bb87 [decompose] extract helpers from js/ui/profileModalController.js
Extracted DM Relay UI logic and DM Attachment logic into separate binder modules to reduce the size of ProfileModalController.js. Updated file size baseline.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 01:03:43 +00:00

1.1 KiB

Decompose: js/ui/profileModalController.js

Selection

Selected js/ui/profileModalController.js (6258 lines) because it is the largest grandfathered file not decomposed in the last 8 weeks.

Plan

Extract two cohesive blocks related to DM functionality that are currently mixed into the main controller:

  1. DM Relay UI Logic (ProfileDmRelayBinder.js)

    • cacheDmRelayElements
    • bindDmRelayControls
    • refreshDmRelayPreferences
    • handlePublishDmRelayPreferences
    • updateDmPrivacyToggleForRecipient
    • setPrivacyToggleState
    • handleActiveDmIdentityChanged
  2. DM Attachment Logic (ProfileDmAttachmentBinder.js)

    • renderAttachmentQueue
    • uploadAttachmentQueue
    • resolveLatestDirectMessageForRecipient
    • maybePublishTypingIndicator

These functions heavily rely on this.dmController and this.services, suggesting they belong in dedicated helpers or the DM controller itself. Extracting them to binder modules allows preserving the this context via argument passing while reducing the main file size.

Stats

  • Original size: 6258 lines
  • Target reduction: > 200 lines