Permalink
Browse files

Strip edit request templates

drafts should never be protected or have edit requests on them
  • Loading branch information...
Technical-13 committed Jan 11, 2014
1 parent 5d61b3c commit 5d45540dc0a24b7f84e9715da03b907d8b18d948
Showing with 1 addition and 0 deletions.
  1. +1 −0 src/submissions.js
View
@@ -1191,6 +1191,7 @@ function afcHelper_cleanup(text,type) {
text = text.replace(/(?:<\s*references\s*>([\S\s]*)<\/references>|<\s*references\s*\/\s*>)/gi, "\n{{reflist|refs=$1}}");
text = text.replace("{{reflist|refs=}}", "{{reflist}}"); // hack to make sure we don't leave an unneeded |refs=
text = text.replace(/\{\{(userspacedraft|userspace draft|user sandbox|Please leave this line alone \(sandbox heading\))(?:\{\{[^{}]*\}\}|[^}{])*\}\}/ig, "");
text = text.replace(/\{\{(((change|edit|mediawiki|protected|sper|sudo)[ -]?(lock|semi|template)?[ -]?(protect|request)?[ -]?(ed(it)?|ion)?)(.*?)\}\}/gi, "");//drafts should never be protected or have edit requests on them
text = text.replace(/<!--\s*-->/ig, ""); // Remove empty HTML comments
text = text.replace(/^----+$/igm, ""); // Removes horizontal rules
if (afc_re.test(text)) // Remove "AfC submission with missing AfC template" maintenace category - a cleanup will remove the cat without adding any!

5 comments on commit 5d45540

@hasteur

This comment has been minimized.

Show comment
Hide comment
@hasteur

hasteur Jan 11, 2014

Member

Regex is BROKEN
Uncaught SyntaxError: Invalid regular expression: /{{(((change|edit|mediawiki|protected|sper|sudo)[ -]?(lock|semi|template)?[ -]?(protect|request)?[ -]?(ed(it)?|ion)?)(.*?)}}/: Unterminated group

Chrome using the Theo's Little Bot dev tracker version

Also we can have protection on an AFC submission to prevent a anonymous/non-*confirmed editor from trying to submit a draft when it's hopelessly inappropriate.

Member

hasteur replied Jan 11, 2014

Regex is BROKEN
Uncaught SyntaxError: Invalid regular expression: /{{(((change|edit|mediawiki|protected|sper|sudo)[ -]?(lock|semi|template)?[ -]?(protect|request)?[ -]?(ed(it)?|ion)?)(.*?)}}/: Unterminated group

Chrome using the Theo's Little Bot dev tracker version

Also we can have protection on an AFC submission to prevent a anonymous/non-*confirmed editor from trying to submit a draft when it's hopelessly inappropriate.

@Technical-13

This comment has been minimized.

Show comment
Hide comment
@Technical-13

Technical-13 Jan 11, 2014

Contributor

http://regexpal.com/?flags=gi&regex=\{\{%28%28change|edit|mediawiki|protected|sper|sudo%29[%20-]%3F%28lock|semi|template%29%3F[%20-]%3F%28protect|request%29%3F[%20-]%3F%28ed%28it%29%3F|ion%29%3F%29%28.*%3F%29\}\}&input={{Sudo}}%0A{{Mediawikiedit}}%0A{{MediaWikiEdit}}%0A{{Editrequest}}%0A{{Editrequested}}%0A{{EditProtected}}%0A{{Editprotect}}%0A{{Changerequest}}%0A{{Edit%20requested}}%0A{{Editprotected}}%0A{{Edit%20protect}}%0A{{Protected%20edit}}%0A{{Edit-protected}}%0A{{Edit%20locked}}%0A{{Edit%20Protected}}%0A{{Edittemplateprotected}}%0A{{Edit%20templateprotected}}%0A{{Edittemplate-protected}}%0A{{Edit%20template%20protected}}%0A{{Edit-semiprotected}}%0A{{SPER}}%0A{{Editsemiprotect}}%0A{{Editsemiprotected}}%0A{{Edit%20semi%20protected}}%0A{{Edit%20semiprotected}}%0A{{Edit-Semi%20Protection}}%0A{{Sudo|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Mediawikiedit|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{MediaWikiEdit|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Editrequest|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Editrequested|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{EditProtected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Editprotect|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Changerequest|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20requested|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Editprotected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20protect|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Protected%20edit|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit-protected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20locked|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20Protected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edittemplateprotected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20templateprotected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edittemplate-protected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20template%20protected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit-semiprotected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{SPER|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Editsemiprotect|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Editsemiprotected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20semi%20protected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20semiprotected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit-Semi%20Protection|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}

Says it should be fine... Let me reactivate it and see what is happening...

Contributor

Technical-13 replied Jan 11, 2014

http://regexpal.com/?flags=gi&regex=\{\{%28%28change|edit|mediawiki|protected|sper|sudo%29[%20-]%3F%28lock|semi|template%29%3F[%20-]%3F%28protect|request%29%3F[%20-]%3F%28ed%28it%29%3F|ion%29%3F%29%28.*%3F%29\}\}&input={{Sudo}}%0A{{Mediawikiedit}}%0A{{MediaWikiEdit}}%0A{{Editrequest}}%0A{{Editrequested}}%0A{{EditProtected}}%0A{{Editprotect}}%0A{{Changerequest}}%0A{{Edit%20requested}}%0A{{Editprotected}}%0A{{Edit%20protect}}%0A{{Protected%20edit}}%0A{{Edit-protected}}%0A{{Edit%20locked}}%0A{{Edit%20Protected}}%0A{{Edittemplateprotected}}%0A{{Edit%20templateprotected}}%0A{{Edittemplate-protected}}%0A{{Edit%20template%20protected}}%0A{{Edit-semiprotected}}%0A{{SPER}}%0A{{Editsemiprotect}}%0A{{Editsemiprotected}}%0A{{Edit%20semi%20protected}}%0A{{Edit%20semiprotected}}%0A{{Edit-Semi%20Protection}}%0A{{Sudo|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Mediawikiedit|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{MediaWikiEdit|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Editrequest|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Editrequested|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{EditProtected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Editprotect|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Changerequest|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20requested|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Editprotected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20protect|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Protected%20edit|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit-protected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20locked|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20Protected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edittemplateprotected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20templateprotected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edittemplate-protected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20template%20protected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit-semiprotected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{SPER|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Editsemiprotect|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Editsemiprotected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20semi%20protected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit%20semiprotected|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}%0A{{Edit-Semi%20Protection|%3C!--%20some%20pagename%20--%3E|ans%28swer%29%3F%3D%28yes|no%29}}

Says it should be fine... Let me reactivate it and see what is happening...

@hasteur

This comment has been minimized.

Show comment
Hide comment
@hasteur

hasteur Jan 11, 2014

Member

I really wish you wouldn't. I demonstrated that it IS broken. And the base premise that we not have these is invalid.

Member

hasteur replied Jan 11, 2014

I really wish you wouldn't. I demonstrated that it IS broken. And the base premise that we not have these is invalid.

@Technical-13

This comment has been minimized.

Show comment
Hide comment
@Technical-13

Technical-13 Jan 11, 2014

Contributor

@hasteur, is it still broken, I removed an extra para when I uncommented it... ANd the whole point of develop is to work out bugs, I'm not seeing any errors from this change.

Contributor

Technical-13 replied Jan 11, 2014

@hasteur, is it still broken, I removed an extra para when I uncommented it... ANd the whole point of develop is to work out bugs, I'm not seeing any errors from this change.

@wikipedia-mabdul

This comment has been minimized.

Show comment
Hide comment
@wikipedia-mabdul

wikipedia-mabdul Jan 18, 2014

Member

well use that one

\{\{((change|edit|mediawiki|protected|sper|sudo)[ -]?(lock|semi|template)?[ -]?(protect|request)?[ -]?(ed(it)?|ion)?)(?:\{\{[^\{\}]*\}\}|[^\}\{])*\}\}

You really had a bracket missing. moreover is your (.*?) not "the fine English way"...

Member

wikipedia-mabdul replied Jan 18, 2014

well use that one

\{\{((change|edit|mediawiki|protected|sper|sudo)[ -]?(lock|semi|template)?[ -]?(protect|request)?[ -]?(ed(it)?|ion)?)(?:\{\{[^\{\}]*\}\}|[^\}\{])*\}\}

You really had a bracket missing. moreover is your (.*?) not "the fine English way"...

Please sign in to comment.