As a result, I got such a script, maybe it will be useful to someone.
const Theme = {} const user = require.main.require('./src/user') const privileges = require.main.require('./src/privileges') Theme.getUsersByCategory = async function(data) { const { templateData: { cid } } = data const allUserIds = await user.getUidsFromSet('users:joindate', 0, -1) const asyncFilter = async (arr, predicate) => { const results = await Promise.all(arr.map(predicate)) return arr.filter((element, index) => results[index]) } const availableUserIds = await asyncFilter(allUserIds, async (id) => { return await privileges.categories.can('read', cid, id) }) data.templateData.availableUsers = await user.getUsersData(availableUserIds) return data } module.exports = ThemeBest posts made by user
-
-
great!
-
-
-
Ha! Nice!
-
Ah what! I got scared there for a second. Thought that this was a list done by a NodeBB staff member, instantly got scared to see my self at the top of the list. Looks amazing
-
Tricky tricky.
-
@baris time to replace posts with best posts in the user profile page?
-
Maybe should show some information as to why it's your best post? E.g. views/replies/upvotes.
-
@Schamper said:
Maybe should show some information as to why it's your best post? E.g. views/replies/upvotes.
I imagine it's purely based on upvotes. None of NodeBB's subjective algorithms are complex in any way, really
(mainly talking about "popular" here)