How to use the @converse/headless/utils/core.isOnlyEmojis function in @converse/headless

To help you get started, we’ve selected a few @converse/headless examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github conversejs / converse.js / src / headless / utils / stanza.js View on Github external
getMessageAttributesFromStanza (stanza, original_stanza, chatbox, _converse) {
        const is_muc = u.isChatRoom(chatbox);
        let attrs = Object.assign(
            stanza_utils.getStanzaIDs(stanza, original_stanza),
            stanza_utils.getRetractionAttributes(stanza, original_stanza),
            is_muc ? stanza_utils.getModerationAttributes(stanza, original_stanza, chatbox) : {},
        );
        const text = stanza_utils.getMessageBody(stanza, is_muc, _converse) || undefined;
        const delay = sizzle(`delay[xmlns="${Strophe.NS.DELAY}"]`, original_stanza).pop();
        attrs = Object.assign(
            {
                'chat_state': stanza_utils.getChatState(stanza),
                'is_archived': stanza_utils.isArchived(original_stanza),
                'is_delayed': !!delay,
                'is_only_emojis': text ? u.isOnlyEmojis(text) : false,
                'message': text,
                'msgid': stanza.getAttribute('id') || original_stanza.getAttribute('id'),
                'references': stanza_utils.getReferences(stanza),
                'subject': propertyOf(stanza.querySelector('subject'))('textContent'),
                'thread': propertyOf(stanza.querySelector('thread'))('textContent'),
                'time': delay ? dayjs(delay.getAttribute('stamp')).toISOString() : (new Date()).toISOString(),
                'type': stanza.getAttribute('type')
            },
            attrs,
            stanza_utils.getSenderAttributes(stanza, chatbox, _converse),
            stanza_utils.getOutOfBandAttributes(stanza),
            stanza_utils.getSpoilerAttributes(stanza),
            stanza_utils.getCorrectionAttributes(stanza, original_stanza)
        )
        return attrs;
    }