Skip to content
Snippets Groups Projects
Commit 7427b450 authored by echicken's avatar echicken :chicken:
Browse files

block-sender button handling

parent d55de85b
No related branches found
No related tags found
No related merge requests found
...@@ -352,18 +352,19 @@ function onThreadStats(data) { ...@@ -352,18 +352,19 @@ function onThreadStats(data) {
/* Fetch a private mail message's body (with links to attachments) where 'id' /* Fetch a private mail message's body (with links to attachments) where 'id'
is the message number. Output it to an element with id 'message-<id>'. */ is the message number. Output it to an element with id 'message-<id>'. */
async function getMailBody(id) { async function getMailBody(id) {
if (!$('#message-' + id).attr('hidden')) { const tgt = `#message-${id}`;
$('#message-' + id).attr('hidden', true); if (!$(tgt).attr('hidden')) {
} else if ($('#message-' + id).html() != '') { $(tgt).attr('hidden', true);
$('#message-' + id).attr('hidden', false); } else if ($(tgt).html() != '') {
$(tgt).attr('hidden', false);
} else { } else {
const data = await v4_get('./api/forum.ssjs?call=get-mail-body&number=' + id); const data = await v4_get(`./api/forum.ssjs?call=get-mail-body&number=${id}`);
var str = data.body; var str = data.body;
if (data.inlines && data.inlines.length > 0) { if (data.inlines && data.inlines.length > 0) {
str += '<br>Inline attachments: ' + data.inlines.join('<br>') + '<br>'; str += `<br>Inline attachments: ${data.inlines.join('<br>')}<br>`;
} }
if (data.attachments && data.attachments.length > 0) { if (data.attachments && data.attachments.length > 0) {
str += '<br>Attachments: ' + data.attachments.join('<br>') + '<br>'; str += `<br>Attachments: ${data.attachments.join('<br>')}<br>`;
} }
str += str +=
'<button class="btn btn-default icon" ' + '<button class="btn btn-default icon" ' +
...@@ -377,11 +378,17 @@ async function getMailBody(id) { ...@@ -377,11 +378,17 @@ async function getMailBody(id) {
'title="Delete this message" onclick="deleteMessage(\'mail\',' + id + ')">' + 'title="Delete this message" onclick="deleteMessage(\'mail\',' + id + ')">' +
'<span class="glyphicon glyphicon-trash"></span>' + '<span class="glyphicon glyphicon-trash"></span>' +
'</button>'; '</button>';
$('#message-' + id).html(str); if (data.buttons) str += data.buttons.join('');
$('#message-' + id).attr('hidden', false); $(tgt).html(str);
$(tgt).attr('hidden', false);
} }
} }
async function blockSender(id, from, from_net) {
const data = await v4_get(`./api/forum.ssjs?call=block-sender&from=${from}&from_net=${from_net}`);
if (!data.err) $(`#bsb-${id}`).attr('disabled', true);
}
async function setScanCfg(sub, cfg) { async function setScanCfg(sub, cfg) {
var opts = [ 'scan-cfg-off', 'scan-cfg-new', 'scan-cfg-youonly' ]; var opts = [ 'scan-cfg-off', 'scan-cfg-new', 'scan-cfg-youonly' ];
const data = await v4_get('./api/forum.ssjs?call=set-scan-cfg&sub=' + sub + '&cfg=' + cfg); const data = await v4_get('./api/forum.ssjs?call=set-scan-cfg&sub=' + sub + '&cfg=' + cfg);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment