Restrict unfurl description to `message_limit` setting
This commit is contained in:
parent
8dd8c7d1dd
commit
1bd4572957
|
@ -127,10 +127,15 @@ export function getOpenGraphMetadata (stanza) {
|
|||
const applies_to_id = fastening.getAttribute('id');
|
||||
const meta = sizzle(`> meta[xmlns="${Strophe.NS.XHTML}"]`, fastening);
|
||||
if (meta.length) {
|
||||
const msg_limit = api.settings.get('message_limit');
|
||||
const data = meta.reduce((acc, el) => {
|
||||
const property = el.getAttribute('property');
|
||||
if (property) {
|
||||
acc[property] = decodeHTMLEntities(el.getAttribute('content') || '');
|
||||
let value = decodeHTMLEntities(el.getAttribute('content') || '');
|
||||
if (msg_limit && property === 'og:description' && value.length >= msg_limit) {
|
||||
value = `${value.slice(0, msg_limit)}${decodeHTMLEntities('…')}`;
|
||||
}
|
||||
acc[property] = value;
|
||||
}
|
||||
return acc;
|
||||
}, {
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
auto_away: 300,
|
||||
auto_register_muc_nickname: true,
|
||||
loglevel: 'debug',
|
||||
message_limit: 300,
|
||||
modtools_disable_assign: ['owner', 'moderator', 'participant', 'visitor'],
|
||||
modtools_disable_query: ['moderator', 'participant', 'visitor'],
|
||||
enable_smacks: true,
|
||||
|
|
Loading…
Reference in New Issue