From 4f7baa3e99ca7913c653727b580c90de10184fb3 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Tue, 23 Jun 2026 20:26:51 -0400 Subject: [PATCH] dm: delegate resolveProfileSummaryForPubkey to helper (fix moderation UI crash) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ProfileModerationController calls dmController.resolveProfileSummaryForPubkey when rendering moderation overrides, but the method lives on the DM helper and the controller didn't delegate it — so opening the profile modal's moderation settings threw an uncaught "is not a function". Add the helper delegation (createCompactProfileSummary right after it was already delegated). Covered by the delegation regression test. Co-Authored-By: Claude Opus 4.8 --- .../ProfileDirectMessageController.js | 8 ++++++++ tests/dm-controller-delegations.test.mjs | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/js/ui/profileModal/ProfileDirectMessageController.js b/js/ui/profileModal/ProfileDirectMessageController.js index cf0290da..07e0018b 100644 --- a/js/ui/profileModal/ProfileDirectMessageController.js +++ b/js/ui/profileModal/ProfileDirectMessageController.js @@ -680,6 +680,14 @@ export class ProfileDirectMessageController { return this.helper.resolveActiveDmRecipient(...args); } + // ProfileModerationController calls dmController.resolveProfileSummaryForPubkey + // (and createCompactProfileSummary, already delegated below). The method lives on + // the helper, so without this delegation the moderation-settings UI threw + // "is not a function" on open. + resolveProfileSummaryForPubkey(...args) { + return this.helper.resolveProfileSummaryForPubkey(...args); + } + createCompactProfileSummary(...args) { return this.renderer.createCompactProfileSummary(...args); } diff --git a/tests/dm-controller-delegations.test.mjs b/tests/dm-controller-delegations.test.mjs index 36024463..b402bc78 100644 --- a/tests/dm-controller-delegations.test.mjs +++ b/tests/dm-controller-delegations.test.mjs @@ -49,3 +49,22 @@ test("controller delegates every DM app-shell callback to this.actions", () => { ); } }); + +test("controller delegates resolveProfileSummaryForPubkey to this.helper", () => { + // ProfileModerationController calls dmController.resolveProfileSummaryForPubkey; + // the method lives on the helper, so the controller must delegate it. + const proto = ProfileDirectMessageController.prototype; + assert.equal(typeof proto.resolveProfileSummaryForPubkey, "function"); + const received = []; + const fake = { + helper: { + resolveProfileSummaryForPubkey: (...args) => { + received.push(args); + return "summary"; + }, + }, + }; + const result = proto.resolveProfileSummaryForPubkey.call(fake, "pubkey-x"); + assert.equal(result, "summary"); + assert.deepEqual(received[0], ["pubkey-x"]); +});