jenkins-bot has submitted this change and it was merged.
Change subject: BSApiWikiPageTasks: bugfixes
......................................................................
BSApiWikiPageTasks: bugfixes
Change-Id: I13e9c8f0ee24a73633277c034659b5a97707cbc1
---
M includes/api/BSApiWikiPageTasks.php
M resources/bluespice.extjs/BS/action/APIAddCategories.js
M resources/bluespice.extjs/BS/action/APIRemoveCategories.js
M resources/bluespice.extjs/BS/action/APISetCategories.js
4 files changed, 38 insertions(+), 33 deletions(-)
Approvals:
Mglaser: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/api/BSApiWikiPageTasks.php
b/includes/api/BSApiWikiPageTasks.php
index 0ef22c6..bffe691 100644
--- a/includes/api/BSApiWikiPageTasks.php
+++ b/includes/api/BSApiWikiPageTasks.php
@@ -146,7 +146,6 @@
*/
protected function task_getExplicitCategories( $oTaskData, $aParams ) {
$oResponse = $this->makeStandardReturn();
-
//get Title of the page
$oTitle = Title::newFromText( $oTaskData->page_title );
@@ -265,6 +264,7 @@
return $oResponse;
}
+ $sLocalNSName = BsNamespaceHelper::getNamespaceName(
NS_CATEGORY );
foreach ( $aNewCategories as $sCategoryToAdd ) {
$sText .= "\n[[" . $sLocalNSName .
":".$sCategoryToAdd."]]";
}
@@ -295,16 +295,17 @@
protected function task_removeCategories( $oTaskData, $aParams ) {
$oResponse = $this->makeStandardReturn();
$aCategoriesToRemove = $oTaskData->categories;
+
if (count($aCategoriesToRemove) === 0){
$oResponse->message = wfMessage(
'bs-wikipage-tasks-error-nothingtoremove')->plain();
$oResponse->payload = array();
$oResponse->payload_count = 0;
+ return $oResponse;
}
//get Title of the page
$oTitle = Title::newFromText( $oTaskData->page_title );
-
if ( $oTitle instanceof Title === false ) {
$oResponse->message = wfMessage(
'bs-wikipage-tasks-error-page-not-valid' )->plain();
return $oResponse;
@@ -332,7 +333,7 @@
$oResponse->message = wfMessage(
'bs-wikipage-tasks-error-contentmodel' )->plain();
return $oResponse;
}
-
+
$sCanonicalNSName = MWNamespace::getCanonicalName( NS_CATEGORY
);
$sLocalNSName = BsNamespaceHelper::getNamespaceName(
NS_CATEGORY );
foreach ($aCategoriesToRemove as $sToRemove){
diff --git a/resources/bluespice.extjs/BS/action/APIAddCategories.js
b/resources/bluespice.extjs/BS/action/APIAddCategories.js
index 9bdcf8c..e3bc019 100644
--- a/resources/bluespice.extjs/BS/action/APIAddCategories.js
+++ b/resources/bluespice.extjs/BS/action/APIAddCategories.js
@@ -1,17 +1,10 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
- Ext.define('BS.action.ApiAddCategories', {
+Ext.define( 'BS.action.APIAddCategories', {
extend: 'BS.action.Base',
-
- categories: array(),
+ categories: [],
pageTitle: '',
contructor: function(){
- this.callParent(arguments);
+ this.callParent( arguments );
},
execute: function(){
@@ -28,27 +21,30 @@
return dfd.promise();
},
- doAPIAddCategories: function( dfd, set){
+ doAPIAddCategories: function( dfd, set ){
var taskData = {
page_title: set.page_title,
categories: set.categories
};
bs.api.tasks.execSilent(
- 'bs-wikipage-tasks', 'addCategories', taskData
+ 'wikipage', 'addCategories', taskData
)
.fail(function( response ){
this.actionStatus = BS.action.Base.STATUS_ERROR;
dfd.reject( this, set, response);
})
.done(function( response ) {
+ if( !response.success ){
+ this.actionStatus = BS.action.Base.STATUS_ERROR;
+ dfd.reject( this, set, response );
+ }
this.actionStatus = BS.action.Base.STATUS_DONE;
- dfd.resolve(this);
+ dfd.resolve( this );
});
-
},
getDescription: function(){
- return
mw.message('bs-deferred-action-apiaddcategories-description',
this.pageTitle).parse();
+ return mw.message(
'bs-deferred-action-apiaddcategories-description', this.pageTitle ).parse();
}
});
diff --git a/resources/bluespice.extjs/BS/action/APIRemoveCategories.js
b/resources/bluespice.extjs/BS/action/APIRemoveCategories.js
index dd9ee68..199cdd3 100644
--- a/resources/bluespice.extjs/BS/action/APIRemoveCategories.js
+++ b/resources/bluespice.extjs/BS/action/APIRemoveCategories.js
@@ -1,7 +1,7 @@
-Ext.define('BS.action.ApiRemoveCategories', {
+Ext.define( 'BS.action.APIRemoveCategories', {
extend: 'BS.action.Base',
- categories: array(),
+ categories: [],
pageTitle: '',
contructor: function(){
@@ -22,25 +22,29 @@
return dfd.promise();
},
- doAPIRemoveCategories: function( dfd, set){
+ doAPIRemoveCategories: function( dfd, set ){
var taskData = {
page_title: set.page_title,
categories: set.categories
};
bs.api.tasks.execSilent(
- 'bs-wikipage-tasks', 'removeCategories', taskData
+ 'wikipage', 'removeCategories', taskData
)
.fail(function( response ){
this.actionStatus = BS.action.Base.STATUS_ERROR;
- dfd.reject( this, set, response);
+ dfd.reject( this, set, response );
})
.done(function( response ) {
+ if( !response.success ){
+ this.actionStatus = BS.action.Base.STATUS_ERROR;
+ dfd.reject( this, set, response );
+ }
this.actionStatus = BS.action.Base.STATUS_DONE;
- dfd.resolve(this);
+ dfd.resolve( this );
});
},
getDescription: function(){
- return
mw.message('bs-deferred-action-apiremovecategories-description',
this.pageTitle).parse();
+ return mw.message(
'bs-deferred-action-apiremovecategories-description', this.pageTitle ).parse();
}
});
\ No newline at end of file
diff --git a/resources/bluespice.extjs/BS/action/APISetCategories.js
b/resources/bluespice.extjs/BS/action/APISetCategories.js
index 4f969fa..c508f53 100644
--- a/resources/bluespice.extjs/BS/action/APISetCategories.js
+++ b/resources/bluespice.extjs/BS/action/APISetCategories.js
@@ -1,11 +1,11 @@
-Ext.define('BS.action.ApiSetCategories', {
+Ext.define( 'BS.action.APISetCategories', {
extend: 'BS.action.Base',
- categories: array(),
+ categories: [],
pageTitle: '',
contructor: function(){
- this.callParent(arguments);
+ this.callParent( arguments );
},
execute: function(){
@@ -22,25 +22,29 @@
return dfd.promise();
},
- doAPISetCategories: function( dfd, set){
+ doAPISetCategories: function( dfd, set ){
var taskData = {
page_title: set.page_title,
categories: set.categories
};
bs.api.tasks.execSilent(
- 'bs-wikipage-tasks', 'setCategories', taskData
+ 'wikipage', 'setCategories', taskData
)
.fail(function( response ){
this.actionStatus = BS.action.Base.STATUS_ERROR;
- dfd.reject( this, set, response);
+ dfd.reject( this, set, response );
})
.done(function( response ) {
+ if( !response.success ){
+ this.actionStatus = BS.action.Base.STATUS_ERROR;
+ dfd.reject( this, set, response );
+ }
this.actionStatus = BS.action.Base.STATUS_DONE;
- dfd.resolve(this);
+ dfd.resolve( this );
});
},
getDescription: function(){
- return
mw.message('bs-deferred-action-apisetcategories-description',
this.pageTitle).parse();
+ return mw.message(
'bs-deferred-action-apisetcategories-description', this.pageTitle ).parse();
}
});
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/314231
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I13e9c8f0ee24a73633277c034659b5a97707cbc1
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: ItSpiderman <[email protected]>
Gerrit-Reviewer: Dvogel hallowelt <[email protected]>
Gerrit-Reviewer: Ljonka <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Pwirth <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits