wikimedia-gadgets / afc-helper

A tool for reviewing Articles for Creation submissions on the English Wikipedia
https://en.wikipedia.org/wiki/Wikipedia:AFCH
GNU General Public License v3.0
37 stars 80 forks source link

Add warning if submitter is blocked #219

Closed gullyn closed 2 years ago

gullyn commented 2 years ago

This issue was raised in 2019 and was worked on, but no pull request was made. I've adapted @paul-111's code, updating the API request and fixing the formatting. This is what the warning looks like: Screenshot from 2022-02-10 17-41-28

gullyn commented 2 years ago

@primefac I think that's happening because I'm using the afchPage.getCreator function, which just returns the user who created the page (not the one who submitted it). I could potentially use a regex to parse the pageText to find the |u= parameter, since I don't think there is a function to do that right now.

primefac commented 2 years ago

90% of the time, the page creator will likely be the one who submitted the draft, but I've seen cases where (for example) a promo username violator created the page, got blocked, and then created a valid new account; the "creator's account" is blocked but the submitting editor isn't.

In other words, if it's possible, try to use the editor that submitted the draft over the page creator.

gullyn commented 2 years ago

@siddharthvp I've implemented the suggestions you've made. I tested it on https://test.wikipedia.org/wiki/Draft:AFCH_Issue_106 and it works fine.

gullyn commented 2 years ago

Okay, I've removed the $.Deferred. I'm not an expert on promises, as I usually use async/await. I tested it to make sure and it does still work.

gullyn commented 2 years ago

I've made those changes. The Date object is really annoying and doesn't have a format function like most other languages, so I've made it format like this: image

siddharthvp commented 2 years ago

Looks good to me now, thanks!

siddharthvp commented 2 years ago

^ my bad, accidentally merged this with a typo in the commit message