Add SuggestedEditsSchema
Immediately after merging the patch, Special:CommunityConfiguration/GrowthSuggestedEdits will work, but it will look very broken. This is because of T363477 and T362098, which will make the form look (mostly) normally. The form should now look like https://ctrlv.cz/1zNn, and the config for the three structured tasks should work as expected. Bug: T360471 Depends-On: I6b6470ac05316f475660294740fecb4e35296229 Change-Id: I0a25dd94c5f88b2a887dc7879623dd9e3219e2c8
这个提交包含在:
父节点
fa9e14da99
当前提交
456a16f5a7
|
@ -655,6 +655,11 @@
|
|||
}
|
||||
},
|
||||
"CommunityConfiguration": {
|
||||
"ProviderClasses": {
|
||||
"GrowthSuggestedEdits": {
|
||||
"class": "GrowthExperiments\\Config\\Providers\\SuggestedEditsConfigProvider"
|
||||
}
|
||||
},
|
||||
"Providers": {
|
||||
"HelpPanel": {
|
||||
"store": {
|
||||
|
@ -714,7 +719,7 @@
|
|||
"GrowthExperiments\\Config\\Schemas\\SuggestedEditsSchema"
|
||||
]
|
||||
},
|
||||
"type": "data"
|
||||
"type": "GrowthSuggestedEdits"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,5 +134,46 @@
|
|||
"communityconfiguration-growthhomepage-gehomepagesuggestededitsintrolinks-image-label": "Destination page for a link about how to add images in the visual editor",
|
||||
"communityconfiguration-growthsuggestededits-title": "Suggested edits",
|
||||
"communityconfiguration-growthsuggestededits-geinfoboxtemplates-label": "Infobox templates",
|
||||
"communityconfiguration-growthsuggestededits-geinfoboxtemplates-help-text": "These templates are needed for the image suggestions newcomer task feature. Articles containing these templates will not be listed as image suggestion tasks."
|
||||
"communityconfiguration-growthsuggestededits-geinfoboxtemplates-help-text": "These templates are needed for the image suggestions newcomer task feature. Articles containing these templates will not be listed as image suggestion tasks.",
|
||||
"communityconfiguration-growthsuggestededits-copyedit-label": "Copyedit",
|
||||
"communityconfiguration-growthsuggestededits-copyedit-disabled-label": "Is the task enabled?",
|
||||
"communityconfiguration-growthsuggestededits-copyedit-disabled-control-label": "The task is disabled.",
|
||||
"communityconfiguration-growthsuggestededits-copyedit-templates-label": "Copy editing: templates to find articles that need copy editing, such as spelling, grammar, and punctuation improvements.",
|
||||
"communityconfiguration-growthsuggestededits-copyedit-excludedtemplates-label": "Articles containing templates defined here will not be shown to users as tasks for this task type.",
|
||||
"communityconfiguration-growthsuggestededits-copyedit-excludedcategories-label": "Articles containing categories defined here will not be shown to users as tasks for this task type.",
|
||||
"communityconfiguration-growthsuggestededits-copyedit-learnmore-label": "Destination page for learning more about copy editing.",
|
||||
"communityconfiguration-growthsuggestededits-links-label": "Add links between articles",
|
||||
"communityconfiguration-growthsuggestededits-links-templates-label": "Links: templates to find articles that need more links.",
|
||||
"communityconfiguration-growthsuggestededits-links-excludedtemplates-label": "Articles containing templates defined here will not be shown to users as tasks for this task type.",
|
||||
"communityconfiguration-growthsuggestededits-links-excludedcategories-label": "Articles containing categories defined here will not be shown to users as tasks for this task type.",
|
||||
"communityconfiguration-growthsuggestededits-links-learnmore-label": "Destination page for learning more about adding links.",
|
||||
"communityconfiguration-growthsuggestededits-references-label": "Find references",
|
||||
"communityconfiguration-growthsuggestededits-references-templates-label": "References: templates to find articles that need more references.",
|
||||
"communityconfiguration-growthsuggestededits-references-excludedtemplates-label": "Articles containing templates defined here will not be shown to users as tasks for this task type.",
|
||||
"communityconfiguration-growthsuggestededits-references-excludedcategories-label": "Articles containing categories defined here will not be shown to users as tasks for this task type.",
|
||||
"communityconfiguration-growthsuggestededits-references-learnmore-label": "Destination page for learning more about adding references.",
|
||||
"communityconfiguration-growthsuggestededits-update-label": "Update articles",
|
||||
"communityconfiguration-growthsuggestededits-update-templates-label": "Update: templates to find articles that need to be updated with current information.",
|
||||
"communityconfiguration-growthsuggestededits-update-excludedtemplates-label": "Articles containing templates defined here will not be shown to users as tasks for this task type.",
|
||||
"communityconfiguration-growthsuggestededits-update-excludedcategories-label": "Articles containing categories defined here will not be shown to users as tasks for this task type.",
|
||||
"communityconfiguration-growthsuggestededits-update-learnmore-label": "Destination page for learning more about updating articles.",
|
||||
"communityconfiguration-growthsuggestededits-expand-label": "Expand short articles",
|
||||
"communityconfiguration-growthsuggestededits-expand-templates-label": "Expand: templates to find articles that need expansion.",
|
||||
"communityconfiguration-growthsuggestededits-expand-excludedtemplates-label": "Articles containing templates defined here will not be shown to users as tasks for this task type.",
|
||||
"communityconfiguration-growthsuggestededits-expand-excludedcategories-label": "Articles containing categories defined here will not be shown to users as tasks for this task type.",
|
||||
"communityconfiguration-growthsuggestededits-expand-learnmore-label": "Destination page for learning more about expanding articles.",
|
||||
"communityconfiguration-growthsuggestededits-image_recommendation-label": " Add an image to an unillustrated article",
|
||||
"communityconfiguration-growthsuggestededits-image_recommendation-disabled-label": "Is the task enabled?",
|
||||
"communityconfiguration-growthsuggestededits-image_recommendation-disabled-control-label": "The task is disabled.",
|
||||
"communityconfiguration-growthsuggestededits-image_recommendation-excludedtemplates-label": "Articles containing templates defined here will not be shown to users as tasks for this task type.",
|
||||
"communityconfiguration-growthsuggestededits-image_recommendation-excludedcategories-label": "Articles containing categories defined here will not be shown to users as tasks for this task type",
|
||||
"communityconfiguration-growthsuggestededits-image_recommendation-learnmore-label": "Destination page for learning more about image recommendation task type",
|
||||
"communityconfiguration-growthsuggestededits-image_recommendation-maxtasksperday-label": "The maximum number of \"Add an image to an unillustrated article\" suggested tasks a newcomer can complete daily",
|
||||
"communityconfiguration-growthsuggestededits-section_image_recommendation-label": "Add an image to an article section",
|
||||
"communityconfiguration-growthsuggestededits-section_image_recommendation-disabled-label": "Is the task enabled?",
|
||||
"communityconfiguration-growthsuggestededits-section_image_recommendation-disabled-control-label": "The task is disabled.",
|
||||
"communityconfiguration-growthsuggestededits-section_image_recommendation-excludedtemplates-label": "Articles containing templates defined here will not be shown to users as tasks for this task type.",
|
||||
"communityconfiguration-growthsuggestededits-section_image_recommendation-excludedcategories-label": "Articles containing categories defined here will not be shown to users as tasks for this task type",
|
||||
"communityconfiguration-growthsuggestededits-section_image_recommendation-learnmore-label": "Destination page for learning more about image recommendation task type",
|
||||
"communityconfiguration-growthsuggestededits-section_image_recommendation-maxtasksperday-label": "The maximum number of \"Add an image to an unillustrated article\" suggested tasks a newcomer can complete daily"
|
||||
}
|
||||
|
|
|
@ -147,5 +147,46 @@
|
|||
"communityconfiguration-growthhomepage-gehomepagesuggestededitsintrolinks-image-label": "Field label for Growth homepage in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-title": "Headline of the Community configuration module for suggested edits",
|
||||
"communityconfiguration-growthsuggestededits-geinfoboxtemplates-label": "Field label for Suggested Edits in Community configuration\n\nSame as {{msg-mw|growthexperiments-edit-config-newcomer-tasks-infobox-templates}}",
|
||||
"communityconfiguration-growthsuggestededits-geinfoboxtemplates-help-text": "Help text for Suggested Edits in Community configuration\n\nSame as {{msg-mw|growthexperiments-edit-config-newcomer-tasks-infobox-templates-help}}"
|
||||
"communityconfiguration-growthsuggestededits-geinfoboxtemplates-help-text": "Help text for Suggested Edits in Community configuration\n\nSame as {{msg-mw|growthexperiments-edit-config-newcomer-tasks-infobox-templates-help}}",
|
||||
"communityconfiguration-growthsuggestededits-copyedit-label": "Field label for Suggested Edits in Community configuration\n\nSame as {{mw-msg|growthexperiments-homepage-suggestededits-tasktype-name-copyedit}}",
|
||||
"communityconfiguration-growthsuggestededits-copyedit-disabled-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-copyedit-disabled-control-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-copyedit-templates-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-copyedit-excludedtemplates-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-copyedit-excludedcategories-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-copyedit-learnmore-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-links-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-links-templates-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-links-excludedtemplates-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-links-excludedcategories-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-links-learnmore-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-references-label": "Field label for Suggested Edits in Community configuration\n\nSame as {{mw-msg|growthexperiments-homepage-suggestededits-tasktype-name-references}}",
|
||||
"communityconfiguration-growthsuggestededits-references-templates-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-references-excludedtemplates-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-references-excludedcategories-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-references-learnmore-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-update-label": "Field label for Suggested Edits in Community configuration\n\nSame as {{mw-msg|growthexperiments-homepage-suggestededits-tasktype-name-update}}",
|
||||
"communityconfiguration-growthsuggestededits-update-templates-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-update-excludedtemplates-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-update-excludedcategories-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-update-learnmore-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-expand-label": "Field label for Suggested Edits in Community configuration\n\nSame as {{mw-msg|growthexperiments-homepage-suggestededits-tasktype-name-expand}}",
|
||||
"communityconfiguration-growthsuggestededits-expand-templates-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-expand-excludedtemplates-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-expand-excludedcategories-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-expand-learnmore-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-image_recommendation-label": "Field label for Suggested Edits in Community configuration\n\nSame as {{mw-msg|growthexperiments-homepage-suggestededits-tasktype-name-image-recommendation}}",
|
||||
"communityconfiguration-growthsuggestededits-image_recommendation-disabled-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-image_recommendation-disabled-control-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-image_recommendation-excludedtemplates-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-image_recommendation-excludedcategories-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-image_recommendation-learnmore-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-image_recommendation-maxtasksperday-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-section_image_recommendation-label": "Field label for Suggested Edits in Community configuration\n\nSame as {{mw-msg|growthexperiments-homepage-suggestededits-tasktype-name-section-image-recommendation}}",
|
||||
"communityconfiguration-growthsuggestededits-section_image_recommendation-disabled-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-section_image_recommendation-disabled-control-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-section_image_recommendation-excludedtemplates-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-section_image_recommendation-excludedcategories-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-section_image_recommendation-learnmore-label": "Field label for Suggested Edits in Community configuration",
|
||||
"communityconfiguration-growthsuggestededits-section_image_recommendation-maxtasksperday-label": "Field label for Suggested Edits in Community configuration"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace GrowthExperiments\Config\Providers;
|
||||
|
||||
use MediaWiki\Extension\CommunityConfiguration\Provider\DataProvider;
|
||||
use stdClass;
|
||||
|
||||
class SuggestedEditsConfigProvider extends DataProvider {
|
||||
|
||||
private const MAP_TASKS_PER_GROUP = [
|
||||
'copyedit' => 'easy',
|
||||
'links' => 'easy',
|
||||
'references' => 'medium',
|
||||
'section-image-recommendation' => 'medium',
|
||||
'update' => 'medium',
|
||||
'expand' => 'hard',
|
||||
'image-recommendation' => 'medium',
|
||||
'link-recommendation' => 'easy',
|
||||
];
|
||||
private const DEFAULT_GROUP = 'unknown';
|
||||
|
||||
private const MAP_TASK_TYPES = [
|
||||
'image-recommendation' => 'image-recommendation',
|
||||
'section-image-recommendation' => 'section-image-recommendation',
|
||||
'link-recommendation' => 'link-recommendation',
|
||||
];
|
||||
private const DEFAULT_TASK_TYPE = 'template-based';
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function addAutocomputedProperties( stdClass $config ): stdClass {
|
||||
foreach ( $config as $taskId => $taskData ) {
|
||||
if ( !$taskData instanceof stdClass ) {
|
||||
continue;
|
||||
}
|
||||
$config->$taskId->group = self::MAP_TASKS_PER_GROUP[$taskId] ?? self::DEFAULT_GROUP;
|
||||
$config->$taskId->type = self::MAP_TASK_TYPES[$taskId] ?? self::DEFAULT_TASK_TYPE;
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace GrowthExperiments\Config\Schemas;
|
||||
|
||||
use MediaWiki\Extension\CommunityConfiguration\Schema\JsonSchema;
|
||||
use MediaWiki\Extension\CommunityConfiguration\Schemas\MediaWiki\MediaWikiDefinitions;
|
||||
|
||||
class GrowthDefinitions extends JsonSchema {
|
||||
|
||||
public const TEMPLATE_BASED_TASK = [
|
||||
self::TYPE => self::TYPE_OBJECT,
|
||||
self::PROPERTIES => [
|
||||
'disabled' => [
|
||||
self::TYPE => self::TYPE_BOOLEAN,
|
||||
self::DEFAULT => false,
|
||||
],
|
||||
'templates' => [
|
||||
self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
|
||||
],
|
||||
'excludedTemplates' => [
|
||||
self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
|
||||
],
|
||||
'excludedCategories' => [
|
||||
self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
|
||||
],
|
||||
'learnmore' => [
|
||||
self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitle' ],
|
||||
],
|
||||
],
|
||||
self::ADDITIONAL_PROPERTIES => false,
|
||||
];
|
||||
}
|
|
@ -7,7 +7,112 @@ use MediaWiki\Extension\CommunityConfiguration\Schemas\MediaWiki\MediaWikiDefini
|
|||
|
||||
// phpcs:disable Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase
|
||||
class SuggestedEditsSchema extends JsonSchema {
|
||||
|
||||
public const GEInfoboxTemplates = [
|
||||
self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
|
||||
];
|
||||
|
||||
// ***** TEMPLATE BASED TASKS *****
|
||||
public const copyedit = [
|
||||
self::REF => [ 'class' => GrowthDefinitions::class, 'field' => 'TEMPLATE_BASED_TASK' ],
|
||||
];
|
||||
|
||||
public const expand = [
|
||||
self::REF => [ 'class' => GrowthDefinitions::class, 'field' => 'TEMPLATE_BASED_TASK' ],
|
||||
];
|
||||
|
||||
public const links = [
|
||||
self::REF => [ 'class' => GrowthDefinitions::class, 'field' => 'TEMPLATE_BASED_TASK' ],
|
||||
];
|
||||
|
||||
public const references = [
|
||||
self::REF => [ 'class' => GrowthDefinitions::class, 'field' => 'TEMPLATE_BASED_TASK' ],
|
||||
];
|
||||
|
||||
public const update = [
|
||||
self::REF => [ 'class' => GrowthDefinitions::class, 'field' => 'TEMPLATE_BASED_TASK' ],
|
||||
];
|
||||
|
||||
// ***** STRUCTURED TASKS *****
|
||||
public const image_recommendation = [
|
||||
self::TYPE => self::TYPE_OBJECT,
|
||||
self::PROPERTIES => [
|
||||
'disabled' => [
|
||||
self::TYPE => self::TYPE_BOOLEAN,
|
||||
self::DEFAULT => false,
|
||||
],
|
||||
'excludedTemplates' => [
|
||||
self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
|
||||
],
|
||||
'excludedCategories' => [
|
||||
self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
|
||||
],
|
||||
'learnmore' => [
|
||||
self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitle' ],
|
||||
],
|
||||
'maxTasksPerDay' => [
|
||||
self::TYPE => self::TYPE_NUMBER,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
public const section_image_recommendation = [
|
||||
self::TYPE => self::TYPE_OBJECT,
|
||||
self::PROPERTIES => [
|
||||
'disabled' => [
|
||||
self::TYPE => self::TYPE_BOOLEAN,
|
||||
self::DEFAULT => false,
|
||||
],
|
||||
'excludedTemplates' => [
|
||||
self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
|
||||
],
|
||||
'excludedCategories' => [
|
||||
self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
|
||||
],
|
||||
'learnmore' => [
|
||||
self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitle' ],
|
||||
],
|
||||
'maxTasksPerDay' => [
|
||||
self::TYPE => self::TYPE_NUMBER,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
public const link_recommendation = [
|
||||
self::TYPE => self::TYPE_OBJECT,
|
||||
self::PROPERTIES => [
|
||||
'disabled' => [
|
||||
self::TYPE => self::TYPE_BOOLEAN,
|
||||
self::DEFAULT => false,
|
||||
],
|
||||
'excludedTemplates' => [
|
||||
self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
|
||||
],
|
||||
'excludedCategories' => [
|
||||
self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
|
||||
],
|
||||
'learnmore' => [
|
||||
self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitle' ],
|
||||
],
|
||||
'maximumLinksToShowPerTask' => [
|
||||
self::TYPE => self::TYPE_NUMBER,
|
||||
],
|
||||
'excludedSections' => [
|
||||
self::TYPE => self::TYPE_ARRAY,
|
||||
self::ITEMS => [
|
||||
self::TYPE => self::TYPE_STRING,
|
||||
],
|
||||
self::DEFAULT => [],
|
||||
],
|
||||
'maxTasksPerDay' => [
|
||||
self::TYPE => self::TYPE_NUMBER,
|
||||
],
|
||||
'underlinkedWeight' => [
|
||||
self::TYPE => self::TYPE_NUMBER,
|
||||
],
|
||||
'minimumLinkScore' => [
|
||||
self::TYPE => self::TYPE_NUMBER,
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
正在加载...
在新工单中引用