mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
refator(socket.io): deprecate socketGroups.getChatGroups in favour of api.admin.listGroups
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
const meta = require('../meta');
|
||||
const analytics = require('../analytics');
|
||||
const privileges = require('../privileges');
|
||||
const groups = require('../groups');
|
||||
|
||||
const adminApi = module.exports;
|
||||
|
||||
@@ -34,3 +35,11 @@ adminApi.getAnalyticsData = async (caller, { set, until, amount, units }) => {
|
||||
const getStats = units === 'days' ? analytics.getDailyStatsForSet : analytics.getHourlyStatsForSet;
|
||||
return await getStats(`analytics:${set}`, parseInt(until, 10) || Date.now(), amount);
|
||||
};
|
||||
|
||||
adminApi.listGroups = async () => {
|
||||
// N.B. Returns all groups, even hidden. Beware of leakage.
|
||||
// Access control handled at controller level
|
||||
|
||||
const payload = await groups.getNonPrivilegeGroups('groups:createtime', 0, -1, { ephemeral: false });
|
||||
return { groups: payload };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user