Open enterprisey opened 3 years ago
Just as further explanation, if there is a /draft template on the page, and the user uses the "Submit" option via AFCH, the tool will take the timestamp from the /draft template instead of the current time, which means that the draft ends up in an old (and usually literally "very old").
In other words, AFCH should use the current timestamp and ignore the ts= from the /draft template.
(thanks primefac!)
@enterprisey I want to work on this issue, can you elaborate on it a little.
ok, the relevant function is handleSubmit in submissions.js. In that function you want afchSubmission, which is the submission object, to use the current timestamp and ignore the timestamp that's previously set. You should only need to change one or two lines.
I changed the draft in your userspace to show the issue: https://test.wikipedia.org/wiki/User:Prernajha2609/Testing_AFCH. Note that when you try to submit it, the ts= parameter starts with 2019 instead of the current year.
function handleSubmit( data ) { var text = data.afchText, submitter = $.Deferred(), submitType = data.submitType;
if ( submitType === 'other' ) {
submitter.resolve( data.submitterName );
} else if ( submitType === 'self' ) {
submitter.resolve( AFCH.consts.user );
} else if ( submitType === 'creator' ) {
afchPage.getCreator().done( function ( user ) {
submitter.resolve( user );
} );
} else {
// Custom selected submitter
submitter.resolve( data.submitType );
}
submitter.done( function ( submitter ) {
afchSubmission.setStatus( '', { u: submitter } );
text.updateAfcTemplates( afchSubmission.makeWikicode() );
text.cleanUp();
afchPage.edit( {
contents: text.get(),
summary: 'Submitting'
} );
} );
}
this is the handleSubmit function but I cannot find anything related to timestamp in this.But in the core.js file there is a function which implements the timestamp.
yes, currently there is nothing related to the timestamp; you'll have to add some code that sets the timestamp
I added some code but can't see any changes.
Make sure your code is setting the right template parameter. I suspect setting ts
in the same way that the existing code sets u
should work.
I improved the logging display, by the way, so if you want that code, follow the instructions here under "keep your copy of the code up to date".
This is how it looks now.
@enterprisey what should I do next?
you will first need to remove the second and third {{AfC submission}}
lines in the current version of the draft. to put it into the "draft" status (gray box only). then try to submit the draft using the helper script (not by using the "Submit your draft for review!" button). in the browser console there will be some JSON showing the edit it would have made to the sandbox page. the JSON will contain the new draft text somewhere (which you can recognize because it'll start with {{AFC submission
). the |ts= parameter in the new draft text should start with 2022, the current year, instead of some other year. This bug is fixed when the parameter starts with 2022.
I am trying to make some changes but they are not visible when I refresh the page.
You shouldn't have to make any edits to the draft page for this bug, but anyway, you need to click the "Publish Changes" button on the bottom to make an edit.
No, I am editing the code but it doesn't work.
I can't help without more details, including what you're trying to do, what you've tried, what the current error is (and if there's no error, what you expect to see and what you're getting instead), and what research you've done first. I found a couple of articles on how to ask questions that you may also want to refer to: from ProPublica and from a blog.
https://en.wikipedia.org/wiki/Wikipedia_talk:WikiProject_Articles_for_creation/Archive_39#AFC_submit_glitch