Skip to content

Commit

Permalink
add comments to talk page
Browse files Browse the repository at this point in the history
  • Loading branch information
gullyn committed Mar 12, 2022
1 parent fd9c10c commit 8ad4945
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/modules/submissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,10 @@
this.text = this.text.replace( /^\s*/, '' );
};

AFCH.Text.prototype.getAfcComments = function () {
return this.text.match( /\{\{\s*afc comment[\s\S]+?\(UTC\)\}\}/gi );
};

AFCH.Text.prototype.removeAfcTemplates = function () {
// FIXME: Awful regex to remove the old submission templates
// This is bad. It works for most cases but has a hellish time
Expand Down Expand Up @@ -2216,6 +2220,12 @@
// ARTICLE
// -------

// get comments left by reviewers to put on talk page
var comments = [];
if ( data.copyComments ) {
comments = newText.getAfcComments();
}

newText.removeAfcTemplates();

newText.updateCategories( data.newCategories );
Expand Down Expand Up @@ -2325,6 +2335,10 @@
' WikiProject banner' + ( ( wikiProjectsToRemove.length === 1 ) ? '' : 's' );
}

if ( comments.length > 0 ) {
talkText += '== Comments left by AfC reviewers ==\n' + comments.join( '\n\n' );
}

talkPage.edit( {
contents: talkText,
summary: summary
Expand Down
5 changes: 5 additions & 0 deletions src/templates/tpl-submissions.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@
<input type="checkbox" id="isBiography" class="afch-input"/>
</div>

<div id="copyCommentsWrapper">
<label for="copyComments" class="afch-label">Copy comments to talk page</label>
<input type="checkbox" id="copyComments" class="afch-input"/>
</div>

<div id="bioOptionsWrapper" class="hidden">

<div id="subjectNameWrapper">
Expand Down

0 comments on commit 8ad4945

Please sign in to comment.