Skip to content

Node.js based forum software built for the modern web

fix: filter out expired errors, show error type (in or out) in template

Julian Lame22d2e4169fe
diff --git a/src/controllers/admin/federation.js b/src/controllers/admin/federation.js
index d94dd0726c..4b9aa604e0 100644
--- a/src/controllers/admin/federation.js
+++ b/src/controllers/admin/federation.js
@@ -90,6 +90,9 @@ federationController.errors = async function (req, res) {
let errors = await db.getSortedSetRevRangeByScoreWithScores('ap.errors', 0, -1, Date.now(), '-inf');
const errorObj = await db.getObjects(errors.map(({ value: id }) => `ap.errors:${id}`));
errors = errors.map(({ value: id, score: timestamp }, idx) => {
+ if (!errorObj[idx]) {
+ return null;
+ }
let { body, stack } = errorObj[idx];
let hostname = 'Invalid hostname';
const timestampISO = new Date(timestamp).toISOString();
@@ -101,7 +104,7 @@ federationController.errors = async function (req, res) {
}
return { id, body, stack, hostname, timestamp, timestampISO };
- });
+ }).filter(Boolean);
res.render('admin/federation/errors', {
title: '[[admin/menu:federation/errors]]',
diff --git a/src/views/admin/federation/errors.tpl b/src/views/admin/federation/errors.tpl
index 8af5c18945..ad85844ad7 100644
--- a/src/views/admin/federation/errors.tpl
+++ b/src/views/admin/federation/errors.tpl
@@ -11,7 +11,9 @@
{{{ each errors }}}
<details class="mb-3" data-index="{@index}">
<summary>
- <span title="{./timestampISO}" class="timeago text-secondary text-sm"></span><br/ >
+ <span title="{./timestampISO}" class="timeago text-secondary text-sm"></span>
+ <span class="badge text-bg-primary">{{{ if (type == "in") }}}IN{{{ else }}}OUT{{{ end }}}</span>
+ <br/ >
<code>{./id}</code>
</summary>