Fix logging for status command

This commit is contained in:
Travis Ralston 2020-01-21 13:13:46 -07:00
parent cebd0309cb
commit c1ea98f55d

View File

@ -1,5 +1,5 @@
/*
Copyright 2019 The Matrix.org Foundation C.I.C.
Copyright 2019, 2020 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -48,7 +48,7 @@ export async function execStatusCommand(roomId: string, event: any, mjolnir: Mjo
}
html += `<b>Protected rooms: </b> ${Object.keys(mjolnir.protectedRooms).length}<br/>`;
text += `Protected rooms: ${mjolnir.protectedRooms.length}\n`;
text += `Protected rooms: ${Object.keys(mjolnir.protectedRooms).length}\n`;
// Append list information
html += "<b>Subscribed ban lists:</b><br><ul>";
@ -58,6 +58,10 @@ export async function execStatusCommand(roomId: string, event: any, mjolnir: Mjo
html += `<li><a href="${list.roomRef}">${list.roomId}</a> (${ruleInfo})</li>`;
text += `* ${list.roomRef} (${ruleInfo})\n`;
}
if (mjolnir.lists.length === 0) {
html += "<li><i>None</i></li>";
text += "* None\n";
}
html += "</ul>";
const reply = RichReply.createFor(roomId, event, text, html);