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 applies_to_id = fastening.getAttribute('id');
|
||||||
const meta = sizzle(`> meta[xmlns="${Strophe.NS.XHTML}"]`, fastening);
|
const meta = sizzle(`> meta[xmlns="${Strophe.NS.XHTML}"]`, fastening);
|
||||||
if (meta.length) {
|
if (meta.length) {
|
||||||
|
const msg_limit = api.settings.get('message_limit');
|
||||||
const data = meta.reduce((acc, el) => {
|
const data = meta.reduce((acc, el) => {
|
||||||
const property = el.getAttribute('property');
|
const property = el.getAttribute('property');
|
||||||
if (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;
|
return acc;
|
||||||
}, {
|
}, {
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
auto_away: 300,
|
auto_away: 300,
|
||||||
auto_register_muc_nickname: true,
|
auto_register_muc_nickname: true,
|
||||||
loglevel: 'debug',
|
loglevel: 'debug',
|
||||||
|
message_limit: 300,
|
||||||
modtools_disable_assign: ['owner', 'moderator', 'participant', 'visitor'],
|
modtools_disable_assign: ['owner', 'moderator', 'participant', 'visitor'],
|
||||||
modtools_disable_query: ['moderator', 'participant', 'visitor'],
|
modtools_disable_query: ['moderator', 'participant', 'visitor'],
|
||||||
enable_smacks: true,
|
enable_smacks: true,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user