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"]); +});