I found a good way to get the user list out of mongodb. In case anyone need it:
async function doMongoDb() { const { MongoClient } = require("mongodb"); const username = encodeURIComponent("admin"); const password = encodeURIComponent("mypassword"); const clusterUrl = "localhost:27017"; const authMechanism = "DEFAULT"; const uri = `mongodb://${username}:${password}@${clusterUrl}/?authMechanism=${authMechanism}`; const client = new MongoClient(uri, { useNewUrlParser: true, useUnifiedTopology: true }); try { await client.connect(); const database = client.db("nodebb"); const objects = database.collection("objects"); // get all user const query = { _key: /^user:\d+$/ }; // select fields we want to see const options = { projection: { _id: 0, username: true, _id: false, email: true, "email:confirmed": true, joindate: true, fullname: true }, }; const cursor = objects.find(query, options); if ((await cursor.count()) === 0) { console.log("No user found!"); } // iterate over the users await cursor.forEach(user => { if (user["email:confirmed"] == 1 ) { console.dir(user); } }); } finally { // make sure we close the connection await client.close(); } } // --------------------------------------------------- function init() { try { doMongoDb(); } catch(e) { console.log(e); } } // --------------------------------------------------- init();User Icons Testing
-
@henrywright hell, you could just generate six random hex characters and you'd do fine.
-
@pitaj you could, but that doesn't quite achieve uniqueness. MD5 isn't perfect but 99.99% of the time you'll get a unique colour from a username argument.
-
@henrywright yeah, there's a chance, but it's rediculously small. You are 99.99999% likely to get a unique color.
-
@pitaj true but calling something like MD5 on a username string will ensure you get the exact same colour for a particular user each time. That's something that's important if you're doing this each time on the fly and not storing the generated image.
-
-
@henrywright said:
The icons seem to be predominantly red in colour. Is the colour randomly generated?
That's definitely unintentional, just luck
The reason why we select from a set list is mostly because not all colours look good as icons (e.g. pity the user who gets
#ff0000
background), and maybe half don't look good with white as the text colourThese are some fancy colours that I use... (the yellow one doesn't work so well as you can see, and I don't use the greys at all)
-
@julian Nice color selection.
-
@julian Thanks for explaining, that sounds reasonable to me!
Regarding the avatars on the users page https://community.nodebb.org/users
For me, it seems only some are loading. I see a lot of blank white space where an avatar should be. Also if I scroll down the page I see the mystery man instead of the new "letter" icon.
Is this just me? I'm currently using latest Chrome on Chrome OS.
-
Hm, that's not right... not sure why they're showing up blank, while two others were working okay.
Also there's a user named @ElonMusk LOL
-
@julian said:
Also there's a user named @ElonMusk LOL
Yup, noticed that too. Keep an eye on the Tesla website for a NodeBB-powered forum
-
Tooltip is not displayed on the teaser.
-
@henrywright said:
Yup,
.user-icon
is the offending class andline-height
is the offending property.@pitaj @henrywright So yeah, changing this
line-height
to31px
fixes the issue. Fucking CSS, indeed. -
Thanks everybody for bug testing the user icons
The branch was getting a little stale and I had to re-do bits and pieces of it as they conflicted with
master
User Icons have landed in
master
!Best of all, the user icons are all generated via CSS! No image processing required (though that was a possible avenue we considered but decided against).
Guide to implementing this in your own custom themes/plugins
forthcoming.https://community.nodebb.org/topic/6583/0-9-0-breaking-changes/12 -
Oh, also, we changed the way the colours were picked per-user, so I hope you all weren't attached to your colours during the "beta"
-
Looking forward to testing this out!
-
Okay, final blocker to 0.9.0 is complete.
gh#3817
-
@julian Now can remove gravatar from package?
-
@xen It's already gone, it's a plugin now
-
@julian I mean from package.json
-
Yes, it is gone from
package.json
already. It may still be installed locally on your deployment, so you cannpm unlink
it