mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
dm: delegate resolveProfileSummaryForPubkey to helper (fix moderation UI crash)
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 <[email protected]>
This commit is contained in:
1 parent
eda212e187
commit
4f7baa3e99
2 files changed
+27
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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"]);
|
||||
});
|
||||
Reference in new issue
Block a user