Module talk:AfC submission catcheck

What does this module do?
Any chance of some documentation or explanation? Any links to relevant discussions would be useful. Thanks &mdash; Martin (MSGJ · talk) 08:20, 1 October 2014 (UTC)
 * I just added a doc page for it. Jackmcbarn (talk) 12:00, 1 October 2014 (UTC)
 * Thanks &mdash; Martin (MSGJ · talk) 12:01, 1 October 2014 (UTC)

Requested move 23 June 2018

 * The following discussion is an archived discussion of a requested move. Please do not modify it. Subsequent comments should be made in a new section on the talk page. No further edits should be made to this section.

No consensus to move at this time. bd2412 T 15:28, 14 July 2018 (UTC)

Module:AFC submission catcheck → Module:AFC submission check – Module does more than just check for categories. &#123;&#123;3x&#124;p&#125;&#125;ery (talk) 17:40, 23 June 2018 (UTC) --Relisting. The SandDoctor  Talk 16:49, 1 July 2018 (UTC)


 * Comment – I don't think module and template names matter much, since they are not visible to readers. And this one does not need a discussion to move it; so be bold and move it if you think that's a good idea, and if someone disagrees they'll let you know or move it back.  Not worthy of a wider discussion. Dicklyon (talk) 22:53, 5 July 2018 (UTC)
 * , we just had a huge issue with this module and Module:AfC being moved, because there are a half dozen pages and bots that use it in order to function properly that all broke. Primefac (talk) 23:02, 5 July 2018 (UTC)
 * Why wasn't that mentioned in the move proposal? And what's the compulsion to move it if it causes such problems to do so?  This RM is ridiculous to not spell these things out. Dicklyon (talk) 03:44, 6 July 2018 (UTC)
 * The above discussion is preserved as an archive of a requested move. Please do not modify it. Subsequent comments should be made in a new section on this talk page. No further edits should be made to this section.

