diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:32:59 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:32:59 -0400 |
commit | 6dc1997577fab2c366781fd7048144935afa0012 (patch) | |
tree | 8918d28c7ab4342f0738985e37af1dfc42d0e93a /resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js | |
parent | 150f94f051128f367bc89f6b7e5f57eb2a69fc62 (diff) | |
parent | fa89acd685cb09cdbe1c64cbb721ec64975bbbc1 (diff) |
Merge commit 'fa89acd'
# Conflicts:
# .gitignore
# extensions/ArchInterWiki.sql
Diffstat (limited to 'resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js')
-rw-r--r-- | resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js b/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js index 9d280800..6f9aa025 100644 --- a/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js +++ b/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js @@ -24,11 +24,11 @@ * @param {Function} messagePosterConstructor Constructor for MessagePoster */ MwMessagePosterFactory.prototype.register = function ( contentModel, messagePosterConstructor ) { - if ( this.contentModelToClass[contentModel] !== undefined ) { + if ( this.contentModelToClass[ contentModel ] !== undefined ) { throw new Error( 'The content model \'' + contentModel + '\' is already registered.' ); } - this.contentModelToClass[contentModel] = messagePosterConstructor; + this.contentModelToClass[ contentModel ] = messagePosterConstructor; }; /** @@ -38,7 +38,7 @@ * @param {string} contentModel Content model to unregister */ MwMessagePosterFactory.prototype.unregister = function ( contentModel ) { - delete this.contentModelToClass[contentModel]; + delete this.contentModelToClass[ contentModel ]; }; /** @@ -67,9 +67,9 @@ indexpageids: 1, titles: title.getPrefixedDb() } ).then( function ( result ) { - if ( result.query.pageids.length > 0 ) { - pageId = result.query.pageids[0]; - page = result.query.pages[pageId]; + if ( result.query.pageids && result.query.pageids.length > 0 ) { + pageId = result.query.pageids[ 0 ]; + page = result.query.pages[ pageId ]; contentModel = page.contentmodel; moduleName = 'mediawiki.messagePoster.' + contentModel; @@ -100,7 +100,7 @@ * */ MwMessagePosterFactory.prototype.createForContentModel = function ( contentModel, title ) { - return new this.contentModelToClass[contentModel]( title ); + return new this.contentModelToClass[ contentModel ]( title ); }; mw.messagePoster = { |