Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
348 Visualizzazioni

hello

I want to add button in discuss channel chat near to notification settings button that do some python code 
how do this?

Avatar
Abbandona
Autore

i try this code
threadActionsRegistry.add("custom_action", {
condition(component) {
// Show only in channel threads
return component.thread?.model === "discuss.channel";
},
async onClick(ev) {
const orm = useService("orm");
const notification = useService("notification");

try {

const result = this.orm.call(
"discuss.channel", // Model name
"chatbot_inactive", // Method name
[session.uid,ev], // Arguments

);

notification.add(result.message, { type: "success" });
} catch (error) {
notification.add(_t("Action failed"), { type: "danger" });
}
},

icon: "fa fa-fw fa-file", // Change icon as needed
name: _t("Custom Action"), // Button tooltip

});
that add button but nothing happen when i click it

Autore Risposta migliore

no answer

Avatar
Abbandona