I am trying to override the renderActions function but it is not working, I am trying to add icons in every massage, I have tried like the below code:
export const restrictUserOnLoadPlugin = () => {
window.converse.plugins.add('restrict-user', {
overrides: {
renderActions: function () {
console.log('in');
const kick = {
i18n_text: 'kick',
handler: (e: any) => console.log(e),
button_class: 'chat-msg__action-edit',
icon_class: 'fa fa-pencil-alt',
name: 'kick',
};
return `<converse-dropdown class="chat-msg__actions" .items=${kick}></converse-dropdown>`;
},
},
});
};
Using overrides is discouraged and should be avoided when possible. They only work with classes or objects that have been set as attributes on the
_converseobject, which is not the case for web components, which is what you're trying to override here. So it won't work.Instead you should use the
getMessageActionButtonshook to add or update buttons. https://conversejs.org/docs/html/api/-_converse.html#event:getMessageActionButtonsHere is documentation which describes how hooks work: https://github.com/conversejs/converse.js/blob/3b124cfdceb684ccbe3d20f7ea5cde20a1189f0b/docs/source/plugin_development.rst#hooks
So your code would be something like this: