Skip to content

Commit 82f9408

Browse files
committed
Fix MW 1.35 compat
1 parent 8b8ba04 commit 82f9408

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,17 @@ The JavaScript tests can only be run by going to the [`Special:JavaScriptTest` p
247247

248248
## Release notes
249249

250+
### Version 1.1.2
251+
252+
Released on September 7, 2020.
253+
254+
* Fixed MediaWiki 1.31 compatibility (1.1.0 regression)
255+
250256
### Version 1.1.1
251257

252258
Released on September 7, 2020.
253259

254-
* Fixed error happening when giving invalid page names to `#network`
260+
* Made code more robust against invalid titles
255261

256262
### Version 1.1.0
257263

extension.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Network",
33

4-
"version": "1.1.1",
4+
"version": "1.1.2",
55

66
"author": [
77
"[https://www.entropywins.wtf/mediawiki Jeroen De Dauw]",

resources/js/PageBlacklist.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@ module.PageBlacklist = ( function ( mw ) {
2626
let title = mw.Title.newFromText(pageName);
2727

2828
return title === null
29-
|| (this.excludeTalk && title.isTalkPage())
29+
|| (this.excludeTalk && this._isTalkPage(title))
3030
|| this.namespaces.includes(title.getNamespaceId());
31-
}
31+
};
32+
33+
PageBlacklist.prototype._isTalkPage = function(title) {
34+
// Can replace this function with title.isTalkPage() on MW 1.35+
35+
let namespaceId = title.getNamespaceId();
36+
return !!(namespaceId > 0 && namespaceId % 2);
37+
};
3238

3339
return PageBlacklist;
3440

0 commit comments

Comments
 (0)