各位 Discourse 高手,
如果可能的话,我想在主题中完成以下部分或全部操作(我目前还觉得自己没有能力去理解如何制作插件):
- 将用户菜单中的消息图标插入到页眉中,并保留其最近消息的弹出窗口。
- 为这个页眉中的消息图标添加新消息指示器(并从用户头像中移除该指示器)。
- 从用户菜单中移除消息图标。
我知道可以像这样在页眉中添加一个消息链接:
<script type="text/discourse-plugin" version="0.8">
const { iconNode } = require("discourse-common/lib/icon-library");
api.decorateWidget('header-icons:before', helper => {
return helper.h('li', [
helper.h('a.icon', {
href:'/my/messages',
title: 'Messages'
}, iconNode('envelope')),
]);
});
</script>
但它缺少弹出窗口。
我在 用户菜单 JavaScript 文件 中找到了以下代码:
if (this.siteSettings.enable_personal_messages || this.currentUser.staff) {
glyphs.push(this.messagesGlyph());
}
但我不确定是否可以在主题中应用它,也不知道具体该如何操作。
任何帮助都将不胜感激!