Truncate long messages in support
parent
da9cccca88
commit
52393cafd6
|
@ -367,6 +367,29 @@ define([
|
|||
]);
|
||||
});
|
||||
|
||||
var displayed = content.message;
|
||||
var pre = h('pre.cp-support-message-content');
|
||||
var $pre = $(pre);
|
||||
var more;
|
||||
if (content.message.length >= 3000) {
|
||||
displayed = content.message.slice(0, 3000) + '...';
|
||||
var expand = h('button.btn.btn-secondary', Messages.admin_support_open);
|
||||
var collapse = h('button.btn.btn-secondary', Messages.admin_support_collapse);
|
||||
var $collapse = $(collapse).hide();
|
||||
var $expand = $(expand).click(function () {
|
||||
$pre.text(content.message);
|
||||
$expand.hide();
|
||||
$collapse.show();
|
||||
});
|
||||
$collapse.click(function () {
|
||||
$pre.text(displayed);
|
||||
$collapse.hide();
|
||||
$expand.show();
|
||||
});
|
||||
more = h('div', [expand, collapse]);
|
||||
}
|
||||
$pre.text(displayed);
|
||||
|
||||
var adminClass = (fromAdmin? '.cp-support-fromadmin': '');
|
||||
var premiumClass = (fromPremium && !fromAdmin? '.cp-support-frompremium': '');
|
||||
var name = Util.fixHTML(content.sender.name) || Messages.anonymous;
|
||||
|
@ -377,7 +400,8 @@ define([
|
|||
UI.setHTML(h('span'), Messages._getKey('support_from', [name])),
|
||||
h('span.cp-support-message-time', content.time ? new Date(content.time).toLocaleString() : '')
|
||||
]),
|
||||
h('pre.cp-support-message-content', content.message),
|
||||
pre,
|
||||
more,
|
||||
h('div.cp-support-attachments', attachments),
|
||||
isAdmin ? userData : undefined,
|
||||
]);
|
||||
|
|
Loading…
Reference in New Issue