【问题标题】:Notification Group Room message didn't show unread messages, only displays the browser notificationNotification Group Room 消息不显示未读消息,仅显示浏览器通知
【发布时间】:2020-09-16 19:29:02
【问题描述】:

如何显示未读消息,如私人聊天..

群组房间的任何新消息...没有像私人消息那样显示未读消息

【问题讨论】:

标签: converse.js


【解决方案1】:

这个问题在问题跟踪器中被标记为一个错误,所以也许它会被修复。以下是我使用插件使用的解决方法。它的作用是检查群组消息,并在收到时向最小化的聊天框添加一个类。我添加了一些带有样式的示例 css,以使框中的文本闪烁。

    converse.plugins.add('myplugin', {
        initialize: function () {
            var c = this._converse;

            c.on('message', function (m) {
                if (m.stanza.textContent!='' && m.attrs.type == 'groupchat') {
                    $('.chat-head-chatroom').addClass('alert-room');
                }
            });

        }
    });

    converse.initialize({
       ...
      whitelisted_plugins: ['myplugin'],
      ...

CSS 代码:

.alert-room {
    font-weight: bold !important;
}

    .alert-room .restore-chat {
        animation: blinker 1s linear infinite;
    }

@keyframes blinker {
    50% {
        opacity: 0.5;
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-13
    • 2017-03-16
    相关资源
    最近更新 更多