diff --git a/i18n/api/en.json b/i18n/api/en.json
index 080d1a230..6e2212ea3 100644
--- a/i18n/api/en.json
+++ b/i18n/api/en.json
@@ -11,6 +11,7 @@
"apihelp-discussiontoolscompare-summary": "Get information about comment changes between two page revisions.",
"apihelp-discussiontoolsedit-param-commentid": "ID of the comment to reply to. Only used when paction is addcomment. Overrides commentname.",
"apihelp-discussiontoolsedit-param-commentname": "Name of the comment to reply to. Only used when paction is addcomment.",
+ "apihelp-discussiontoolsedit-param-autosubscribe": "Automatically subscribe the user to the talk page thread?",
"apihelp-discussiontoolsedit-param-formtoken": "An optional unique ID generated in the client to prevent double-posting.",
"apihelp-discussiontoolsedit-param-html": "Content to post, as HTML. Cannot be used together with wikitext.",
"apihelp-discussiontoolsedit-param-sectiontitle": "{{int:apihelp-edit-param-sectiontitle}} Only used when paction is addtopic.",
diff --git a/i18n/api/qqq.json b/i18n/api/qqq.json
index 50e415883..bef76d261 100644
--- a/i18n/api/qqq.json
+++ b/i18n/api/qqq.json
@@ -13,6 +13,7 @@
"apihelp-discussiontoolscompare-summary": "{{doc-apihelp-summary|discussiontoolscompare}}",
"apihelp-discussiontoolsedit-param-commentid": "{{doc-apihelp-param|discussiontoolsedit|commentid}}",
"apihelp-discussiontoolsedit-param-commentname": "{{doc-apihelp-param|discussiontoolsedit|commentname}}",
+ "apihelp-discussiontoolsedit-param-autosubscribe": "{{doc-apihelp-param|discussiontoolsedit|autosubscribe}}",
"apihelp-discussiontoolsedit-param-formtoken": "{{doc-apihelp-param|discussiontoolsedit|formtoken}}",
"apihelp-discussiontoolsedit-param-html": "{{doc-apihelp-param|discussiontoolsedit|html}}",
"apihelp-discussiontoolsedit-param-sectiontitle": "{{doc-apihelp-param|discussiontoolsedit|sectiontitle}}",
diff --git a/includes/ApiDiscussionToolsEdit.php b/includes/ApiDiscussionToolsEdit.php
index 664550796..e0a8e42f7 100644
--- a/includes/ApiDiscussionToolsEdit.php
+++ b/includes/ApiDiscussionToolsEdit.php
@@ -62,9 +62,10 @@ class ApiDiscussionToolsEdit extends ApiBase {
$title = Title::newFromText( $params['page'] );
$result = null;
- $autoSubscribe =
- $this->config->get( 'DiscussionToolsAutoTopicSubEditor' ) === 'discussiontoolsapi' &&
- HookUtils::shouldAddAutoSubscription( $this->getUser(), $title );
+ $autoSubscribe = $params['autosubscribe'] === 'yes' ||
+ ( $this->config->get( 'DiscussionToolsAutoTopicSubEditor' ) === 'discussiontoolsapi' &&
+ HookUtils::shouldAddAutoSubscription( $this->getUser(), $title ) &&
+ $params['autosubscribe'] === 'default' );
$subscribableHeadingName = null;
$subscribableSectionTitle = '';
@@ -193,6 +194,9 @@ class ApiDiscussionToolsEdit extends ApiBase {
'captchaid' => $params['captchaid'],
'captchaword' => $params['captchaword'],
'nocontent' => $params['nocontent'],
+ // NOTE: Must use getText() to work; PHP array from $params['tags'] is not understood
+ // by the visualeditoredit API.
+ 'tags' => $this->getRequest()->getText( 'tags' ),
'returnto' => $params['returnto'],
'returntoquery' => $params['returntoquery'],
'returntoanchor' => $params['returntoanchor'],
@@ -356,6 +360,9 @@ class ApiDiscussionToolsEdit extends ApiBase {
'captchaid' => $params['captchaid'],
'captchaword' => $params['captchaword'],
'nocontent' => $params['nocontent'],
+ // NOTE: Must use getText() to work; PHP array from $params['tags'] is not understood
+ // by the visualeditoredit API.
+ 'tags' => $this->getRequest()->getText( 'tags' ),
'returnto' => $params['returnto'],
'returntoquery' => $params['returntoquery'],
'returntoanchor' => $params['returntoanchor'],
@@ -424,6 +431,14 @@ class ApiDiscussionToolsEdit extends ApiBase {
ApiBase::PARAM_HELP_MSG => 'apihelp-visualeditoredit-param-paction',
ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
],
+ 'autosubscribe' => [
+ ParamValidator::PARAM_TYPE => [
+ 'yes',
+ 'no',
+ 'default'
+ ],
+ ParamValidator::PARAM_DEFAULT => 'default',
+ ],
'page' => [
ParamValidator::PARAM_REQUIRED => true,
ApiBase::PARAM_HELP_MSG => 'apihelp-visualeditoredit-param-page',
@@ -470,6 +485,10 @@ class ApiDiscussionToolsEdit extends ApiBase {
'nocontent' => [
ApiBase::PARAM_HELP_MSG => 'apihelp-visualeditoredit-param-nocontent',
],
+ 'tags' => [
+ ParamValidator::PARAM_ISMULTI => true,
+ ApiBase::PARAM_HELP_MSG => 'apihelp-visualeditoredit-param-tags',
+ ],
'returnto' => [
ParamValidator::PARAM_TYPE => 'title',
ApiBase::PARAM_HELP_MSG => 'apihelp-edit-param-returnto',
@@ -494,13 +513,6 @@ class ApiDiscussionToolsEdit extends ApiBase {
return 'csrf';
}
- /**
- * @inheritDoc
- */
- public function isInternal() {
- return true;
- }
-
/**
* @inheritDoc
*/