Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
346 Widoki

hello

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

Awatar
Odrzuć
Autor

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

Autor Najlepsza odpowiedź

no answer

Awatar
Odrzuć