Template:Draft categories removes categories
I created Draft categories in May. [//en.wikipedia.org/w/index.php?title=Draft:Deanna_Kamiel&diff=848093886&oldid=848083720 Example use]. It is not advertised anywhere and has almost no uses but I'm planning to advertise it. Can the module be coded to not add Category:AfC submissions with categories when Draft categories prevents the categories from being added? PrimeBot made an unnecessary "fix" in [//en.wikipedia.org/w/index.php?title=Draft:Deanna_Kamiel&diff=848138539&oldid=848102738]. PrimeHunter (talk) 10:48, 30 June 2018 (UTC)


 * I've created a version at Module:AFC submission catcheck/sandbox which I think should work. Did a little bit of testing and seemed ok. Have a look yourself and see what you think. -- WOSlinker (talk) 13:05, 30 June 2018 (UTC)
 * Thanks. It looks good. PrimeHunter (talk) 15:31, 30 June 2018 (UTC)

Template-protected edit request on 17 January 2019
Hi. I'd like to add a line to the module, to remove another false positive.

From:

To:

This is because the category (Unsuitable for Wikipedia AfC submissions) is a part of the AfC proces, and so should not be removed as a category that a draft is in.

Thanks,

--DannyS712 (talk) 19:17, 17 January 2019 (UTC)
 * For a current example of why this is needed, see Draft:Annai Flim Factorie --DannyS712 (talk) 19:17, 17 January 2019 (UTC)


 * I know it's been years - but do you have any feedback on this? — xaosflux  Talk 20:44, 17 January 2019 (UTC)
 * While there's no harm calling removeFalsePositives twice, it only needs to be called once, so the following should do as well:

tc = removeFalsePositives(mw.ustring.gsub(tc,"%[%[Category:Articles created via the Article Wizard%]%]","")) tc = mw.ustring.gsub(tc,"%[%[Category:Unsuitable for Wikipedia AfC submissions%]%]","")
 * -- WOSlinker (talk) 22:14, 17 January 2019 (UTC)
 * Why does it only need to be called once and/or what purpose does having the separate function serve? --DannyS712 (talk) 22:38, 17 January 2019 (UTC)
 * That function removes any html commented sections and nowiki sections from the text to look at. So once removed there is no need to call it again to remove the text since it's already gone.  It's in a separate function as it's called from two separate places in the code, from with "checkforcats" and "submitted". Another option for the code is to split into 3 lines as below, which may be more readable. -- WOSlinker (talk) 23:11, 17 January 2019 (UTC)

tc = removeFalsePositives(tc) tc = mw.ustring.gsub(tc,"%[%[Category:Articles created via the Article Wizard%]%]","") tc = mw.ustring.gsub(tc,"%[%[Category:Unsuitable for Wikipedia AfC submissions%]%]","")
 * Oh, I didn't realize that the articles created via the article wizard wasn't part of the actual function, but rather just nested inline. In that case, I would agree that it should be converted to 2 lines (and then add a 3rd that I am proposing) to improve readability. --DannyS712 (talk) 00:37, 18 January 2019 (UTC)

More requests

 * Request 2:

Purely to make the code easier to read:

Current line 7:

return mw.ustring.gsub(mw.ustring.gsub(str, "", ""), " .- ", "")

Replacement:

str = mw.ustring.gsub(str, "", "") str = mw.ustring.gsub(str, " .- ", "") return str


 * Request 3:

Remove category declarations that are nested within Draft categories, since those don't actually categorize pages. Assuming that the above request is implemented, please add the following 2 lines directly before the "return str":

str = mw.ustring.gsub(str, "", "") str = mw.ustring.gsub(str, "", "")

There are 2 different lines because lua is not case insensitive. To see a current example where this is needed, check out Draft:Nosheen Phoenix. As for as the specific coding above is concerned, I think that lua doesn't use, but if it does they should be escaped.

due to the limitations of displaying "nowiki" tags, it may seem unclear why this module uses "str = mw.ustring.gsub(str, " .- ", "")". The middle string is actually " .-  ", and I put the original in the source code of this edit request to make it easier to copy-paste.

Thanks, --DannyS712 (talk) 01:38, 18 January 2019 (UTC)
 * I have created Module:AFC submission catcheck/sandbox with all three of the changes requested being implimented. --DannyS712 (talk) 07:37, 18 January 2019 (UTC)


 * All done. -- WOSlinker (talk) 08:36, 18 January 2019 (UTC)

Even more
Sorry. I should have looked at this too before making the other requests


 * Request 4:

Remove categories that are in the form "Category:Drafts about" (as seen here). This would be accomplished by adding the check:

str = mw.ustring.gsub(str,"%[%[Category:Drafts about.-%]%]","")

I have implemented this request, and have moved this and the other checks for categories that shouldn't count into the "false positives" function for easier readability, at Module:AFC submission catcheck/sandbox. For a current example where this is needed, check out Draft:James Drake (wrestler). Thanks, --DannyS712 (talk) 04:52, 19 January 2019 (UTC)
 * if you have a minute, I have another request --DannyS712 (talk) 04:52, 19 January 2019 (UTC)
 * Done -- WOSlinker (talk) 08:50, 19 January 2019 (UTC)

Template-protected edit request on 7 March 2019
Please remove line 10 in its entirety:

Per Categories for discussion/Log/2019 January 6, the category was deleted.

Thanks, --DannyS712 (talk) 07:52, 7 March 2019 (UTC)
 * Done &#123;&#123;3x&#124;p&#125;&#125;ery (talk) 12:34, 7 March 2019 (UTC)

Template-protected edit request on 17 March 2019
After line 11, please add:

So that categories that are suppressed with Suppress categories do not create false positives (they aren't actually categorized, but they are labeled as having categories). For an example of such a false positive, see Special:Permalink/888225677. Thanks, --DannyS712 (talk) 19:26, 17 March 2019 (UTC)
 * Why would one use suppress categories as oppposed to Draft categories on a draft? &#123;&#123;3x&#124;p&#125;&#125;ery (talk) 19:31, 17 March 2019 (UTC)
 * I'm not sure, but I've seen it before (don't remember where) and it has the same result. Maybe if there are more experienced editors, who are prohibited from creating new articles directly, they submit AfC drafts and use suppress categories instead. --DannyS712 (talk) 19:33, 17 March 2019 (UTC)
 * Red information icon with gradient background.svg Not done: please establish a consensus for this alteration before using the template. It seems like there is already an existing template that can/should be used, so unless there's a consensus to change what appears to be the current norms I don't see this being necessary. I would also note that there are (currently) zero draft pages that use suppress categories. Primefac (talk) 23:15, 21 March 2019 (UTC)

Alternative approach to implementation
I see the experimental Extension:CategoryToolboxhas the function 'mw.ext.cattools.havePages':
 * mw.ext.cattools.havePages( categories, pages, [ depth ], [ mode ] )

...
 * If you specify mode as OR: for each page provided in the pages table, it checks if it belongs to at least one category, provided in the categories table.

IIUC, it is not expensive when not used recursively; i.e. when we test for direct membership of a category, rather than membership of subcategories. &mdash; Charles Stewart (talk) 14:22, 16 December 2020 (UTC)
 * mw:Extension:CategoryToolbox is not installed on Wikipedia. * Pppery * it has begun... 04:28, 22 December 2020 (UTC)

Template-protected edit request on 4 September 2021
Another false positive case Category:Draft articles on for example Draft:PeanutButterGamer Cheers KylieTastic (talk) 11:58, 4 September 2021 (UTC)
 * ✅. I changed the plural "Drafts" to optionally ignore the s ("Drafts?"). Primefac (talk) 12:08, 4 September 2021 (UTC)

Template-protected edit request on 19 March 2023
I've seen several uses of Draft Categories getting stuck in Category:AfC submissions with categories suggest change from

to

Cheers KylieTastic (talk) 16:11, 19 March 2023 (UTC)
 * ✅ Primefac (talk) 16:15, 19 March 2023 (UTC)