User talk:Enterprisey/userinfo
Global groups and locks?
[edit]Hey Enterprisey, would you be willing to add global groups and global locks to the reported info? It'll make the script a little slower since adding that will add a cross-wiki API call, but it seems like something that might be useful. I played around with the necessary requests a bit, here's what I came up with:
const api = new mw.Api();
api.get({
action: 'centralauthtoken'
}).done(function (result) {
const caToken = result.centralauthtoken.centralauthtoken;
const metaApi = new mw.ForeignApi('https://meta.wikimedia.org/w/api.php');
metaApi.get({
action: 'query',
list: 'globalallusers',
centralauthtoken: caToken,
agufrom: et,
aguto: et,
agulimit: 1,
aguprop: 'lockinfo|groups'
}).done(function (metaResult) {
if (metaResult.query.globalallusers.length === 0) {
// No match found
return;
}
const userObj = metaResult.query.globalallusers[0]
// Read properties from userObj
});
});
I'd propose a full set of changes to your script, but I'm not the best in the JS department, so this is a proof-of-concept instead. One important note - in their infinite wisdom, the designers of this API don't return true/false for whether something is locked, instead, we get an empty "locked" field in userObj if the user is locked and no "locked" field if they're not locked. GeneralNotability (talk) 18:25, 13 July 2020 (UTC)
- @GeneralNotability - took a while, but I finally got to adding global user groups. Let me know if it looks good on your end. (Tks4fish already did "locked".) Enterprisey (talk!) 07:33, 23 October 2021 (UTC)
- Thanks Enterprisey, you rock! I'll give it a shot and let you know if I find any issues. GeneralNotability (talk) 20:11, 23 October 2021 (UTC)
Users blocked from IPInfo
[edit]@Enterprisey: Hi, just here to suggest an update: add "no-ipinfo: 'something you like',
" (new user group) to friendlyGroupNames. Thank you. Jeeputer (talk) 22:35, 7 June 2022 (UTC)
- @Jeeputer, well, thanks for letting me know about yet another user group! Will add. Enterprisey (talk!) 19:44, 27 August 2022 (UTC)
"TypeError: query.globaluserinfo is undefined" when used from wikitech
[edit]I recently switched to using this script instead of another fork of the original because of your version's support for showing globally blocked status. Today I noticed that this support actually causes the script to fail when executed from wikitech. The issue is that wikitech does not include the CentralAuth extension which powers the meta=globaluserinfo
option for the action=query
Action API endpoint. Including globaluserinfo in the requested data is fine, but the response does not end up shaped like the subsequent processing code expects.
I think that adding typeof query.globaluserinfo != "undefined" &&
to the checks on lines 237 and 242 would guard against this edge case issue. There are quite likely several other ways that this could be dealt with, including telling me to fork the script and deal with its use on snowflake wikis myself. -- BDavis (WMF) (talk) 17:07, 20 June 2023 (UTC)
- I ended up forking the script and adding the guards myself for now. I would be happy to return to using this script instead in the future. -- BDavis (WMF) (talk) 19:50, 16 August 2023 (UTC)