mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiEditor
synced 2024-11-23 15:57:15 +00:00
Tag WikiEditor edits with a hidden tag
Bug: T249038 Change-Id: Ia4267bc430ba0f12cce496ebf6f8c1773ae355a6
This commit is contained in:
parent
648a9543b6
commit
b4f144057e
|
@ -26,7 +26,10 @@
|
|||
"EditPage::showEditForm:fields": "WikiEditorHooks",
|
||||
"EditPage::attemptSave": "WikiEditorHooks",
|
||||
"EditPage::attemptSave:after": "WikiEditorHooks",
|
||||
"EditPageGetPreviewContent": "WikiEditorHooks"
|
||||
"EditPageGetPreviewContent": "WikiEditorHooks",
|
||||
"ListDefinedTags": "WikiEditorHooks",
|
||||
"ChangeTagsListActive": "WikiEditorHooks",
|
||||
"RecentChange_save": "WikiEditorHooks"
|
||||
},
|
||||
"HookHandlers": {
|
||||
"WikiEditorHooks": {
|
||||
|
|
|
@ -197,5 +197,7 @@
|
|||
"wikieditor-toolbar-help-content-signature-result": "<a href='#' title='$1:Username'>Username</a> (<a href='#' title='$2:Username'>talk</a>)",
|
||||
"wikieditor-toolbar-help-content-indent-description": "Indent",
|
||||
"wikieditor-toolbar-help-content-indent-syntax": "Normal text<br />:Indented text<br />::Indented text",
|
||||
"wikieditor-toolbar-help-content-indent-result": "Normal text<dl><dd>Indented text<dl><dd>Indented text</dd></dl></dd></dl>"
|
||||
"wikieditor-toolbar-help-content-indent-result": "Normal text<dl><dd>Indented text<dl><dd>Indented text</dd></dl></dd></dl>",
|
||||
"tag-wikieditor": "-",
|
||||
"tag-wikieditor-description": "Edit made using [[mw:Special:MyLanguage/Extension:WikiEditor|WikiEditor]] (2010 wikitext editor)"
|
||||
}
|
||||
|
|
|
@ -227,5 +227,7 @@
|
|||
"wikieditor-toolbar-help-content-signature-result": "{{RawHtml|phab=T294760}}\n\nHTML example used in the help section \"discussion\" of the toolbar.\n\nParameters:\n* $1 - The \"User\" namespace name\n* $2 - The \"User talk\" namespace name",
|
||||
"wikieditor-toolbar-help-content-indent-description": "{{RawHtml|phab=T294760}}\n\n{{Identical|Indent}}",
|
||||
"wikieditor-toolbar-help-content-indent-syntax": "{{RawHtml|phab=T294760}}\n\nSyntax example used in the help section \"discussion\" of the toolbar",
|
||||
"wikieditor-toolbar-help-content-indent-result": "{{RawHtml|phab=T294760}}\n\nHTML example used in the help section \"discussion\" of the toolbar"
|
||||
"wikieditor-toolbar-help-content-indent-result": "{{RawHtml|phab=T294760}}\n\nHTML example used in the help section \"discussion\" of the toolbar",
|
||||
"tag-wikieditor": "{{ignored}}Short description of the wikieditor tag.\n\nShown on lists of changes (history, recentchanges, etc.) for each edit made using WikiEditor.\n\nSee also:\n* {{msg-mw|Tag-wikieditor-description}}",
|
||||
"tag-wikieditor-description": "Long description of the wikieditor tag ({{msg-mw|Tag-wikieditor}}).\n\nShown on [[Special:Tags]].\n\nSee also:\n* {{msg-mw|Tag-wikieditor}}"
|
||||
}
|
||||
|
|
|
@ -17,11 +17,14 @@ use EventLogging;
|
|||
use ExtensionRegistry;
|
||||
use Html;
|
||||
use MediaWiki\Cache\CacheKeyHelper;
|
||||
use MediaWiki\ChangeTags\Hook\ChangeTagsListActiveHook;
|
||||
use MediaWiki\ChangeTags\Hook\ListDefinedTagsHook;
|
||||
use MediaWiki\Hook\EditPage__attemptSave_afterHook;
|
||||
use MediaWiki\Hook\EditPage__attemptSaveHook;
|
||||
use MediaWiki\Hook\EditPage__showEditForm_fieldsHook;
|
||||
use MediaWiki\Hook\EditPage__showEditForm_initialHook;
|
||||
use MediaWiki\Hook\EditPageGetPreviewContentHook;
|
||||
use MediaWiki\Hook\RecentChange_saveHook;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Preferences\Hook\GetPreferencesHook;
|
||||
use MediaWiki\User\UserEditTracker;
|
||||
|
@ -29,6 +32,8 @@ use MediaWiki\User\UserOptionsLookup;
|
|||
use MessageLocalizer;
|
||||
use MWCryptRand;
|
||||
use OutputPage;
|
||||
use RecentChange;
|
||||
use RequestContext;
|
||||
use ResourceLoaderContext;
|
||||
use Status;
|
||||
use User;
|
||||
|
@ -44,12 +49,18 @@ class Hooks implements
|
|||
GetPreferencesHook,
|
||||
EditPage__attemptSaveHook,
|
||||
EditPage__attemptSave_afterHook,
|
||||
EditPageGetPreviewContentHook
|
||||
EditPageGetPreviewContentHook,
|
||||
ListDefinedTagsHook,
|
||||
ChangeTagsListActiveHook,
|
||||
RecentChange_saveHook
|
||||
{
|
||||
|
||||
/** @var string|bool ID used for grouping entries all of a session's entries together in EventLogging. */
|
||||
private static $statsId = false;
|
||||
|
||||
/** @var string[] */
|
||||
private static $tags = [ 'wikieditor' ];
|
||||
|
||||
/** @var Config */
|
||||
private $config;
|
||||
|
||||
|
@ -276,6 +287,14 @@ class Hooks implements
|
|||
* @param OutputPage $outputPage object.
|
||||
*/
|
||||
public function onEditPage__showEditForm_fields( $editPage, $outputPage ) {
|
||||
$outputPage->addHTML(
|
||||
Html::hidden(
|
||||
'wikieditorUsed',
|
||||
'',
|
||||
[ 'id' => 'wikieditorUsed' ]
|
||||
)
|
||||
);
|
||||
|
||||
if ( $editPage->contentModel !== CONTENT_MODEL_WIKITEXT
|
||||
|| !ExtensionRegistry::getInstance()->isLoaded( 'EventLogging' ) ) {
|
||||
return;
|
||||
|
@ -304,14 +323,6 @@ class Hooks implements
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
$outputPage->addHTML(
|
||||
Html::hidden(
|
||||
'wikieditorJavascriptSupport',
|
||||
'',
|
||||
[ 'id' => 'wikieditorJavascriptSupport' ]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -443,7 +454,7 @@ class Hooks implements
|
|||
if ( $status->isOK() ) {
|
||||
$action = 'saveSuccess';
|
||||
|
||||
if ( $request->getRawVal( 'wikieditorJavascriptSupport' ) === 'yes' ) {
|
||||
if ( $request->getRawVal( 'wikieditorUsed' ) === 'yes' ) {
|
||||
$this->doVisualEditorFeatureUseLogging(
|
||||
'mwSave', 'source-has-js', $article, $statsId
|
||||
);
|
||||
|
@ -512,6 +523,41 @@ class Hooks implements
|
|||
$this->doVisualEditorFeatureUseLogging( 'preview', 'preview-nonlive', $article, $editingStatsId );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] &$tags
|
||||
* @return bool|void
|
||||
*/
|
||||
public function onChangeTagsListActive( &$tags ) {
|
||||
$this->registerTags( $tags );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] &$tags
|
||||
* @return bool|void
|
||||
*/
|
||||
public function onListDefinedTags( &$tags ) {
|
||||
$this->registerTags( $tags );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] &$tags
|
||||
*/
|
||||
protected function registerTags( &$tags ) {
|
||||
$tags = array_merge( $tags, static::$tags );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RecentChange $recentChange
|
||||
* @return bool|void
|
||||
*/
|
||||
public function onRecentChange_save( $recentChange ) {
|
||||
$request = RequestContext::getMain()->getRequest();
|
||||
if ( $request->getRawVal( 'wikieditorUsed' ) === 'yes' ) {
|
||||
$recentChange->addTags( 'wikieditor' );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -152,8 +152,8 @@
|
|||
$editingSessionIdInput = $( '#editingStatsId' ),
|
||||
origText = $textarea.val();
|
||||
|
||||
// Tracking Javascript support: T263505
|
||||
$( '#wikieditorJavascriptSupport' ).val( 'yes' );
|
||||
// T263505, T249038
|
||||
$( '#wikieditorUsed' ).val( 'yes' );
|
||||
|
||||
if ( $editingSessionIdInput.length ) {
|
||||
editingSessionId = $editingSessionIdInput.val();
|
||||
|
|
Loading…
Reference in a new issue