Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #671.
Sorry that this diff is hard to read, this change includes a fairly substantial refactor so that the creation of the report wikitext is done on its own rather than coupled with report posting logic. Aside from the obvious, I don't think there are any changes to functionality, other than that curly braces in edit summaries will now be escaped to prevent templates from getting rendered in AN3 reports given that they don't render in edit summaries.
Because of that refactor, it's highly possible this has broken something somewhere (especially considering there's now promise chains involved, which I can only barely wrap my head around): I've done quite a lot of testing to make sure that didn't happen but would appreciate someone double-checking my work, especially with AN3 reporting.
One thing that did come up is that in AN3 reports, the logic for filling the |orig= parameter in the report template seems to be broken (both before my change and after, I think) - I would have fixed it but frankly I don't really understand what should go into that parameter in the first place. The API call is not parsed properly (the following is from the current version):
twinkle/modules/twinklearv.js
Lines 854 to 894 in 3425932
Seems like the
data
parameter of the callback is trying to be read as an array, but the API call always returns an object. Addingdata = data.query.pages[data.query.pageids[0]].revisions;
at the start of that callback would convert the object to the array it thinks it is, but I don't know enough about what the |orig= parameter is even for to be able to decide whether that actually fixes the problem. I can't even really create a new ticket because I don't know what the expected behavior is, but if someone is able to explain I can probably fix it pretty easily.