Skip to content

Node.js based forum software built for the modern web

fix(federation): resolve analytics lint errors (#14703)

Sebastian Albrechtce136e06904c
diff --git a/public/src/admin/federation/analytics.js b/public/src/admin/federation/analytics.js
index db7837f40c..83cad0e549 100644
--- a/public/src/admin/federation/analytics.js
+++ b/public/src/admin/federation/analytics.js
@@ -81,7 +81,7 @@ async function renderActivitiesByTypeLegend() {
const total = Object.values(byType).reduce((sum, v) => sum + v, 0);
const entries = Object.entries(byType)
- .filter(([type, count]) => count > 0)
+ .filter(([, count]) => count > 0)
.sort(([, a], [, b]) => b - a);
const items = entries.map(([type, count], idx) => {
@@ -206,8 +206,9 @@ async function initializeCharts() {
labels: pieEntries.map(([type]) => type),
datasets: [{
data: pieEntries.map(([, count]) => count),
- backgroundColor: pieEntries.map(([, count], idx) =>
- pieColors[idx % pieColors.length]
+ backgroundColor: Array.from(
+ pieEntries.keys(),
+ idx => pieColors[idx % pieColors.length]
),
}],
};
diff --git a/src/controllers/admin/federation.js b/src/controllers/admin/federation.js
index 62aad1016c..747ab1e8b8 100644
--- a/src/controllers/admin/federation.js
+++ b/src/controllers/admin/federation.js
@@ -118,7 +118,7 @@ federationController.analytics = async function (req, res) {
async function getActivitiesByType() {
const analyticsKeys = await db.getSortedSetRange('analyticsKeys', 0, -1);
- const typeKeys = analyticsKeys.filter((key) => key.startsWith('activities:byType:'));
+ const typeKeys = analyticsKeys.filter(key => key.startsWith('activities:byType:'));
const results = await Promise.all(typeKeys.map(async (key) => {
const entries = await db.getSortedSetRangeWithScores(`analytics:${key}`, 0, -1);