xmpp.chapril.org-conversejs/src/shared/chat/templates/info-message.js
JC Brand 90ea092e4d Register a XEP-0316 MEP handler
Add caps element to the MUC join presence, so that the MUC MEP node can
know whether we're interested in receiving MEP messages.

Create info messages for any `conference-info` tags that contain `activity` tags.

Check for both `headline` and `normal` MEP messages (even though the XEP
only show `headline` examples), since `normal` messages can be archived
in MAM, but `headline` ones not.

Update the XEP-0372 reference-parsing code to take the `anchor`
attribute into consideration, specifically to check which text element
the reference applies to.

Add support for rendering XEP-0372 mentions in "info" messages and for
triggering HTML5 Desktop notifications for such mentions.

Background:
-----------

XEP-0316 describes a way for a MUC to send out PEP-like messages to MUC
participants. This feature can be used to describe custom activity happening
in the MUC.
2021-08-31 11:23:49 +02:00

28 lines
1.1 KiB
JavaScript

import { __ } from 'i18n';
import { converse } from '@converse/headless/core';
import { html } from 'lit';
const { dayjs } = converse.env;
export default (el) => {
const isodate = dayjs(el.model.get('time')).toISOString();
const i18n_retry = __('Retry');
return html`
<div class="message chat-info chat-${el.model.get('type')}"
data-isodate="${isodate}"
data-type="${el.data_name}"
data-value="${el.data_value}">
<div class="chat-info__message">
<converse-rich-text
.mentions=${el.model.get('references')}
render_styling
text=${el.model.getMessageText()}>
</converse-rich-text>
</div>
${ el.model.get('reason') ? html`<q class="reason">${el.model.get('reason')}</q>` : `` }
${ el.model.get('error_text') ? html`<q class="reason">${el.model.get('error_text')}</q>` : `` }
${ el.model.get('retry_event_id') ? html`<a class="retry" @click=${el.onRetryClicked}>${i18n_retry}</a>` : '' }
</div>`;
}