diff --git a/extension.json b/extension.json
index 6488002c2..2bbf0092b 100644
--- a/extension.json
+++ b/extension.json
@@ -40,6 +40,7 @@
},
"logger.js",
"modifier.js",
+ "utils.js",
"parser.js",
"lib/moment-timezone/moment-timezone-with-data-1970-2030.js",
{
diff --git a/modules/dt.init.js b/modules/dt.init.js
index 77982cc50..78f3a386a 100644
--- a/modules/dt.init.js
+++ b/modules/dt.init.js
@@ -25,5 +25,6 @@ module.exports = {
controller: require( './controller.js' ),
parser: require( './parser.js' ),
modifier: require( './modifier.js' ),
+ utils: require( './utils.js' ),
logger: require( './logger.js' )
};
diff --git a/modules/dt.ui.ReplyWidget.js b/modules/dt.ui.ReplyWidget.js
index d6aa9333a..e04455585 100644
--- a/modules/dt.ui.ReplyWidget.js
+++ b/modules/dt.ui.ReplyWidget.js
@@ -1,5 +1,5 @@
var controller = require( 'ext.discussionTools.init' ).controller,
- modifier = require( 'ext.discussionTools.init' ).modifier,
+ utils = require( 'ext.discussionTools.init' ).utils,
logger = require( 'ext.discussionTools.init' ).logger;
/**
@@ -21,7 +21,7 @@ function ReplyWidget( comment, config ) {
ReplyWidget.super.call( this, config );
this.comment = comment;
- contextNode = modifier.closestElement( this.comment.range.endContainer, [ 'dl', 'ul', 'ol' ] );
+ contextNode = utils.closestElement( this.comment.range.endContainer, [ 'dl', 'ul', 'ol' ] );
this.context = contextNode ? contextNode.nodeName.toLowerCase() : 'dl';
inputConfig = $.extend(
diff --git a/modules/modifier.js b/modules/modifier.js
index 667e56635..34a49c271 100644
--- a/modules/modifier.js
+++ b/modules/modifier.js
@@ -1,22 +1,8 @@
/* global $:off */
'use strict';
-/**
- * Find closest ancestor element using one of the given tag names.
- *
- * @param {Node} el
- * @param {string[]} tagNames
- * @return {HTMLElement|null}
- */
-function closestElement( el, tagNames ) {
- do {
- if ( el.nodeType === Node.ELEMENT_NODE && tagNames.indexOf( el.tagName.toLowerCase() ) !== -1 ) {
- return el;
- }
- el = el.parentNode;
- } while ( el );
- return null;
-}
+var
+ utils = require( './utils.js' );
function whitespaceParsoidHack( listItem ) {
// HACK: Setting data-parsoid removes the whitespace after the list item,
@@ -105,7 +91,7 @@ function addListItem( comment ) {
// First, we need to find a block-level parent that we can mess with.
// If we can't find a surrounding list item or paragraph (e.g. maybe we're inside a table cell
// or something), take the parent node and hope for the best.
- parent = closestElement( target, [ 'li', 'dd', 'p' ] ) || target.parentNode;
+ parent = utils.closestElement( target, [ 'li', 'dd', 'p' ] ) || target.parentNode;
while ( target.parentNode !== parent ) {
target = target.parentNode;
}
@@ -240,7 +226,6 @@ function createWikitextNode( wt ) {
}
module.exports = {
- closestElement: closestElement,
addReplyLink: addReplyLink,
addListItem: addListItem,
removeListItem: removeListItem,
diff --git a/modules/parser.js b/modules/parser.js
index b92133c1b..ddd5b1261 100644
--- a/modules/parser.js
+++ b/modules/parser.js
@@ -1,8 +1,9 @@
/* eslint-disable no-console */
'use strict';
-// DiscussionToolsHooks::getLocalData()
var
+ utils = require( './utils.js' ),
+ // DiscussionToolsHooks::getLocalData()
data = require( './parser/data.json' ),
moment = require( './lib/moment-timezone/moment-timezone-with-data-1970-2030.js' );
@@ -746,7 +747,8 @@ function getComments( rootNode ) {
// notifications or something).
if (
curComment.type === 'comment' &&
- node.parentNode === curComment.range.endContainer.parentNode
+ ( utils.closestElement( node, [ 'li', 'dd', 'p' ] ) || node.parentNode ) ===
+ ( utils.closestElement( curComment.range.endContainer, [ 'li', 'dd', 'p' ] ) || curComment.range.endContainer.parentNode )
) {
// Merge this with the previous comment. Use that comment's author and timestamp.
curComment.range.endContainer = range.endContainer;
diff --git a/modules/utils.js b/modules/utils.js
new file mode 100644
index 000000000..e7005ce31
--- /dev/null
+++ b/modules/utils.js
@@ -0,0 +1,22 @@
+'use strict';
+
+/**
+ * Find closest ancestor element using one of the given tag names.
+ *
+ * @param {Node} el
+ * @param {string[]} tagNames
+ * @return {HTMLElement|null}
+ */
+function closestElement( el, tagNames ) {
+ do {
+ if ( el.nodeType === Node.ELEMENT_NODE && tagNames.indexOf( el.tagName.toLowerCase() ) !== -1 ) {
+ return el;
+ }
+ el = el.parentNode;
+ } while ( el );
+ return null;
+}
+
+module.exports = {
+ closestElement: closestElement
+};
diff --git a/tests/qunit/cases/en-big-oldparser/en-big-oldparser-modified.html b/tests/qunit/cases/en-big-oldparser/en-big-oldparser-modified.html
index 8390ce48c..512f58de1 100644
--- a/tests/qunit/cases/en-big-oldparser/en-big-oldparser-modified.html
+++ b/tests/qunit/cases/en-big-oldparser/en-big-oldparser-modified.html
@@ -2543,13 +2543,13 @@ P-
Bumping thread for 30 days. JoeHebda (talk) 02:46, 19 July 2019 (UTC)
Greetings, Community tech bot appears to be down (not running) since April, 2019. Instructions are To report bugs, please write on the Community tech bot talk page on Meta. I did report in June, and with no response. Wondering if an expert here could fix? For example, Wikipedia:WikiProject Saints/Popular pages Updated: 6:32 pm, 26 April 2019, Friday (2 months, 13 days ago). Regards, JoeHebda (talk) 13:06, 8 July 2019 (UTC)
-
- Reply to JoeHebda|2019-07-19T02:46:00.000Z|0
+
- @MusikAnimal (WMF): any insight in to this? — xaosflux Talk 18:59, 8 July 2019 (UTC)
- The cron job for this month didn't start for some reason. I have manually triggered it. "Saints" is pretty far down the list so it may be a while before the bot gets to it. I don't have an answer as to why no report was created for May and June, but I will investigate. Also, don't forget about toolforge:massviews which can give you the same information in real-time: [45]. That tool seems to be having problems of its own (lots of errors querying the pageviews API, tracked at phab:T219857), which I'm starting to believe might be the same reason Popular Pages bot isn't finishing some reports. MusikAnimal (WMF) (talk) 20:12, 8 July 2019 (UTC)
- Thanks @MusikAnimal (WMF): - I really like viewing Popular Pages on my fav. WPs; very helpful! Wondering if bot stalls out if it's not done running current month jobs & at calendar new month (day 1) starts a second bot? Just curious... JoeHebda (talk) 12:26, 9 July 2019 (UTC)
- I suspect all the reports will be done within the next two weeks. If not, the reports for July will start populating on the 3rd. This is because it takes up to two full days for the previous month's data to be available. Best, MusikAnimal (WMF) (talk) 17:28, 9 July 2019 (UTC)
- Hello @MusikAnimal (WMF): - Since starting at 15:41, 8 July 2019, the bot as of this morning has processed 60 WPs out of over 1,600 so it has a long ways to go to complete. At 30 perday, thats 53 days of runtime. JoeHebda (talk) 14:01, 10 July 2019 (UTC)
-
- The bot only goes through WPs configured at User:Community Tech bot/Popular pages config.json, which is about 800 or so. Most of these are quite small and will be processed quickly. That said I certainly can't guarantee they will all be finished before the month is over. We are monitoring and are discussing ways to improve performance. Thanks for your patience, MusikAnimal (WMF) (talk) 18:39, 10 July 2019 (UTC)
- Reply to MusikAnimal (WMF)|2019-07-10T18:39:00.000Z|0
- Reply to JoeHebda|2019-07-10T14:01:00.000Z|0
- Reply to MusikAnimal (WMF)|2019-07-09T17:28:00.000Z|0
- Reply to JoeHebda|2019-07-09T12:26:00.000Z|0
- Reply to MusikAnimal (WMF)|2019-07-08T20:12:00.000Z|0
- Reply to Xaosflux|2019-07-08T18:59:00.000Z|0
- Reply to JoeHebda|2019-07-08T13:06:00.000Z|0
+- The bot only goes through WPs configured at User:Community Tech bot/Popular pages config.json, which is about 800 or so. Most of these are quite small and will be processed quickly. That said I certainly can't guarantee they will all be finished before the month is over. We are monitoring and are discussing ways to improve performance. Thanks for your patience, MusikAnimal (WMF) (talk) 18:39, 10 July 2019 (UTC)
- Reply to MusikAnimal (WMF)|2019-07-10T18:39:00.000Z|0
- Reply to JoeHebda|2019-07-10T14:01:00.000Z|0
Reply to MusikAnimal (WMF)|2019-07-09T17:28:00.000Z|0Reply to JoeHebda|2019-07-09T12:26:00.000Z|0Reply to MusikAnimal (WMF)|2019-07-08T20:12:00.000Z|0Reply to Xaosflux|2019-07-08T18:59:00.000Z|0Reply to JoeHebda|2019-07-19T02:46:00.000Z|0
┌────────────┘
diff --git a/tests/qunit/cases/en-big-oldparser/en-big-oldparser-reply.html b/tests/qunit/cases/en-big-oldparser/en-big-oldparser-reply.html
index 1656ebbbb..2e1ad10f1 100644
--- a/tests/qunit/cases/en-big-oldparser/en-big-oldparser-reply.html
+++ b/tests/qunit/cases/en-big-oldparser/en-big-oldparser-reply.html
@@ -2541,7 +2541,7 @@ P-
- People do not come here to read policy and disclaimers. --Izno (talk) 14:34, 17 August 2019 (UTC)Reply
- Bumping thread for 30 days. JoeHebda (talk) 02:46, 19 July 2019 (UTC)Reply
+
Bumping thread for 30 days. JoeHebda (talk) 02:46, 19 July 2019 (UTC)
Greetings, Community tech bot appears to be down (not running) since April, 2019. Instructions are To report bugs, please write on the Community tech bot talk page on Meta. I did report in June, and with no response. Wondering if an expert here could fix? For example, Wikipedia:WikiProject Saints/Popular pages Updated: 6:32 pm, 26 April 2019, Friday (2 months, 13 days ago). Regards, JoeHebda (talk) 13:06, 8 July 2019 (UTC)Reply
- @MusikAnimal (WMF): any insight in to this? — xaosflux Talk 18:59, 8 July 2019 (UTC)Reply
diff --git a/tests/qunit/cases/en-big-oldparser/en-big-oldparser.json b/tests/qunit/cases/en-big-oldparser/en-big-oldparser.json
index fd68eac1f..2255976e8 100644
--- a/tests/qunit/cases/en-big-oldparser/en-big-oldparser.json
+++ b/tests/qunit/cases/en-big-oldparser/en-big-oldparser.json
@@ -19425,34 +19425,20 @@
"author": "JoeHebda",
"range": [
"0/1514/0",
- "0/1514/2/6/27"
+ "0/1514/11/26"
],
"signatureRanges": [
[
"0/1514/2/3",
"0/1514/2/6/27"
- ]
- ],
- "level": 1,
- "id": "JoeHebda|2019-07-19T02:46:00.000Z|0",
- "replies": []
- },
- {
- "type": "comment",
- "timestamp": "2019-07-08T13:06:00.000Z",
- "author": "JoeHebda",
- "range": [
- "0/1514/3",
- "0/1514/11/26"
- ],
- "signatureRanges": [
+ ],
[
"0/1514/8",
"0/1514/11/26"
]
],
"level": 1,
- "id": "JoeHebda|2019-07-08T13:06:00.000Z|0",
+ "id": "JoeHebda|2019-07-19T02:46:00.000Z|0",
"replies": [
{
"type": "comment",
diff --git a/tests/qunit/cases/en-big-parsoid/en-big-parsoid-modified.html b/tests/qunit/cases/en-big-parsoid/en-big-parsoid-modified.html
index a43f74da1..9eede19dd 100644
--- a/tests/qunit/cases/en-big-parsoid/en-big-parsoid-modified.html
+++ b/tests/qunit/cases/en-big-parsoid/en-big-parsoid-modified.html
@@ -2485,13 +2485,13 @@ P-
Bumping thread for 30 days. JoeHebda (talk) 02:46, 19 July 2019 (UTC)
-Greetings, Community tech bot appears to be down (not running) since April, 2019. Instructions are To report bugs, please write on the Community tech bot talk page on Meta. I did report in June, and with no response. Wondering if an expert here could fix? For example, Wikipedia:WikiProject Saints/Popular pages Updated: 6:32 pm, 26 April 2019, Friday (2 months, 13 days ago). Regards, JoeHebda (talk) 13:06, 8 July 2019 (UTC)
- Reply to JoeHebda|2019-07-19T02:46:00.000Z|0
+Greetings, Community tech bot appears to be down (not running) since April, 2019. Instructions are To report bugs, please write on the Community tech bot talk page on Meta. I did report in June, and with no response. Wondering if an expert here could fix? For example, Wikipedia:WikiProject Saints/Popular pages Updated: 6:32 pm, 26 April 2019, Friday (2 months, 13 days ago). Regards, JoeHebda (talk) 13:06, 8 July 2019 (UTC)
- @MusikAnimal (WMF): any insight in to this? — xaosflux Talk 18:59, 8 July 2019 (UTC)
- The cron job for this month didn't start for some reason. I have manually triggered it. "Saints" is pretty far down the list so it may be a while before the bot gets to it. I don't have an answer as to why no report was created for May and June, but I will investigate. Also, don't forget about toolforge:massviews which can give you the same information in real-time: . That tool seems to be having problems of its own (lots of errors querying the pageviews API, tracked at phab:T219857), which I'm starting to believe might be the same reason Popular Pages bot isn't finishing some reports. MusikAnimal (WMF) (talk) 20:12, 8 July 2019 (UTC)
- Thanks @MusikAnimal (WMF): - I really like viewing Popular Pages on my fav. WPs; very helpful! Wondering if bot stalls out if it's not done running current month jobs & at calendar new month (day 1) starts a second bot? Just curious... JoeHebda (talk) 12:26, 9 July 2019 (UTC)
- I suspect all the reports will be done within the next two weeks. If not, the reports for July will start populating on the 3rd. This is because it takes up to two full days for the previous month's data to be available. Best, MusikAnimal (WMF) (talk) 17:28, 9 July 2019 (UTC)
- Hello @MusikAnimal (WMF): - Since starting at 15:41, 8 July 2019, the bot as of this morning has processed 60 WPs out of over 1,600 so it has a long ways to go to complete. At 30 perday, thats 53 days of runtime. JoeHebda (talk) 14:01, 10 July 2019 (UTC)
-
- The bot only goes through WPs configured at User:Community Tech bot/Popular pages config.json, which is about 800 or so. Most of these are quite small and will be processed quickly. That said I certainly can't guarantee they will all be finished before the month is over. We are monitoring and are discussing ways to improve performance. Thanks for your patience, MusikAnimal (WMF) (talk) 18:39, 10 July 2019 (UTC)
- Reply to MusikAnimal (WMF)|2019-07-10T18:39:00.000Z|0
- Reply to JoeHebda|2019-07-10T14:01:00.000Z|0
- Reply to MusikAnimal (WMF)|2019-07-09T17:28:00.000Z|0
- Reply to JoeHebda|2019-07-09T12:26:00.000Z|0
- Reply to MusikAnimal (WMF)|2019-07-08T20:12:00.000Z|0
- Reply to Xaosflux|2019-07-08T18:59:00.000Z|0
- Reply to JoeHebda|2019-07-08T13:06:00.000Z|0
+- The bot only goes through WPs configured at User:Community Tech bot/Popular pages config.json, which is about 800 or so. Most of these are quite small and will be processed quickly. That said I certainly can't guarantee they will all be finished before the month is over. We are monitoring and are discussing ways to improve performance. Thanks for your patience, MusikAnimal (WMF) (talk) 18:39, 10 July 2019 (UTC)
- Reply to MusikAnimal (WMF)|2019-07-10T18:39:00.000Z|0
- Reply to JoeHebda|2019-07-10T14:01:00.000Z|0
- Reply to MusikAnimal (WMF)|2019-07-09T17:28:00.000Z|0
- Reply to JoeHebda|2019-07-09T12:26:00.000Z|0
- Reply to MusikAnimal (WMF)|2019-07-08T20:12:00.000Z|0
- Reply to Xaosflux|2019-07-08T18:59:00.000Z|0
- Reply to JoeHebda|2019-07-19T02:46:00.000Z|0
┌────────────┘
- Should the Lists table be updated? So it matches the Config table.
diff --git a/tests/qunit/cases/en-big-parsoid/en-big-parsoid-transcludedFrom.json b/tests/qunit/cases/en-big-parsoid/en-big-parsoid-transcludedFrom.json
index 84945b012..90f3f14bb 100644
--- a/tests/qunit/cases/en-big-parsoid/en-big-parsoid-transcludedFrom.json
+++ b/tests/qunit/cases/en-big-parsoid/en-big-parsoid-transcludedFrom.json
@@ -933,8 +933,7 @@
"PrimeHunter|2019-08-17T08:13:00.000Z|0": false,
"Monniasza|2019-08-17T14:19:00.000Z|0": false,
"Izno|2019-08-17T14:34:00.000Z|0": false,
- "JoeHebda|2019-07-19T02:46:00.000Z|0": "Template:Small",
- "JoeHebda|2019-07-08T13:06:00.000Z|0": false,
+ "JoeHebda|2019-07-19T02:46:00.000Z|0": false,
"Xaosflux|2019-07-08T18:59:00.000Z|0": false,
"MusikAnimal (WMF)|2019-07-08T20:12:00.000Z|0": false,
"JoeHebda|2019-07-09T12:26:00.000Z|0": false,
diff --git a/tests/qunit/cases/en-big-parsoid/en-big-parsoid.json b/tests/qunit/cases/en-big-parsoid/en-big-parsoid.json
index d5cfccd65..9d9747fdb 100644
--- a/tests/qunit/cases/en-big-parsoid/en-big-parsoid.json
+++ b/tests/qunit/cases/en-big-parsoid/en-big-parsoid.json
@@ -19424,34 +19424,20 @@
"author": "JoeHebda",
"range": [
"176/2/0/0/0",
- "176/2/2/6/27"
+ "176/2/14/26"
],
"signatureRanges": [
[
"176/2/2/3",
"176/2/2/6/27"
- ]
- ],
- "level": 1,
- "id": "JoeHebda|2019-07-19T02:46:00.000Z|0",
- "replies": []
- },
- {
- "type": "comment",
- "timestamp": "2019-07-08T13:06:00.000Z",
- "author": "JoeHebda",
- "range": [
- "176/2/5",
- "176/2/14/26"
- ],
- "signatureRanges": [
+ ],
[
"176/2/11",
"176/2/14/26"
]
],
"level": 1,
- "id": "JoeHebda|2019-07-08T13:06:00.000Z|0",
+ "id": "JoeHebda|2019-07-19T02:46:00.000Z|0",
"replies": [
{
"type": "comment",