Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 225bb64

Browse files
committed
Remove direct access to the topicController
1 parent 22aa932 commit 225bb64

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

assets/javascripts/initializers/ai-bot-replies.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,28 +61,20 @@ function initializePersonaDecorator(api) {
6161
}
6262

6363
function initializeWidgetPersonaDecorator(api) {
64-
let topicController = null;
6564
api.decorateWidget(`poster-name:after`, (dec) => {
6665
if (!isGPTBot(dec.attrs.user)) {
6766
return;
6867
}
69-
// this is hacky and will need to change
70-
// trouble is we need to get the model for the topic
71-
// and it is not available in the decorator
72-
// long term this will not be a problem once we remove widgets and
73-
// have a saner structure for our model
74-
topicController =
75-
topicController || api.container.lookup("controller:topic");
7668

7769
return dec.widget.attach("persona-flair", {
78-
topicController,
70+
personaName: dec.model?.topic?.ai_persona_name,
7971
});
8072
});
8173

8274
registerWidgetShim(
8375
"persona-flair",
8476
"span.persona-flair",
85-
hbs`{{@data.topicController.model.ai_persona_name}}`
77+
hbs`{{@data.personaName}}`
8678
);
8779
}
8880

0 commit comments

Comments
 (0)