jenkins-bot has submitted this change and it was merged.

Change subject: Publishing options: Fix user namespace publishing
......................................................................


Publishing options: Fix user namespace publishing

Use mw.Title.getNamepaceId to check for User namespace when updating version on 
user namespace drafts.

Bug: T76180
Change-Id: I0af1e9510f5e3f8ebe4a611194b1aaefe86548f7
---
M modules/base/ext.cx.sitemapper.js
M modules/publish/ext.cx.publish.js
2 files changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Santhosh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/base/ext.cx.sitemapper.js 
b/modules/base/ext.cx.sitemapper.js
index f3930f6..1aae4b6 100644
--- a/modules/base/ext.cx.sitemapper.js
+++ b/modules/base/ext.cx.sitemapper.js
@@ -70,9 +70,9 @@
        mw.cx.SiteMapper.prototype.getTargetTitle = function ( title ) {
                var targetTitle, targetNameSpace;
 
-               // If the title has already been set
-               // to the user namespace just return it.
-               if ( /^User:/.test( title ) ) {
+               // If the title is already in the
+               // user namespace just return it.
+               if ( new mw.Title( title ).getNamespaceId() === 2 ) {
                        return title;
                }
 
diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index 0d53c03..992ea11 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -225,7 +225,7 @@
                                                        .text( mw.msg( 
'cx-publish-button' ) );
                                        } );
                                } else if ( publishAnyway === false ) {
-                                       if ( /^User:/.test( publishedTitle ) ) {
+                                       if ( new mw.Title( publishedTitle 
).getNamespaceId() === 2 ) {
                                                publishedTitle = 
increaseVersion( publishedTitle );
                                        } else {
                                                publishedTitle = 'User:' + 
username + '/' + publishedTitle;

-- 
To view, visit https://gerrit.wikimedia.org/r/185479
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0af1e9510f5e3f8ebe4a611194b1aaefe86548f7
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Jsahleen <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to