Closed zanhecht closed 3 months ago
Instructions: In the handleAccept function in submissions.js, in the part where we handle WikiProject banner templates, we should find WikiProject templates using a regular expression and remove class=draft
from them. Perhaps something like replacing {{(wikiproject.+?)\|class=draft(.+?)}}
(regex pseudocode, of course) with {{$1$2}}
might work.
Hello, i am looking into this issue and was wondering how can i reproduce this error(if that's not too complicated). Also,i searched around submissions.js but found handleAccept works on data parameter, so how could i solve this. I am using prettier vscode extension, should i use it or not as it formatted code which was different from earlier style.
It's not really an error, but if you have a WikiProject banner on the draft's talk page with class=draft
, the script should remove the "draft" part of the template call.
@Muditxofficial thanks for your interest! sorry for the delay in responding. to reproduce, sign into your wikipedia account, click this link, and click "publish page" at the bottom. That will create a new draft page. Then click on the "discussion" tab at the top (the text should be red, indicating the page doesn't exist yet). Once you're there, type {{wikiproject foo|class=draft}}
and hit "publish page" at the bottom. That creates a talk page for your draft, with a "banner" on it. The problem that this GitHub issue describes is that when you go to "publish" the draft and make it a real article, that banner does not have the class=draft part removed, but it should. So follow the steps at the developer setup page to set up the script. Be sure to then edit the src/afch.js file and write AFCH.consts.mockItUp=true;
after the line initializing the object AFCH.consts to enable "mock mode". Make sure the script is working. Then go to the draft page that you made earlier and open the script (by clicking "review" under the "more" menu), then click accept, then click the green accept button at the bottom. Then go to the browser console. There should be several JSON objects listed. One of them should have the text that you wrote earlier on the draft talk page (with the banner) as its "text" field. The error is that the banner still has draft=class.
To fix this error, the script must be changed so that draft=class is no longer there. This will probably be done by editing handleAccept. Right before the call to talkPage.edit, you can change the page text by changing the value of the talkText value. You may choose to use a regular expression to do this. I made an attempt at one in my comment above.
Feel free to reach out if you get stuck.
Oh yeah and I don't think prettier will work with this project's lint setup, apologies - you should probably disable it unless you can get it to run without eslint failing (which you can run with npm test)
@enterprisey Sorry for being inactive as my script was not working properly.Also i am attaching a screenshot, i think we need to remove "class=" part. It will be nice if you could share a regex resource as i only found some basic yt and didn't understand stackoverflow discussions.
In that screenshot, I think there's something strange going on; on the actual talk page I see a banner but there's no banner on the talk page text in that screenshot. But yes, that text
field is the part to look at, and the idea is to get rid of class=draft
whenever it appears. In the screenshot, there's just class=
without the draft part and that's fine.
For regex, I didn't find any tutorials I really liked, but try:
@enterprisey Since Muditxofficial has removed themself, is there any progress on this issue?
Ideally, the script should not only be removing class=draft, but it should be replacing it with the class selected in the drop-down when the draft is published.
hello , I'm interested to work on this project . @enterprisey can you assign me ?
Hello @enterprisey
I am Ayush, a web developer, and have a decent knowledge of the MERN stack.
I want to work on this issue, could you please assign this issue to me or any other issue to which I can contribute??
In edits like this one, the AFCH tool should be removing
class=draft
from the WikiProject templates, as drafts shouldn't ever be in mainspace.