Module talk:AfC submission catcheck

What does this module do? edit

Any chance of some documentation or explanation? Any links to relevant discussions would be useful. Thanks — Martin (MSGJ · talk) 08:20, 1 October 2014 (UTC)Reply

@MSGJ: I just added a doc page for it. Jackmcbarn (talk) 12:00, 1 October 2014 (UTC)Reply
Thanks — Martin (MSGJ · talk) 12:01, 1 October 2014 (UTC)Reply

Requested move 23 June 2018 edit

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)Reply

Module:AFC submission catcheckModule:AFC submission check – Module does more than just check for categories. {{3x|p}}ery (talk) 17:40, 23 June 2018 (UTC)--Relisting. TheSandDoctor Talk 16:49, 1 July 2018 (UTC)Reply

  • 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)Reply
    Dicklyon, 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)Reply
    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)Reply
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 edit

@WOSlinker: I created {{Draft categories}} in May. 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 [1]. PrimeHunter (talk) 10:48, 30 June 2018 (UTC)Reply

@PrimeHunter: 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)Reply
@WOSlinker: Thanks. It looks good. PrimeHunter (talk) 15:31, 30 June 2018 (UTC)Reply

Template-protected edit request on 17 January 2019 edit

Hi. I'd like to add a line to the module, to remove another false positive.

From:

tc = removeFalsePositives(mw.ustring.gsub(tc,"%[%[Category:Articles created via the Article Wizard%]%]",""))

To:
tc = removeFalsePositives(mw.ustring.gsub(tc,"%[%[Category:Articles created via the Article Wizard%]%]",""))
tc = removeFalsePositives(mw.ustring.gsub(tc,"%[%[Category:Unsuitable for Wikipedia AfC submissions%]%]",""))

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)Reply

For a current example of why this is needed, see Draft:Annai Flim Factorie --DannyS712 (talk) 19:17, 17 January 2019 (UTC)Reply
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)Reply
@WOSlinker: 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)Reply
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)Reply
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%]%]","")
@WOSlinker: 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)Reply

More requests edit

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, "{{Draft categories.-}}", "")
str = mw.ustring.gsub(str, "{{draft categories.-}}", "")

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 {{ or }}, but if it does they should be escaped.

  Note: 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 "<nowiki>.-</nowiki>", 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)Reply

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)Reply
All done. -- WOSlinker (talk) 08:36, 18 January 2019 (UTC)Reply

Even more edit

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)Reply

@WOSlinker: if you have a minute, I have another request --DannyS712 (talk) 04:52, 19 January 2019 (UTC)Reply
Done -- WOSlinker (talk) 08:50, 19 January 2019 (UTC)Reply

Template-protected edit request on 7 March 2019 edit

Please remove line 10 in its entirety:

str = mw.ustring.gsub(str,"%[%[Category:Articles created via the Article Wizard%]%]","")

Per Wikipedia:Categories for discussion/Log/2019 January 6#Category:Articles created via the Article Wizard, the category was deleted.

Thanks, --DannyS712 (talk) 07:52, 7 March 2019 (UTC)Reply

Done {{3x|p}}ery (talk) 12:34, 7 March 2019 (UTC)Reply

Template-protected edit request on 17 March 2019 edit

After line 11 (str = mw.ustring.gsub(str,"%[%[Category:Drafts about.-%]%]","")), please add:

str = mw.ustring.gsub(str, "{{[Ss]uppress categories.-}}", "")

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)Reply

@DannyS712: Why would one use {{suppress categories}} as oppposed to {{Draft categories}} on a draft? {{3x|p}}ery (talk) 19:31, 17 March 2019 (UTC)Reply
@Pppery: 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)Reply
  Not done: please establish a consensus for this alteration before using the {{edit template-protected}} 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)Reply

Alternative approach to implementation edit

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. — Charles Stewart (talk) 14:22, 16 December 2020 (UTC)Reply

mw:Extension:CategoryToolbox is not installed on Wikipedia. * Pppery * it has begun... 04:28, 22 December 2020 (UTC)Reply

Template-protected edit request on 4 September 2021 edit

Another false positive case Category:Draft articles on for example Draft:PeanutButterGamer Cheers KylieTastic (talk) 11:58, 4 September 2021 (UTC)Reply

  Done. I changed the plural "Drafts" to optionally ignore the s ("Drafts?"). Primefac (talk) 12:08, 4 September 2021 (UTC)Reply

Template-protected edit request on 19 March 2023 edit

I've seen several uses of {{Draft Categories}} getting stuck in Category:AfC submissions with categories suggest change from

str = mw.ustring.gsub(str, "{{[Dd]raft categories[^{}]-{{[^{}]-}}[^{}]-}}", "")
str = mw.ustring.gsub(str, "{{[Dd]raft categories.-}}", "")

to

str = mw.ustring.gsub(str, "{{[Dd]raft [Cc]ategories[^{}]-{{[^{}]-}}[^{}]-}}", "")
str = mw.ustring.gsub(str, "{{[Dd]raft [Cc]ategories.-}}", "")

Cheers KylieTastic (talk) 16:11, 19 March 2023 (UTC)Reply

  Done Primefac (talk) 16:15, 19 March 2023 (UTC)Reply