Fix topics plugin to avoid displaying "And 0 more..." when they are less topics than limit

This commit is contained in:
lowlighter
2021-01-21 13:15:23 +01:00
parent 3f5bf4d531
commit 1608b8beec

View File

@@ -57,6 +57,7 @@
if ((mode === "starred")&&(limit > 0)) { if ((mode === "starred")&&(limit > 0)) {
console.debug(`metrics/compute/${login}/plugins > topics > keeping only ${limit} topics`) console.debug(`metrics/compute/${login}/plugins > topics > keeping only ${limit} topics`)
const removed = topics.splice(limit) const removed = topics.splice(limit)
if (removed.length)
topics.push({name:`And ${removed.length} more...`, description:removed.map(({name}) => name).join(", "), icon:null}) topics.push({name:`And ${removed.length} more...`, description:removed.map(({name}) => name).join(", "), icon:null})
} }
//Convert icons to base64 //Convert icons to base64