-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Special handling for subcats of Category:Draft articles #131
Comments
Hi @enterprisey , would like to take this as my next issue . Hope you could brief me about it, I went through the links you provided couldn't make much out of it. |
@satcasm So there are two changes. Let's call all subcategories of Category:Draft articles "draft categories". Then these "draft categories" should:
I can think of many ways to check if a category is a draft category. The "cheating" way is to just check if the name of the draft starts with "Drafts about" (or is equal to "Promising drafts"), because that catches most of them, but that wouldn't handle most of the subcategories. The better way, which we should use in the final product (maybe just use the "cheating" way to check that your category handling code above is correct, temporarily) is to use localStorage, like the loadWikiProjectList function. We could make a getDraftArticlesSubcats function that does the same thing (if lsKey is in localStorage, parse and return that array of categories; otherwise, get it from the API and then return it). You'll probably need https://www.mediawiki.org/wiki/API:Categorymembers, with cmtype=subcat. Unfortunately, it doesn't return subcategories of subcategories, so you'll need recursion... perhaps write a recursive getSubcats function, and then call it from getDraftArticlesSubcats with the parameter "Draft articles". Recursion and callbacks do not mix well at all; feel free to let me know when you get to that part. So, once you have getDraftArticlesSubcats, you'll call it from the two places I checked above and then check if every category is in the return value, doing the appropriate thing in each place. Let me know what I should clarify or if you have any questions. |
@enterprisey in the else part of AFCH.Text.prototype.cleanUp nothing is mentioned about subcategories. So what exactly did you mean by |
The comment is inaccurate; changing |
Hey @enterprisey , so I started small with the "cheating method". This is of else part:
in a draft and when I accepted it , in the text field I am getting one |
In both of those functions, |
But for the time being is there something wrong with this code ? I mean I am using |
Yeah, if you use |
Okay so what should I pass along with the |
I would recommend creating a helper function, getDraftArticlesSubcats, that returns a list of categories; for now, you could just have it return a hard-coded array with a single item for testing, like Category:Drafts about people. Then, in updateCategories, check if |
Remove subcats of Category:Draft articles when accepting
https://en.wikipedia.org/w/index.php?diff=1001040898
davidwr at 23:59, 17 January 2021 (UTC)
Also don't convert subcats of Category:Draft articles into cat links during cleanup
https://en.wikipedia.org/w/index.php?diff=1001705243
2pou at 22:56, 20 January 2021 (UTC)
The text was updated successfully, but these errors were encountered: