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

Change subject: Require a campaign field in WikiGrok responses
......................................................................


Require a campaign field in WikiGrok responses

Actual use of this information will be committed in a followup

Change-Id: I383d403593708ca4990187a4e7f17c0c11c4ae04
---
M i18n/en.json
M includes/api/ApiResponse.php
M tests/phpunit/api/ApiResponseTest.php
3 files changed, 3 insertions(+), 6 deletions(-)

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

Objections:
  Kaldari: There's a problem with this change, please improve



diff --git a/i18n/en.json b/i18n/en.json
index a4165fd..01a4a25 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -10,7 +10,6 @@
        "apihelp-wikigrokresponse-param-subject": "The label (in English) of 
the subject of the page",
        "apihelp-wikigrokresponse-param-task_token": "The unique WikiGrok 
instance token",
        "apihelp-wikigrokresponse-param-task_type": "The version of WikiGrok 
that the user interacted with",
-       "apihelp-wikigrokresponse-param-campaign_name": "The name of the 
WikiGrok campaign the response was generated from",
        "apihelp-wikigrokresponse-param-claims": "The JSON encoded claims that 
the user submitted",
        "apihelp-wikigrokresponse-param-mobile_mode": "The version of 
MobileFrontend that the user was using",
        "apihelp-wikigrokresponse-param-testing": "Whether or not the user is 
testing WikiGrok",
diff --git a/includes/api/ApiResponse.php b/includes/api/ApiResponse.php
index 8b15d7b..f92f581 100644
--- a/includes/api/ApiResponse.php
+++ b/includes/api/ApiResponse.php
@@ -97,6 +97,7 @@
                        || !isset( $claim['prop'] )
                        || !isset( $claim['valueid'] )
                        || !isset( $claim['value'] )
+                       || !isset( $claim['campaign'] )
                ) {
                        $this->dieUsage( 'Invalid claim: ' . json_encode( 
$claim ), 'invalidclaim' );
                }
@@ -158,10 +159,6 @@
                                ApiBasE::PARAM_TYPE => 'string',
                        ),
                        'task_type' => array(
-                               ApiBase::PARAM_REQUIRED => true,
-                               ApiBasE::PARAM_TYPE => 'string',
-                       ),
-                       'campaign_name' => array(
                                ApiBase::PARAM_REQUIRED => true,
                                ApiBasE::PARAM_TYPE => 'string',
                        ),
diff --git a/tests/phpunit/api/ApiResponseTest.php 
b/tests/phpunit/api/ApiResponseTest.php
index 0ddba6a..ac773ae 100644
--- a/tests/phpunit/api/ApiResponseTest.php
+++ b/tests/phpunit/api/ApiResponseTest.php
@@ -93,7 +93,6 @@
                        'subject' => 'Vessels',
                        'task_token' => 'abcdef0123456789',
                        'task_type' => 'mobile a',
-                       'campaign_name' => 'test campaign',
                        'claims' => json_encode( $claims ),
                        'mobile_mode' => 'beta',
                        'testing' => true,
@@ -141,6 +140,7 @@
                                'valueid' => 'Q3423',
                                'value' => 'insurance broker',
                                'correct' => true,
+                               'campaign' => 'stuff doing',
                        ),
                        array(
                                'propid' => 'P103',
@@ -148,6 +148,7 @@
                                'valueid' => 'Q7566',
                                'value' => 'engineer',
                                'correct' => false,
+                               'campaign' => 'occupation',
                        ),
                );
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I383d403593708ca4990187a4e7f17c0c11c4ae04
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/WikiGrok
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Phuedx <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to