import { __ } from 'i18n/index.js'; import { getOOBURLMarkup } from 'utils/html.js'; import { html } from 'lit'; /** * @param {import('../message').default} el */ function tplEditedIcon(el) { const i18n_edited = __('This message has been edited'); return html``; } function tplCheckmark() { return html``; } /** * @param {import('../message').default} el */ export default (el) => { const i18n_show = __('Show more'); const is_groupchat_message = el.model.get('type') === 'groupchat'; const i18n_show_less = __('Show less'); const error_text = el.model.get('error_text') || el.model.get('error'); const i18n_error = `${__('Message delivery failed.')}\n${error_text}`; const tplSpoilerHint = html`
${el.model.get('spoiler_hint')} ${el.model.get('is_spoiler_visible') ? i18n_show_less : i18n_show}
`; const spoiler_classes = el.model.get('is_spoiler') ? `spoiler ${el.model.get('is_spoiler_visible') ? '' : 'hidden'}` : ''; const text = el.model.getMessageText(); const show_oob = el.model.get('oob_url') && text !== el.model.get('oob_url'); return html` ${el.model.get('is_spoiler') ? tplSpoilerHint : ''} ${el.model.get('subject') ? html`
${el.model.get('subject')}
` : ''} ${el.model.get('received') && !el.model.isMeCommand() && !is_groupchat_message ? tplCheckmark() : ''} ${el.model.get('edited') ? tplEditedIcon(el) : ''} ${show_oob ? html`
${getOOBURLMarkup(el.model.get('oob_url'))}
` : ''} ${error_text ? html`
${i18n_error}
` : ''} `; };