Merge "Make ApiDiscussionToolsEdit non-internal, add 'tags'"

This commit is contained in:
jenkins-bot 2023-08-16 17:00:37 +00:00 committed by Gerrit Code Review
commit d28b11383e
3 changed files with 24 additions and 10 deletions

View file

@ -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 <var>paction</var> is <var>addcomment</var>. Overrides <var>commentname</var>.",
"apihelp-discussiontoolsedit-param-commentname": "Name of the comment to reply to. Only used when <var>paction</var> is <var>addcomment</var>.",
"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 <var>wikitext</var>.",
"apihelp-discussiontoolsedit-param-sectiontitle": "{{int:apihelp-edit-param-sectiontitle}} Only used when <var>paction</var> is <var>addtopic</var>.",

View file

@ -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}}",

View file

@ -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
*/